1 | ; Project name : Assembly Library
|
---|
2 | ; Description : Functions for initializing menu system.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .text
|
---|
6 |
|
---|
7 | ;--------------------------------------------------------------------
|
---|
8 | ; MenuEvent_InitializeMenuinit
|
---|
9 | ; Parameters
|
---|
10 | ; SS:BP: Ptr to MENU
|
---|
11 | ; Returns:
|
---|
12 | ; DS:SI: Ptr to MENU with MENUINIT initialized from user handler
|
---|
13 | ; CF: Set if event processed
|
---|
14 | ; Cleared if event not processed
|
---|
15 | ; Corrupts registers:
|
---|
16 | ; AX, BX, DX
|
---|
17 | ;--------------------------------------------------------------------
|
---|
18 | ALIGN MENU_JUMP_ALIGN
|
---|
19 | MenuEvent_InitializeMenuinit:
|
---|
20 | push ss
|
---|
21 | pop ds
|
---|
22 | mov si, bp
|
---|
23 | mov bl, MENUEVENT_InitializeMenuinitFromDSSI
|
---|
24 | jmp SHORT MenuEvent_SendFromBX
|
---|
25 |
|
---|
26 |
|
---|
27 | ;--------------------------------------------------------------------
|
---|
28 | ; MenuEvent_ExitMenu
|
---|
29 | ; Parameters
|
---|
30 | ; SS:BP: Ptr to MENU
|
---|
31 | ; Returns:
|
---|
32 | ; CF: Set to exit from menu
|
---|
33 | ; Cleared to cancel exit
|
---|
34 | ; Corrupts registers:
|
---|
35 | ; AX, BX, DX
|
---|
36 | ;--------------------------------------------------------------------
|
---|
37 | ALIGN MENU_JUMP_ALIGN
|
---|
38 | MenuEvent_ExitMenu:
|
---|
39 | mov bl, MENUEVENT_ExitMenu
|
---|
40 | jmp SHORT MenuEvent_SendFromBX
|
---|
41 |
|
---|
42 |
|
---|
43 | %ifdef MENUEVENT_IDLEPROCESSING_ENABLE
|
---|
44 | ;--------------------------------------------------------------------
|
---|
45 | ; MenuEvent_IdleProcessing
|
---|
46 | ; Parameters
|
---|
47 | ; SS:BP: Ptr to MENU
|
---|
48 | ; Returns:
|
---|
49 | ; CF: Set if event processed
|
---|
50 | ; Cleared if event not processed
|
---|
51 | ; Corrupts registers:
|
---|
52 | ; AX, BX, DX
|
---|
53 | ;--------------------------------------------------------------------
|
---|
54 | ALIGN MENU_JUMP_ALIGN
|
---|
55 | MenuEvent_IdleProcessing:
|
---|
56 | mov bl, MENUEVENT_IdleProcessing
|
---|
57 | jmp SHORT MenuEvent_SendFromBX
|
---|
58 | %endif
|
---|
59 |
|
---|
60 | ;--------------------------------------------------------------------
|
---|
61 | ; MenuEvent_RefreshTitle
|
---|
62 | ; MenuEvent_RefreshInformation
|
---|
63 | ; Parameters
|
---|
64 | ; SS:BP: Ptr to MENU
|
---|
65 | ; Cursor will be positioned to beginning of window
|
---|
66 | ; Returns:
|
---|
67 | ; CF: Set if event processed
|
---|
68 | ; Cleared if event not processed
|
---|
69 | ; Corrupts registers:
|
---|
70 | ; AX, CX, BX, DX
|
---|
71 | ;--------------------------------------------------------------------
|
---|
72 | ALIGN MENU_JUMP_ALIGN
|
---|
73 | MenuEvent_RefreshTitle:
|
---|
74 | mov bl, MENUEVENT_RefreshTitle
|
---|
75 | SKIP2B cx ; mov cx, <next instruction>
|
---|
76 |
|
---|
77 | MenuEvent_RefreshInformation:
|
---|
78 | mov bl, MENUEVENT_RefreshInformation
|
---|
79 | mov cx, [bp+MENUINIT.wHighlightedItem]
|
---|
80 | jmp SHORT MenuEvent_SendFromBX
|
---|
81 |
|
---|
82 |
|
---|
83 | ;--------------------------------------------------------------------
|
---|
84 | ; MenuEvent_RefreshItemFromCX
|
---|
85 | ; Parameters
|
---|
86 | ; CX: Index of item to refresh
|
---|
87 | ; SS:BP: Ptr to MENU
|
---|
88 | ; Cursor has been positioned to the beginning of item line
|
---|
89 | ; Returns:
|
---|
90 | ; CF: Set if event processed
|
---|
91 | ; Cleared if event not processed
|
---|
92 | ; Corrupts registers:
|
---|
93 | ; AX, BX, DX
|
---|
94 | ;--------------------------------------------------------------------
|
---|
95 | ALIGN MENU_JUMP_ALIGN
|
---|
96 | MenuEvent_RefreshItemFromCX:
|
---|
97 | mov bl, MENUEVENT_RefreshItemFromCX
|
---|
98 | jmp SHORT MenuEvent_SendFromBX
|
---|
99 |
|
---|
100 |
|
---|
101 | ;--------------------------------------------------------------------
|
---|
102 | ; MenuEvent_HighlightItemFromCX
|
---|
103 | ; Parameters
|
---|
104 | ; CX: Index of item to highlight
|
---|
105 | ; SS:BP: Ptr to MENU
|
---|
106 | ; Returns:
|
---|
107 | ; Nothing
|
---|
108 | ; Corrupts registers:
|
---|
109 | ; AX, BX, DX, SI, DI
|
---|
110 | ;--------------------------------------------------------------------
|
---|
111 | ALIGN MENU_JUMP_ALIGN
|
---|
112 | MenuEvent_HighlightItemFromCX:
|
---|
113 | mov dx, cx
|
---|
114 | xchg dx, [bp+MENUINIT.wHighlightedItem]
|
---|
115 | push dx
|
---|
116 |
|
---|
117 | mov bl, MENUEVENT_ItemHighlightedFromCX
|
---|
118 | call MenuEvent_SendFromBX
|
---|
119 |
|
---|
120 | pop ax
|
---|
121 | call MenuText_RefreshItemFromAX
|
---|
122 | mov ax, [bp+MENUINIT.wHighlightedItem]
|
---|
123 | jmp MenuText_RefreshItemFromAX
|
---|
124 |
|
---|
125 |
|
---|
126 | ;--------------------------------------------------------------------
|
---|
127 | ; MenuEvent_KeyStrokeInAX
|
---|
128 | ; Parameters
|
---|
129 | ; AL: ASCII character for the key
|
---|
130 | ; AH: Keyboard library scan code for the key
|
---|
131 | ; SS:BP: Ptr to MENU
|
---|
132 | ; Returns:
|
---|
133 | ; CF: Set if event processed
|
---|
134 | ; Cleared if event not processed
|
---|
135 | ; Corrupts registers:
|
---|
136 | ; AX, BX, DX
|
---|
137 | ;--------------------------------------------------------------------
|
---|
138 | ALIGN MENU_JUMP_ALIGN
|
---|
139 | MenuEvent_KeyStrokeInAX:
|
---|
140 | mov bl, MENUEVENT_KeyStrokeInAX
|
---|
141 | SKIP2B dx ; mov dx, <next instruction>
|
---|
142 |
|
---|
143 |
|
---|
144 | ;--------------------------------------------------------------------
|
---|
145 | ; MenuEvent_ItemSelectedFromCX
|
---|
146 | ; Parameters
|
---|
147 | ; CX: Index of selected item
|
---|
148 | ; SS:BP: Ptr to MENU
|
---|
149 | ; Returns:
|
---|
150 | ; CF: Set if event processed
|
---|
151 | ; Cleared if event not processed
|
---|
152 | ; Corrupts registers:
|
---|
153 | ; AX, BX, DX
|
---|
154 | ;--------------------------------------------------------------------
|
---|
155 | MenuEvent_ItemSelectedFromCX:
|
---|
156 | mov bl, MENUEVENT_ItemSelectedFromCX
|
---|
157 | ; Fall to MenuEvent_SendFromBX
|
---|
158 |
|
---|
159 |
|
---|
160 | ;--------------------------------------------------------------------
|
---|
161 | ; MenuEvent_SendFromBX
|
---|
162 | ; Parameters
|
---|
163 | ; BL: Menu event to send
|
---|
164 | ; SS:BP: Ptr to MENU
|
---|
165 | ; Other registers: Event specific parameters
|
---|
166 | ; Returns:
|
---|
167 | ; AX, DX: Event specific return values
|
---|
168 | ; CF: Set if event processed
|
---|
169 | ; Cleared if event not processed
|
---|
170 | ; Corrupts registers:
|
---|
171 | ; BX
|
---|
172 | ;--------------------------------------------------------------------
|
---|
173 | ALIGN MENU_JUMP_ALIGN
|
---|
174 | MenuEvent_SendFromBX:
|
---|
175 | push es
|
---|
176 | push ds
|
---|
177 | push di
|
---|
178 | push si
|
---|
179 | push cx
|
---|
180 | xor bh, bh
|
---|
181 | call [bp+MENU.fnEventHandler]
|
---|
182 | pop cx
|
---|
183 | pop si
|
---|
184 | pop di
|
---|
185 | pop ds
|
---|
186 | pop es
|
---|
187 | ret
|
---|