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 JUMP_ALIGN |
---|
19 | MenuEvent_InitializeMenuinit: |
---|
20 | push ss |
---|
21 | pop ds |
---|
22 | mov si, bp |
---|
23 | mov bx, 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 JUMP_ALIGN |
---|
38 | MenuEvent_ExitMenu: |
---|
39 | mov bx, MENUEVENT.ExitMenu |
---|
40 | jmp SHORT MenuEvent_SendFromBX |
---|
41 | |
---|
42 | |
---|
43 | ;-------------------------------------------------------------------- |
---|
44 | ; MenuEvent_IdleProcessing |
---|
45 | ; Parameters |
---|
46 | ; SS:BP: Ptr to MENU |
---|
47 | ; Returns: |
---|
48 | ; CF: Set if event processed |
---|
49 | ; Cleared if event not processed |
---|
50 | ; Corrupts registers: |
---|
51 | ; AX, BX, DX |
---|
52 | ;-------------------------------------------------------------------- |
---|
53 | ALIGN JUMP_ALIGN |
---|
54 | MenuEvent_IdleProcessing: |
---|
55 | mov bx, MENUEVENT.IdleProcessing |
---|
56 | jmp SHORT MenuEvent_SendFromBX |
---|
57 | |
---|
58 | |
---|
59 | ;-------------------------------------------------------------------- |
---|
60 | ; MenuEvent_RefreshTitle |
---|
61 | ; MenuEvent_RefreshInformation |
---|
62 | ; Parameters |
---|
63 | ; SS:BP: Ptr to MENU |
---|
64 | ; Cursor will be positioned to beginning of window |
---|
65 | ; Returns: |
---|
66 | ; CF: Set if event processed |
---|
67 | ; Cleared if event not processed |
---|
68 | ; Corrupts registers: |
---|
69 | ; AX, CX, BX, DX |
---|
70 | ;-------------------------------------------------------------------- |
---|
71 | ALIGN JUMP_ALIGN |
---|
72 | MenuEvent_RefreshTitle: |
---|
73 | mov bx, MENUEVENT.RefreshTitle |
---|
74 | jmp SHORT LoadHighlightedItemToCXandSendMessageFromBX |
---|
75 | |
---|
76 | ALIGN JUMP_ALIGN |
---|
77 | MenuEvent_RefreshInformation: |
---|
78 | mov bx, MENUEVENT.RefreshInformation |
---|
79 | LoadHighlightedItemToCXandSendMessageFromBX: |
---|
80 | mov cx, [bp+MENUINIT.wHighlightedItem] |
---|
81 | jmp SHORT MenuEvent_SendFromBX |
---|
82 | |
---|
83 | |
---|
84 | ;-------------------------------------------------------------------- |
---|
85 | ; MenuEvent_RefreshItemFromCX |
---|
86 | ; Parameters |
---|
87 | ; CX: Index of item to refresh |
---|
88 | ; SS:BP: Ptr to MENU |
---|
89 | ; Cursor has been positioned to the beginning of item line |
---|
90 | ; Returns: |
---|
91 | ; CF: Set if event processed |
---|
92 | ; Cleared if event not processed |
---|
93 | ; Corrupts registers: |
---|
94 | ; AX, BX, DX |
---|
95 | ;-------------------------------------------------------------------- |
---|
96 | ALIGN JUMP_ALIGN |
---|
97 | MenuEvent_RefreshItemFromCX: |
---|
98 | mov bx, MENUEVENT.RefreshItemFromCX |
---|
99 | jmp SHORT MenuEvent_SendFromBX |
---|
100 | |
---|
101 | |
---|
102 | ;-------------------------------------------------------------------- |
---|
103 | ; MenuEvent_HighlightItemFromCX |
---|
104 | ; Parameters |
---|
105 | ; CX: Index of item to highlight |
---|
106 | ; SS:BP: Ptr to MENU |
---|
107 | ; Returns: |
---|
108 | ; Nothing |
---|
109 | ; Corrupts registers: |
---|
110 | ; AX, BX, DX, SI, DI |
---|
111 | ;-------------------------------------------------------------------- |
---|
112 | ALIGN JUMP_ALIGN |
---|
113 | MenuEvent_HighlightItemFromCX: |
---|
114 | mov dx, cx |
---|
115 | xchg dx, [bp+MENUINIT.wHighlightedItem] |
---|
116 | push dx |
---|
117 | |
---|
118 | mov bx, MENUEVENT.ItemHighlightedFromCX |
---|
119 | call MenuEvent_SendFromBX |
---|
120 | |
---|
121 | pop ax |
---|
122 | call MenuText_RefreshItemFromAX |
---|
123 | mov ax, [bp+MENUINIT.wHighlightedItem] |
---|
124 | jmp MenuText_RefreshItemFromAX |
---|
125 | |
---|
126 | |
---|
127 | ;-------------------------------------------------------------------- |
---|
128 | ; MenuEvent_KeyStrokeInAX |
---|
129 | ; Parameters |
---|
130 | ; AL: ASCII character for the key |
---|
131 | ; AH: Keyboard library scan code for the key |
---|
132 | ; SS:BP: Ptr to MENU |
---|
133 | ; Returns: |
---|
134 | ; CF: Set if event processed |
---|
135 | ; Cleared if event not processed |
---|
136 | ; Corrupts registers: |
---|
137 | ; AX, BX, DX |
---|
138 | ;-------------------------------------------------------------------- |
---|
139 | ALIGN JUMP_ALIGN |
---|
140 | MenuEvent_KeyStrokeInAX: |
---|
141 | mov bx, MENUEVENT.KeyStrokeInAX |
---|
142 | jmp SHORT MenuEvent_SendFromBX |
---|
143 | |
---|
144 | |
---|
145 | ;-------------------------------------------------------------------- |
---|
146 | ; MenuEvent_ItemSelectedFromCX |
---|
147 | ; Parameters |
---|
148 | ; CX: Index of selected item |
---|
149 | ; SS:BP: Ptr to MENU |
---|
150 | ; Returns: |
---|
151 | ; CF: Set if event processed |
---|
152 | ; Cleared if event not processed |
---|
153 | ; Corrupts registers: |
---|
154 | ; AX, BX, DX |
---|
155 | ;-------------------------------------------------------------------- |
---|
156 | ALIGN JUMP_ALIGN |
---|
157 | MenuEvent_ItemSelectedFromCX: |
---|
158 | mov bx, MENUEVENT.ItemSelectedFromCX |
---|
159 | jmp SHORT MenuEvent_SendFromBX |
---|
160 | |
---|
161 | |
---|
162 | ;-------------------------------------------------------------------- |
---|
163 | ; MenuEvent_SendFromBX |
---|
164 | ; Parameters |
---|
165 | ; BX: Menu event to send |
---|
166 | ; SS:BP: Ptr to MENU |
---|
167 | ; Other registers: Event specific parameters |
---|
168 | ; Returns: |
---|
169 | ; AX, DX: Event specific return values |
---|
170 | ; CF: Set if event processed |
---|
171 | ; Cleared if event not processed |
---|
172 | ; Corrupts registers: |
---|
173 | ; BX |
---|
174 | ;-------------------------------------------------------------------- |
---|
175 | ALIGN JUMP_ALIGN |
---|
176 | MenuEvent_SendFromBX: |
---|
177 | push es |
---|
178 | push ds |
---|
179 | push di |
---|
180 | push si |
---|
181 | push cx |
---|
182 | call [bp+MENU.fnEventHandler] |
---|
183 | pop cx |
---|
184 | pop si |
---|
185 | pop di |
---|
186 | pop ds |
---|
187 | pop es |
---|
188 | ret |
---|