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