source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogString.asm@ 48

Last change on this file since 48 was 41, checked in by Tomi Tilli, 14 years ago

Initial commit for Assembly Library.

File size: 3.4 KB
Line 
1; File name : DialogString.asm
2; Project name : Assembly Library
3; Created date : 12.8.2010
4; Last update : 7.9.2010
5; Author : Tomi Tilli
6; Description : Displays word input dialog.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; DialogString_GetStringWithIoInDSSI
13; Parameters:
14; DS:SI: Ptr to STRING_DIALOG_IO
15; SS:BP: Ptr to parent MENU
16; Returns:
17; Nothing
18; Corrupts registers:
19; AX, BX, CX, DX, SI, DI
20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22DialogString_GetStringWithIoInDSSI:
23 mov bx, StringEventHandler
24 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], TRUE
25 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
26
27
28;--------------------------------------------------------------------
29; StringEventHandler
30; Common parameters for all events:
31; BX: Menu event (anything from MENUEVENT struct)
32; SS:BP: Ptr to DIALOG
33; Common return values for all events:
34; CF: Set if event processed
35; Cleared if event not processed
36; Corrupts registers:
37; All
38;--------------------------------------------------------------------
39ALIGN JUMP_ALIGN
40StringEventHandler:
41 jmp [cs:bx+.rgfnEventHandlers]
42
43
44ALIGN JUMP_ALIGN
45.IdleProcessing:
46 xor ax, ax ; Item 0 is used as input line
47 call MenuText_AdjustDisplayContextForDrawingItemFromAX
48 call GetStringFromUser
49 call MenuInit_CloseMenuWindow
50 stc
51 ret
52
53
54ALIGN WORD_ALIGN
55.rgfnEventHandlers:
56istruc MENUEVENT
57 at MENUEVENT.InitializeMenuinitFromDSSI, dw Dialog_EventInitializeMenuinitFromDSSIforSingleItem
58 at MENUEVENT.ExitMenu, dw Dialog_EventNotHandled
59 at MENUEVENT.IdleProcessing, dw .IdleProcessing
60 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
61 at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
62 at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
63 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
64 at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
65 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
66iend
67
68
69;--------------------------------------------------------------------
70; GetStringFromUser
71; Parameters
72; SS:BP: Ptr to DIALOG
73; Returns:
74; Nothing (User input stored to STRING_DIALOG_IO)
75; Corrupts registers:
76; AX, CX, DX, SI, DI
77;--------------------------------------------------------------------
78ALIGN JUMP_ALIGN
79GetStringFromUser:
80 lds si, [bp+DIALOG.fpDialogIO]
81 mov cx, [si+STRING_DIALOG_IO.wBufferSize]
82 les di, [si+STRING_DIALOG_IO.fpReturnBuffer]
83 call .GetCharacterFilterFunctionToDX
84
85 call Keyboard_ReadUserInputtedStringToESDIWhilePrinting
86 jz SHORT .UserCancellation
87
88 mov BYTE [si+STRING_DIALOG_IO.bUserCancellation], FALSE
89 mov [si+STRING_DIALOG_IO.wReturnLength], cx
90.UserCancellation:
91 ret
92
93;--------------------------------------------------------------------
94; .GetCharacterFilterFunctionToDX
95; Parameters
96; DS:SI: Ptr to STRING_DIALOG_IO
97; SS:BP: Ptr to DIALOG
98; Returns:
99; CS:DX: Ptr to character filter function
100; Corrupts registers:
101; Nothing
102;--------------------------------------------------------------------
103ALIGN JUMP_ALIGN
104.GetCharacterFilterFunctionToDX:
105 mov dx, [si+STRING_DIALOG_IO.fnCharFilter]
106 test dx, dx
107 jnz SHORT .ReturnFilterFunctionInDX
108 mov dx, Char_CharIsValid
109ALIGN JUMP_ALIGN, ret
110.ReturnFilterFunctionInDX:
111 ret
Note: See TracBrowser for help on using the repository browser.