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

Last change on this file since 302 was 293, checked in by krille_n_@…, 13 years ago

Commit 1/2 (Library, Configurators and Serial Server):

  • Changed Emulate.inc so that making 286 and 386 versions now works. Additionally, only one processor type define is needed in the makefile.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File size: 3.7 KB
Line 
1; File name : DialogWord.asm
2; Project name : Assembly Library
3; Created date : 10.8.2010
4; Last update : 18.11.2010
5; Author : Tomi Tilli
6; Description : Displays word input dialog.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; DialogWord_GetWordWithIoInDSSI
13; Parameters:
14; DS:SI: Ptr to WORD_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
22DialogWord_GetWordWithIoInDSSI:
23 mov bx, WordEventHandler
24 mov BYTE [si+WORD_DIALOG_IO.bUserCancellation], TRUE
25 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
26
27
28;--------------------------------------------------------------------
29; WordEventHandler
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
40WordEventHandler:
41 jmp [cs:bx+.rgfnEventHandlers]
42
43
44ALIGN JUMP_ALIGN
45.InitializeMenuinitFromDSSI:
46 xor ax, ax
47 jmp Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
48
49
50ALIGN JUMP_ALIGN
51.IdleProcessing:
52 xor cx, cx ; Item 0 is used as input line
53 call MenuText_AdjustDisplayContextForDrawingItemFromCX
54 call GetWordFromUser
55 call MenuInit_CloseMenuWindow
56 stc
57 ret
58
59
60ALIGN WORD_ALIGN
61.rgfnEventHandlers:
62istruc MENUEVENT
63 at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
64 at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
65 at MENUEVENT.IdleProcessing, dw .IdleProcessing
66 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
67 at MENUEVENT.ItemSelectedFromCX, dw Dialog_EventNotHandled
68 at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled
69 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
70 at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation
71 at MENUEVENT.RefreshItemFromCX, dw Dialog_EventNotHandled
72iend
73
74
75;--------------------------------------------------------------------
76; GetWordFromUser
77; Parameters
78; SS:BP: Ptr to DIALOG
79; Returns:
80; Nothing (User input stored to WORD_DIALOG_IO)
81; Corrupts registers:
82; AX, BX, DX, SI, DI
83;--------------------------------------------------------------------
84ALIGN JUMP_ALIGN
85GetWordFromUser:
86 lds si, [bp+DIALOG.fpDialogIO]
87 eMOVZX bx, [si+WORD_DIALOG_IO.bNumericBase]
88ALIGN JUMP_ALIGN
89.GetUserInputIntilValidOrCancelled:
90 call Keyboard_ReadUserInputtedWordWhilePrinting
91 jz SHORT .UserCancellation
92
93 cmp ax, [si+WORD_DIALOG_IO.wMin]
94 jb SHORT .InputtedWordNotInRange
95 cmp ax, [si+WORD_DIALOG_IO.wMax]
96 ja SHORT .InputtedWordNotInRange
97
98 mov [si+WORD_DIALOG_IO.bUserCancellation], bh ; Zero = FALSE
99 mov [si+WORD_DIALOG_IO.wReturnWord], ax
100.UserCancellation:
101 ret
102
103.InputtedWordNotInRange:
104 call Keyboard_PlayBellForUnwantedKeystroke
105 call .ClearInputtedWordFromDialog
106 jmp SHORT .GetUserInputIntilValidOrCancelled
107
108;--------------------------------------------------------------------
109; .ClearInputtedWordFromDialog
110; Parameters
111; SS:BP: Ptr to DIALOG
112; Returns:
113; Nothing
114; Corrupts registers:
115; AX, CX, DX, DI
116;--------------------------------------------------------------------
117ALIGN JUMP_ALIGN
118.ClearInputtedWordFromDialog:
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 ret
Note: See TracBrowser for help on using the repository browser.