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