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
|
---|
22 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
34 | ALIGN JUMP_ALIGN
|
---|
35 | DialogWord_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 | ;--------------------------------------------------------------------
|
---|
52 | ALIGN JUMP_ALIGN
|
---|
53 | WordEventHandler:
|
---|
54 | jmp [cs:bx+.rgfnEventHandlers]
|
---|
55 |
|
---|
56 |
|
---|
57 | ALIGN JUMP_ALIGN
|
---|
58 | .InitializeMenuinitFromDSSI:
|
---|
59 | xor ax, ax
|
---|
60 | jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
|
---|
61 |
|
---|
62 |
|
---|
63 | ALIGN 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 |
|
---|
73 | ALIGN WORD_ALIGN
|
---|
74 | .rgfnEventHandlers:
|
---|
75 | istruc 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
|
---|
85 | iend
|
---|
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, CX, DX, SI, DI
|
---|
96 | ;--------------------------------------------------------------------
|
---|
97 | ALIGN JUMP_ALIGN
|
---|
98 | GetWordFromUser:
|
---|
99 | lds si, [bp+DIALOG.fpDialogIO]
|
---|
100 | eMOVZX bx, [si+WORD_DIALOG_IO.bNumericBase]
|
---|
101 | ALIGN JUMP_ALIGN
|
---|
102 | .GetUserInputUntilValidOrCancelled:
|
---|
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 | ; Clear inputted word from dialog
|
---|
119 | CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
|
---|
120 | xchg dx, ax
|
---|
121 |
|
---|
122 | mov al, ' '
|
---|
123 | mov cx, 5
|
---|
124 | CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
|
---|
125 |
|
---|
126 | xchg ax, dx
|
---|
127 | CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
|
---|
128 | jmp SHORT .GetUserInputUntilValidOrCancelled
|
---|