source: xtideuniversalbios/tags/v2.0.0_beta_3/Assembly_Library/Src/Menu/Dialog/DialogString.asm@ 514

Last change on this file since 514 was 376, checked in by gregli@…, 12 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 4.2 KB
Line 
1; File name : DialogString.asm
2; Project name : Assembly Library
3; Created date : 12.8.2010
4; Last update : 18.11.2010
5; Author : Tomi Tilli
6; Description : Displays word input dialog.
7
8;
9; XTIDE Universal BIOS and Associated Tools
10; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
11;
12; This program is free software; you can redistribute it and/or modify
13; it under the terms of the GNU General Public License as published by
14; the Free Software Foundation; either version 2 of the License, or
15; (at your option) any later version.
16;
17; This program is distributed in the hope that it will be useful,
18; but WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20; GNU General Public License for more details.
21; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22;
23
24; Section containing code
25SECTION .text
26
27;--------------------------------------------------------------------
28; DialogString_GetStringWithIoInDSSI
29; Parameters:
30; DS:SI: Ptr to STRING_DIALOG_IO
31; SS:BP: Ptr to parent MENU
32; Returns:
33; Nothing
34; Corrupts registers:
35; AX, BX, CX, DX, SI, DI
36;--------------------------------------------------------------------
37ALIGN JUMP_ALIGN
38DialogString_GetStringWithIoInDSSI:
39 mov bx, StringEventHandler
40 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], TRUE
41 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
42
43
44;--------------------------------------------------------------------
45; StringEventHandler
46; Common parameters for all events:
47; BX: Menu event (anything from MENUEVENT struct)
48; SS:BP: Ptr to DIALOG
49; Common return values for all events:
50; CF: Set if event processed
51; Cleared if event not processed
52; Corrupts registers:
53; All
54;--------------------------------------------------------------------
55ALIGN JUMP_ALIGN
56StringEventHandler:
57 jmp [cs:bx+.rgfnEventHandlers]
58
59
60ALIGN JUMP_ALIGN
61.InitializeMenuinitFromDSSI:
62 xor ax, ax
63 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
64
65
66ALIGN JUMP_ALIGN
67.IdleProcessing:
68 xor cx, cx ; Item 0 is used as input line
69 call MenuText_AdjustDisplayContextForDrawingItemFromCX
70 call GetStringFromUser
71 call MenuInit_CloseMenuWindow
72 stc
73 ret
74
75
76ALIGN WORD_ALIGN
77.rgfnEventHandlers:
78istruc MENUEVENT
79 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
80 at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
81 at MENUEVENT.IdleProcessing, dw .IdleProcessing
82 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
83 at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
84 at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
85 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
86 at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
87 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
88iend
89
90
91;--------------------------------------------------------------------
92; GetStringFromUser
93; Parameters
94; SS:BP: Ptr to DIALOG
95; Returns:
96; Nothing (User input stored to STRING_DIALOG_IO)
97; Corrupts registers:
98; AX, CX, DX, SI, DI
99;--------------------------------------------------------------------
100ALIGN JUMP_ALIGN
101GetStringFromUser:
102 lds si, [bp+DIALOG.fpDialogIO]
103 mov cx, [si+STRING_DIALOG_IO.wBufferSize]
104 les di, [si+STRING_DIALOG_IO.fpReturnBuffer]
105 call .GetCharacterFilterFunctionToDX
106
107 call Keyboard_ReadUserInputtedStringToESDIWhilePrinting
108 jz SHORT .UserCancellation
109
110 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], FALSE
111 mov [si+STRING_DIALOG_IO.wReturnLength], cx
112.UserCancellation:
113 ret
114
115;--------------------------------------------------------------------
116; .GetCharacterFilterFunctionToDX
117; Parameters
118; DS:SI: Ptr to STRING_DIALOG_IO
119; SS:BP: Ptr to DIALOG
120; Returns:
121; CS:DX: Ptr to character filter function
122; Corrupts registers:
123; Nothing
124;--------------------------------------------------------------------
125ALIGN JUMP_ALIGN
126.GetCharacterFilterFunctionToDX:
127 mov dx, [si+STRING_DIALOG_IO.fnCharFilter]
128 test dx, dx
129 jnz SHORT .ReturnFilterFunctionInDX
130 mov dx, Char_CharIsValid
131ALIGN JUMP_ALIGN, ret
132.ReturnFilterFunctionInDX:
133 ret
Note: See TracBrowser for help on using the repository browser.