source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogWord.asm@ 542

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

Changes:

  • Update of the copyright notices to include the year 2013.
File size: 4.3 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
21; Section containing code
22SECTION .text
23
24;--------------------------------------------------------------------
25; DialogWord_GetWordWithIoInDSSI
26; Parameters:
27; DS:SI: Ptr to WORD_DIALOG_IO
28; SS:BP: Ptr to parent MENU
29; Returns:
30; Nothing
31; Corrupts registers:
32; AX, BX, CX, DX, SI, DI
33;--------------------------------------------------------------------
34ALIGN JUMP_ALIGN
35DialogWord_GetWordWithIoInDSSI:
36 mov bx, WordEventHandler
37 mov BYTE [si+WORD_DIALOG_IO.bUserCancellation], TRUE
38 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
39
40
41;--------------------------------------------------------------------
42; WordEventHandler
43; Common parameters for all events:
44; BX: Menu event (anything from MENUEVENT struct)
45; SS:BP: Ptr to DIALOG
46; Common return values for all events:
47; CF: Set if event processed
48; Cleared if event not processed
49; Corrupts registers:
50; All
51;--------------------------------------------------------------------
52ALIGN JUMP_ALIGN
53WordEventHandler:
54 jmp [cs:bx+.rgfnEventHandlers]
55
56
57ALIGN JUMP_ALIGN
58.InitializeMenuinitFromDSSI:
59 xor ax, ax
60 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
61
62
63ALIGN JUMP_ALIGN
64.IdleProcessing:
65 xor cx, cx ; Item 0 is used as input line
66 call MenuText_AdjustDisplayContextForDrawingItemFromCX
67 call GetWordFromUser
68 call MenuInit_CloseMenuWindow
69 stc
70 ret
71
72
73ALIGN WORD_ALIGN
74.rgfnEventHandlers:
75istruc MENUEVENT
76 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
77 at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
78 at MENUEVENT.IdleProcessing, dw .IdleProcessing
79 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
80 at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
81 at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
82 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
83 at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
84 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
85iend
86
87
88;--------------------------------------------------------------------
89; GetWordFromUser
90; Parameters
91; SS:BP: Ptr to DIALOG
92; Returns:
93; Nothing (User input stored to WORD_DIALOG_IO)
94; Corrupts registers:
95; AX, BX, DX, SI, DI
96;--------------------------------------------------------------------
97ALIGN JUMP_ALIGN
98GetWordFromUser:
99 lds si, [bp+DIALOG.fpDialogIO]
100 eMOVZX bx, [si+WORD_DIALOG_IO.bNumericBase]
101ALIGN JUMP_ALIGN
102.GetUserInputIntilValidOrCancelled:
103 call Keyboard_ReadUserInputtedWordWhilePrinting
104 jz SHORT .UserCancellation
105
106 cmp ax, [si+WORD_DIALOG_IO.wMin]
107 jb SHORT .InputtedWordNotInRange
108 cmp ax, [si+WORD_DIALOG_IO.wMax]
109 ja SHORT .InputtedWordNotInRange
110
111 mov [si+WORD_DIALOG_IO.bUserCancellation], bh ; Zero = FALSE
112 mov [si+WORD_DIALOG_IO.wReturnWord], ax
113.UserCancellation:
114 ret
115
116.InputtedWordNotInRange:
117 call Keyboard_PlayBellForUnwantedKeystroke
118 call .ClearInputtedWordFromDialog
119 jmp SHORT .GetUserInputIntilValidOrCancelled
120
121;--------------------------------------------------------------------
122; .ClearInputtedWordFromDialog
123; Parameters
124; SS:BP: Ptr to DIALOG
125; Returns:
126; Nothing
127; Corrupts registers:
128; AX, CX, DX, DI
129;--------------------------------------------------------------------
130ALIGN JUMP_ALIGN
131.ClearInputtedWordFromDialog:
132 CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
133 xchg dx, ax
134
135 mov al, ' '
136 mov cx, 5
137 CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
138
139 xchg ax, dx
140 JMP_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
141
Note: See TracBrowser for help on using the repository browser.