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

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

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

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