[41] | 1 | ; File name : MenuEvent.asm
|
---|
| 2 | ; Project name : Assembly Library
|
---|
| 3 | ; Created date : 13.7.2010
|
---|
[52] | 4 | ; Last update : 12.10.2010
|
---|
[41] | 5 | ; Author : Tomi Tilli
|
---|
| 6 | ; Description : Functions for initializing menu system.
|
---|
| 7 |
|
---|
| 8 | ; Section containing code
|
---|
| 9 | SECTION .text
|
---|
| 10 |
|
---|
| 11 | ;--------------------------------------------------------------------
|
---|
| 12 | ; MenuEvent_InitializeMenuinit
|
---|
| 13 | ; Parameters
|
---|
| 14 | ; SS:BP: Ptr to MENU
|
---|
| 15 | ; Returns:
|
---|
| 16 | ; DS:SI: Ptr to MENU with MENUINIT initialized from user handler
|
---|
| 17 | ; CF: Set if event processed
|
---|
| 18 | ; Cleared if event not processed
|
---|
| 19 | ; Corrupts registers:
|
---|
| 20 | ; AX, BX, DX
|
---|
| 21 | ;--------------------------------------------------------------------
|
---|
| 22 | ALIGN JUMP_ALIGN
|
---|
| 23 | MenuEvent_InitializeMenuinit:
|
---|
| 24 | push ss
|
---|
| 25 | pop ds
|
---|
| 26 | mov si, bp
|
---|
| 27 | mov bx, MENUEVENT.InitializeMenuinitFromDSSI
|
---|
| 28 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | ;--------------------------------------------------------------------
|
---|
| 32 | ; MenuEvent_ExitMenu
|
---|
| 33 | ; Parameters
|
---|
| 34 | ; SS:BP: Ptr to MENU
|
---|
| 35 | ; Returns:
|
---|
| 36 | ; CF: Set if event processed
|
---|
| 37 | ; Cleared if event not processed
|
---|
| 38 | ; Corrupts registers:
|
---|
| 39 | ; AX, BX, DX
|
---|
| 40 | ;--------------------------------------------------------------------
|
---|
| 41 | ALIGN JUMP_ALIGN
|
---|
| 42 | MenuEvent_ExitMenu:
|
---|
| 43 | mov bx, MENUEVENT.ExitMenu
|
---|
| 44 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | ;--------------------------------------------------------------------
|
---|
| 48 | ; MenuEvent_IdleProcessing
|
---|
| 49 | ; Parameters
|
---|
| 50 | ; SS:BP: Ptr to MENU
|
---|
| 51 | ; Returns:
|
---|
| 52 | ; CF: Set if event processed
|
---|
| 53 | ; Cleared if event not processed
|
---|
| 54 | ; Corrupts registers:
|
---|
| 55 | ; AX, BX, DX
|
---|
| 56 | ;--------------------------------------------------------------------
|
---|
| 57 | ALIGN JUMP_ALIGN
|
---|
| 58 | MenuEvent_IdleProcessing:
|
---|
| 59 | mov bx, MENUEVENT.IdleProcessing
|
---|
| 60 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | ;--------------------------------------------------------------------
|
---|
| 64 | ; MenuEvent_RefreshTitle
|
---|
| 65 | ; MenuEvent_RefreshInformation
|
---|
| 66 | ; Parameters
|
---|
[48] | 67 | ; SS:BP: Ptr to MENU
|
---|
[41] | 68 | ; Cursor will be positioned to beginning of window
|
---|
| 69 | ; Returns:
|
---|
| 70 | ; CF: Set if event processed
|
---|
| 71 | ; Cleared if event not processed
|
---|
| 72 | ; Corrupts registers:
|
---|
[48] | 73 | ; AX, CX, BX, DX
|
---|
[41] | 74 | ;--------------------------------------------------------------------
|
---|
| 75 | ALIGN JUMP_ALIGN
|
---|
| 76 | MenuEvent_RefreshTitle:
|
---|
| 77 | mov bx, MENUEVENT.RefreshTitle
|
---|
[48] | 78 | jmp SHORT LoadHighlightedItemToCXandSendMessageFromBX
|
---|
| 79 |
|
---|
[41] | 80 | ALIGN JUMP_ALIGN
|
---|
| 81 | MenuEvent_RefreshInformation:
|
---|
| 82 | mov bx, MENUEVENT.RefreshInformation
|
---|
[48] | 83 | LoadHighlightedItemToCXandSendMessageFromBX:
|
---|
[52] | 84 | mov cx, [bp+MENUINIT.wHighlightedItem]
|
---|
[41] | 85 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | ;--------------------------------------------------------------------
|
---|
| 89 | ; MenuEvent_RefreshItemFromCX
|
---|
| 90 | ; Parameters
|
---|
| 91 | ; CX: Index of item to refresh
|
---|
[48] | 92 | ; SS:BP: Ptr to MENU
|
---|
[41] | 93 | ; Cursor has been positioned to the beginning of item line
|
---|
| 94 | ; Returns:
|
---|
| 95 | ; CF: Set if event processed
|
---|
| 96 | ; Cleared if event not processed
|
---|
| 97 | ; Corrupts registers:
|
---|
| 98 | ; AX, BX, DX
|
---|
| 99 | ;--------------------------------------------------------------------
|
---|
| 100 | ALIGN JUMP_ALIGN
|
---|
| 101 | MenuEvent_RefreshItemFromCX:
|
---|
| 102 | mov bx, MENUEVENT.RefreshItemFromCX
|
---|
| 103 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | ;--------------------------------------------------------------------
|
---|
| 107 | ; MenuEvent_HighlightItemFromCX
|
---|
| 108 | ; Parameters
|
---|
| 109 | ; CX: Index of item to highlight
|
---|
[48] | 110 | ; SS:BP: Ptr to MENU
|
---|
[41] | 111 | ; Returns:
|
---|
| 112 | ; Nothing
|
---|
| 113 | ; Corrupts registers:
|
---|
| 114 | ; AX, BX, DX, SI, DI
|
---|
| 115 | ;--------------------------------------------------------------------
|
---|
| 116 | ALIGN JUMP_ALIGN
|
---|
| 117 | MenuEvent_HighlightItemFromCX:
|
---|
| 118 | mov dx, cx
|
---|
[52] | 119 | xchg dx, [bp+MENUINIT.wHighlightedItem]
|
---|
[41] | 120 | push dx
|
---|
| 121 |
|
---|
| 122 | mov bx, MENUEVENT.ItemHighlightedFromCX
|
---|
| 123 | call MenuEvent_SendFromBX
|
---|
| 124 |
|
---|
| 125 | pop ax
|
---|
| 126 | call MenuText_RefreshItemFromAX
|
---|
[52] | 127 | mov ax, [bp+MENUINIT.wHighlightedItem]
|
---|
[41] | 128 | jmp MenuText_RefreshItemFromAX
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | ;--------------------------------------------------------------------
|
---|
| 132 | ; MenuEvent_KeyStrokeInAX
|
---|
| 133 | ; Parameters
|
---|
| 134 | ; AL: ASCII character for the key
|
---|
| 135 | ; AH: Keyboard library scan code for the key
|
---|
[48] | 136 | ; SS:BP: Ptr to MENU
|
---|
[41] | 137 | ; Returns:
|
---|
| 138 | ; CF: Set if event processed
|
---|
| 139 | ; Cleared if event not processed
|
---|
| 140 | ; Corrupts registers:
|
---|
| 141 | ; AX, BX, DX
|
---|
| 142 | ;--------------------------------------------------------------------
|
---|
| 143 | ALIGN JUMP_ALIGN
|
---|
| 144 | MenuEvent_KeyStrokeInAX:
|
---|
| 145 | mov bx, MENUEVENT.KeyStrokeInAX
|
---|
| 146 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 | ;--------------------------------------------------------------------
|
---|
| 150 | ; MenuEvent_ItemSelectedFromCX
|
---|
| 151 | ; Parameters
|
---|
| 152 | ; CX: Index of selected item
|
---|
[48] | 153 | ; SS:BP: Ptr to MENU
|
---|
[41] | 154 | ; Returns:
|
---|
| 155 | ; CF: Set if event processed
|
---|
| 156 | ; Cleared if event not processed
|
---|
| 157 | ; Corrupts registers:
|
---|
| 158 | ; AX, BX, DX
|
---|
| 159 | ;--------------------------------------------------------------------
|
---|
| 160 | ALIGN JUMP_ALIGN
|
---|
| 161 | MenuEvent_ItemSelectedFromCX:
|
---|
| 162 | mov bx, MENUEVENT.ItemSelectedFromCX
|
---|
| 163 | jmp SHORT MenuEvent_SendFromBX
|
---|
| 164 |
|
---|
| 165 |
|
---|
| 166 | ;--------------------------------------------------------------------
|
---|
| 167 | ; MenuEvent_SendFromBX
|
---|
| 168 | ; Parameters
|
---|
| 169 | ; BX: Menu event to send
|
---|
| 170 | ; SS:BP: Ptr to MENU
|
---|
| 171 | ; Other registers: Event specific parameters
|
---|
| 172 | ; Returns:
|
---|
| 173 | ; AX, DX: Event specific return values
|
---|
| 174 | ; CF: Set if event processed
|
---|
| 175 | ; Cleared if event not processed
|
---|
| 176 | ; Corrupts registers:
|
---|
| 177 | ; BX
|
---|
| 178 | ;--------------------------------------------------------------------
|
---|
| 179 | ALIGN JUMP_ALIGN
|
---|
| 180 | MenuEvent_SendFromBX:
|
---|
| 181 | push es
|
---|
| 182 | push ds
|
---|
| 183 | push di
|
---|
| 184 | push si
|
---|
| 185 | push cx
|
---|
| 186 | call [bp+MENU.fnEventHandler]
|
---|
| 187 | pop cx
|
---|
| 188 | pop si
|
---|
| 189 | pop di
|
---|
| 190 | pop ds
|
---|
| 191 | pop es
|
---|
| 192 | ret
|
---|