source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogMessage.asm @ 58

Last change on this file since 58 was 58, checked in by aitotat, 13 years ago

Changes to Assembly Library:

  • Exiting menu with ESC can now be canceled.
File size: 3.4 KB
Line 
1; File name     :   DialogMessage.asm
2; Project name  :   Assembly Library
3; Created date  :   6.8.2010
4; Last update   :   18.11.2010
5; Author        :   Tomi Tilli
6; Description   :   Displays message dialog.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; DialogMessage_DisplayMessageWithInputInDSSI
13;   Parameters:
14;       DS:SI:  Ptr to DIALOG_INPUT
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
22DialogMessage_DisplayMessageWithInputInDSSI:
23    mov     bx, MessageEventHandler
24    jmp     Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
25
26
27;--------------------------------------------------------------------
28; MessageEventHandler
29;   Common parameters for all events:
30;       BX:         Menu event (anything from MENUEVENT struct)
31;       SS:BP:      Ptr to DIALOG
32;   Common return values for all events:
33;       CF:         Set if event processed
34;                   Cleared if event not processed
35;   Corrupts registers:
36;       All
37;--------------------------------------------------------------------
38ALIGN JUMP_ALIGN
39MessageEventHandler:
40    jmp     [cs:bx+.rgfnEventHandlers]
41
42
43ALIGN JUMP_ALIGN
44.InitializeMenuinitFromDSSI:
45    or      BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT
46    xor     ax, ax      ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling
47    jmp     Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
48
49
50ALIGN JUMP_ALIGN
51.KeyStrokeInAX:
52    call    ProcessMessageScrollingKeysFromAX
53    stc
54    ret
55
56
57ALIGN WORD_ALIGN
58.rgfnEventHandlers:
59istruc MENUEVENT
60    at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  .InitializeMenuinitFromDSSI
61    at  MENUEVENT.ExitMenu,                     dw  Dialog_EventExitMenu
62    at  MENUEVENT.IdleProcessing,               dw  Dialog_EventNotHandled
63    at  MENUEVENT.ItemHighlightedFromCX,        dw  Dialog_EventNotHandled
64    at  MENUEVENT.ItemSelectedFromCX,           dw  Dialog_EventAnyThatClosesDialog
65    at  MENUEVENT.KeyStrokeInAX,                dw  .KeyStrokeInAX
66    at  MENUEVENT.RefreshTitle,                 dw  Dialog_EventRefreshTitle
67    at  MENUEVENT.RefreshInformation,           dw  Dialog_EventRefreshInformation
68    at  MENUEVENT.RefreshItemFromCX,            dw  Dialog_EventRefreshItemFromCX
69iend
70
71
72;--------------------------------------------------------------------
73; ProcessMessageScrollingKeysFromAX
74;   Parameters
75;       AL:     ASCII character
76;       AH:     BIOS scan code
77;       SS:BP:  Ptr to DIALOG
78;   Returns:
79;       Nothing
80;   Corrupts registers:
81;       BX, CX, DX, SI, DI
82;--------------------------------------------------------------------
83ALIGN JUMP_ALIGN
84ProcessMessageScrollingKeysFromAX:
85    cmp     ah, MENU_KEY_UP
86    je      SHORT .DecrementLines
87    cmp     ah, MENU_KEY_DOWN
88    je      SHORT .IncrementLines
89    jmp     MenuLoop_ProcessScrollingKeysFromAX
90
91ALIGN JUMP_ALIGN
92.DecrementLines:
93    cmp     WORD [bp+MENUINIT.wHighlightedItem], BYTE 0
94    je      SHORT .AlreadyAtTheTopOrBottom
95
96    mov     ax, [bp+MENU.wFirstVisibleItem]
97    mov     [bp+MENUINIT.wHighlightedItem], ax
98    mov     ah, MENU_KEY_UP
99    jmp     MenuLoop_ProcessScrollingKeysFromAX
100
101ALIGN JUMP_ALIGN
102.IncrementLines:
103    mov     ax, [bp+MENUINIT.wItems]
104    dec     ax                      ; Last possible item to highlight
105    cmp     [bp+MENUINIT.wHighlightedItem], ax
106    jae     SHORT .AlreadyAtTheTopOrBottom
107
108    call    MenuScrollbars_GetLastVisibleItemOnPageToAX
109    mov     [bp+MENUINIT.wHighlightedItem], ax
110    mov     ah, MENU_KEY_DOWN
111    jmp     MenuLoop_ProcessScrollingKeysFromAX
112
113ALIGN JUMP_ALIGN
114.AlreadyAtTheTopOrBottom:
115    ret
Note: See TracBrowser for help on using the repository browser.