[41] | 1 | ; File name : DialogMessage.asm
|
---|
| 2 | ; Project name : Assembly Library
|
---|
| 3 | ; Created date : 6.8.2010
|
---|
[52] | 4 | ; Last update : 12.10.2010
|
---|
[41] | 5 | ; Author : Tomi Tilli
|
---|
| 6 | ; Description : Displays message dialog.
|
---|
| 7 |
|
---|
| 8 | ; Section containing code
|
---|
| 9 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
| 21 | ALIGN JUMP_ALIGN
|
---|
| 22 | DialogMessage_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 | ;--------------------------------------------------------------------
|
---|
| 38 | ALIGN JUMP_ALIGN
|
---|
| 39 | MessageEventHandler:
|
---|
| 40 | jmp [cs:bx+.rgfnEventHandlers]
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | ALIGN JUMP_ALIGN
|
---|
| 44 | .InitializeMenuinitFromDSSI:
|
---|
| 45 | or BYTE [bp+MENU.bFlags], FLG_MENU_USER_HANDLES_SCROLLING | FLG_MENU_NOHIGHLIGHT
|
---|
[52] | 46 | xor ax, ax ; Cannot be NO_ITEM_HIGHLIGHTED because of scrolling
|
---|
| 47 | jmp Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
|
---|
[41] | 48 |
|
---|
| 49 |
|
---|
| 50 | ALIGN JUMP_ALIGN
|
---|
| 51 | .KeyStrokeInAX:
|
---|
| 52 | call ProcessMessageScrollingKeysFromAX
|
---|
| 53 | stc
|
---|
| 54 | ret
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | ALIGN WORD_ALIGN
|
---|
| 58 | .rgfnEventHandlers:
|
---|
| 59 | istruc MENUEVENT
|
---|
| 60 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
|
---|
| 61 | at MENUEVENT.ExitMenu, dw Dialog_EventNotHandled
|
---|
| 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
|
---|
| 69 | iend
|
---|
| 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 | ;--------------------------------------------------------------------
|
---|
| 83 | ALIGN JUMP_ALIGN
|
---|
| 84 | ProcessMessageScrollingKeysFromAX:
|
---|
| 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 |
|
---|
| 91 | ALIGN JUMP_ALIGN
|
---|
| 92 | .DecrementLines:
|
---|
[52] | 93 | cmp WORD [bp+MENUINIT.wHighlightedItem], BYTE 0
|
---|
[41] | 94 | je SHORT .AlreadyAtTheTopOrBottom
|
---|
| 95 |
|
---|
| 96 | mov ax, [bp+MENU.wFirstVisibleItem]
|
---|
[52] | 97 | mov [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 98 | mov ah, MENU_KEY_UP
|
---|
| 99 | jmp MenuLoop_ProcessScrollingKeysFromAX
|
---|
| 100 |
|
---|
| 101 | ALIGN JUMP_ALIGN
|
---|
| 102 | .IncrementLines:
|
---|
| 103 | mov ax, [bp+MENUINIT.wItems]
|
---|
| 104 | dec ax ; Last possible item to highlight
|
---|
[52] | 105 | cmp [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 106 | jae SHORT .AlreadyAtTheTopOrBottom
|
---|
| 107 |
|
---|
| 108 | call MenuScrollbars_GetLastVisibleItemOnPageToAX
|
---|
[52] | 109 | mov [bp+MENUINIT.wHighlightedItem], ax
|
---|
[41] | 110 | mov ah, MENU_KEY_DOWN
|
---|
| 111 | jmp MenuLoop_ProcessScrollingKeysFromAX
|
---|
| 112 |
|
---|
| 113 | ALIGN JUMP_ALIGN
|
---|
| 114 | .AlreadyAtTheTopOrBottom:
|
---|
| 115 | ret
|
---|