source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuEvent.asm @ 369

Last change on this file since 369 was 369, checked in by gregli@…, 12 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 5.0 KB
Line 
1; Project name  :   Assembly Library
2; Description   :   Functions for initializing menu system.
3
4; Section containing code
5SECTION .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;--------------------------------------------------------------------
18ALIGN MENU_JUMP_ALIGN
19MenuEvent_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;--------------------------------------------------------------------
37ALIGN MENU_JUMP_ALIGN
38MenuEvent_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;--------------------------------------------------------------------
54ALIGN MENU_JUMP_ALIGN
55MenuEvent_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;--------------------------------------------------------------------
72ALIGN MENU_JUMP_ALIGN
73MenuEvent_RefreshTitle:
74    mov     bl, MENUEVENT_RefreshTitle
75    SKIP2B  cx  ; mov cx, <next instruction>
76
77MenuEvent_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;--------------------------------------------------------------------
95ALIGN MENU_JUMP_ALIGN
96MenuEvent_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;--------------------------------------------------------------------
111ALIGN MENU_JUMP_ALIGN
112MenuEvent_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;--------------------------------------------------------------------
138ALIGN MENU_JUMP_ALIGN
139MenuEvent_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;--------------------------------------------------------------------
155MenuEvent_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;--------------------------------------------------------------------
173ALIGN MENU_JUMP_ALIGN
174MenuEvent_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
Note: See TracBrowser for help on using the repository browser.