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

Last change on this file since 528 was 526, checked in by krille_n_@…, 11 years ago

Changes:

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