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-2023 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, 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 | .IdleProcessing:
|
---|
59 | xor cx, cx ; Item 0 is used as input line
|
---|
60 | call MenuText_AdjustDisplayContextForDrawingItemFromCX
|
---|
61 | call GetWordFromUser
|
---|
62 | call MenuInit_CloseMenuWindow
|
---|
63 | stc
|
---|
64 | ret
|
---|
65 |
|
---|
66 |
|
---|
67 | ALIGN WORD_ALIGN
|
---|
68 | .rgfnEventHandlers:
|
---|
69 | istruc MENUEVENT
|
---|
70 | at MENUEVENT.InitializeMenuinitFromDSSI, dw Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithItemZero
|
---|
71 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
|
---|
72 | at MENUEVENT.IdleProcessing, dw .IdleProcessing
|
---|
73 | at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
|
---|
74 | at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
|
---|
75 | at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
|
---|
76 | at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
|
---|
77 | at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
|
---|
78 | at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
|
---|
79 | iend
|
---|
80 |
|
---|
81 |
|
---|
82 | ;--------------------------------------------------------------------
|
---|
83 | ; GetWordFromUser
|
---|
84 | ; Parameters
|
---|
85 | ; SS:BP: Ptr to DIALOG
|
---|
86 | ; Returns:
|
---|
87 | ; Nothing (User input stored to WORD_DIALOG_IO)
|
---|
88 | ; Corrupts registers:
|
---|
89 | ; AX, BX, CX, DX, SI, DI, DS
|
---|
90 | ;--------------------------------------------------------------------
|
---|
91 | ALIGN JUMP_ALIGN
|
---|
92 | GetWordFromUser:
|
---|
93 | lds si, [bp+DIALOG.fpDialogIO]
|
---|
94 | eMOVZX bx, [si+WORD_DIALOG_IO.bNumericBase]
|
---|
95 | ALIGN JUMP_ALIGN
|
---|
96 | .GetUserInputUntilValidOrCancelled:
|
---|
97 | call Keyboard_ReadUserInputtedWordWhilePrinting
|
---|
98 | jz SHORT .UserCancellation
|
---|
99 |
|
---|
100 | cmp ax, [si+WORD_DIALOG_IO.wMin]
|
---|
101 | jb SHORT .InputtedWordNotInRange
|
---|
102 | cmp ax, [si+WORD_DIALOG_IO.wMax]
|
---|
103 | ja SHORT .InputtedWordNotInRange
|
---|
104 |
|
---|
105 | mov [si+WORD_DIALOG_IO.bUserCancellation], bh ; Zero = FALSE
|
---|
106 | mov [si+WORD_DIALOG_IO.wReturnWord], ax
|
---|
107 | .UserCancellation:
|
---|
108 | ret
|
---|
109 |
|
---|
110 | .InputtedWordNotInRange:
|
---|
111 | call Keyboard_PlayBellForUnwantedKeystroke
|
---|
112 | ; Clear inputted word from dialog
|
---|
113 | CALL_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
|
---|
114 | xchg dx, ax
|
---|
115 |
|
---|
116 | mov al, ' '
|
---|
117 | mov cx, 5
|
---|
118 | CALL_DISPLAY_LIBRARY PrintRepeatedCharacterFromALwithCountInCX
|
---|
119 |
|
---|
120 | xchg ax, dx
|
---|
121 | CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
|
---|
122 | jmp SHORT .GetUserInputUntilValidOrCancelled
|
---|