[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for initializing menu system.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX
|
---|
| 9 | ; Parameters
|
---|
| 10 | ; DX:AX: User specified data
|
---|
| 11 | ; BX: Menu event handler
|
---|
| 12 | ; Returns:
|
---|
| 13 | ; AX: Index of selected item or NO_ITEM_SELECTED
|
---|
| 14 | ; Corrupts registers:
|
---|
| 15 | ; All except segments
|
---|
| 16 | ;--------------------------------------------------------------------
|
---|
| 17 | ALIGN JUMP_ALIGN
|
---|
| 18 | MenuInit_DisplayMenuWithHandlerInBXandUserDataInDXAX:
|
---|
| 19 | push es
|
---|
| 20 | push ds
|
---|
[116] | 21 | LOAD_BDA_SEGMENT_TO ds, cx, !
|
---|
[41] | 22 | push WORD [BDA.wVidCurShape]
|
---|
[104] | 23 | mov cl, MENU_size
|
---|
| 24 | eENTER_STRUCT cx
|
---|
[41] | 25 |
|
---|
[46] | 26 | call Memory_ZeroSSBPwithSizeInCX
|
---|
[41] | 27 | call MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
|
---|
[129] | 28 | mov dx, [bp+MENUINIT.wHighlightedItem]
|
---|
[41] | 29 |
|
---|
| 30 | eLEAVE_STRUCT MENU_size
|
---|
| 31 | pop ax
|
---|
| 32 | CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
|
---|
[289] | 33 | CALL_DISPLAY_LIBRARY SynchronizeDisplayContextToHardware
|
---|
[129] | 34 | xchg ax, dx ; Return highlighted item in AX
|
---|
[41] | 35 | pop ds
|
---|
| 36 | pop es
|
---|
| 37 | ret
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | ;--------------------------------------------------------------------
|
---|
| 41 | ; MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX
|
---|
| 42 | ; Parameters
|
---|
| 43 | ; DX:AX: User specified data
|
---|
| 44 | ; BX: Menu event handler
|
---|
| 45 | ; SS:BP: Ptr to MENU
|
---|
| 46 | ; Returns:
|
---|
| 47 | ; Nothing
|
---|
| 48 | ; Corrupts registers:
|
---|
| 49 | ; All, except SS:BP
|
---|
| 50 | ;--------------------------------------------------------------------
|
---|
| 51 | ALIGN JUMP_ALIGN
|
---|
| 52 | MenuInit_EnterMenuWithHandlerInBXandUserDataInDXAX:
|
---|
| 53 | mov [bp+MENU.fnEventHandler], bx
|
---|
| 54 | mov [bp+MENU.dwUserData], ax
|
---|
| 55 | mov [bp+MENU.dwUserData+2], dx
|
---|
| 56 |
|
---|
| 57 | mov ax, CURSOR_HIDDEN
|
---|
| 58 | CALL_DISPLAY_LIBRARY SetCursorShapeFromAX
|
---|
[104] | 59 | call MenuEvent_InitializeMenuinit ; User initialization
|
---|
[133] | 60 | %ifndef USE_186
|
---|
[41] | 61 | call MenuInit_RefreshMenuWindow
|
---|
| 62 | jmp MenuLoop_Enter
|
---|
[133] | 63 | %else
|
---|
| 64 | push MenuLoop_Enter
|
---|
| 65 | ; Fall to MenuInit_RefreshMenuWindow
|
---|
| 66 | %endif
|
---|
[41] | 67 |
|
---|
| 68 |
|
---|
| 69 | ;--------------------------------------------------------------------
|
---|
| 70 | ; MenuInit_RefreshMenuWindow
|
---|
| 71 | ; Parameters
|
---|
| 72 | ; SS:BP: Ptr to MENU
|
---|
| 73 | ; Returns:
|
---|
| 74 | ; Nothing
|
---|
| 75 | ; Corrupts registers:
|
---|
| 76 | ; AX, BX, CX, DX, SI, DI
|
---|
| 77 | ;--------------------------------------------------------------------
|
---|
| 78 | ALIGN JUMP_ALIGN
|
---|
| 79 | MenuInit_RefreshMenuWindow:
|
---|
| 80 | call MenuBorders_RefreshAll ; Draw borders
|
---|
| 81 | call MenuText_RefreshTitle ; Draw title strings
|
---|
| 82 | call MenuText_RefreshAllItems ; Draw item strings
|
---|
[116] | 83 | jmp MenuText_RefreshInformation ; Draw information strings
|
---|
[41] | 84 |
|
---|
| 85 |
|
---|
| 86 | ;--------------------------------------------------------------------
|
---|
[205] | 87 | ; MenuInit_CloseMenuIfExitEventAllows
|
---|
| 88 | ; Parameters
|
---|
| 89 | ; SS:BP: Ptr to MENU
|
---|
| 90 | ; Returns:
|
---|
| 91 | ; Nothing
|
---|
| 92 | ; Corrupts registers:
|
---|
| 93 | ; AX, BX, DX
|
---|
| 94 | ;--------------------------------------------------------------------
|
---|
| 95 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
| 96 | ALIGN JUMP_ALIGN
|
---|
| 97 | MenuInit_CloseMenuIfExitEventAllows:
|
---|
| 98 | call MenuEvent_ExitMenu
|
---|
| 99 | jc SHORT MenuInit_CloseMenuWindow
|
---|
| 100 | ret
|
---|
| 101 | %endif
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | ;--------------------------------------------------------------------
|
---|
[41] | 105 | ; MenuInit_CloseMenuWindow
|
---|
| 106 | ; Parameters
|
---|
| 107 | ; SS:BP: Ptr to MENU
|
---|
| 108 | ; Returns:
|
---|
| 109 | ; Nothing
|
---|
| 110 | ; Corrupts registers:
|
---|
| 111 | ; Nothing
|
---|
| 112 | ;--------------------------------------------------------------------
|
---|
| 113 | ALIGN JUMP_ALIGN
|
---|
| 114 | MenuInit_CloseMenuWindow:
|
---|
| 115 | or BYTE [bp+MENU.bFlags], FLG_MENU_EXIT
|
---|
| 116 | ret
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | ;--------------------------------------------------------------------
|
---|
| 120 | ; MenuInit_HighlightItemFromAX
|
---|
| 121 | ; Parameters
|
---|
| 122 | ; AX: Item to highlight
|
---|
| 123 | ; SS:BP: Ptr to MENU
|
---|
| 124 | ; Returns:
|
---|
| 125 | ; Nothing
|
---|
| 126 | ; Corrupts registers:
|
---|
| 127 | ; AX, BX, CX, DX, SI, DI
|
---|
| 128 | ;--------------------------------------------------------------------
|
---|
| 129 | ALIGN JUMP_ALIGN
|
---|
| 130 | MenuInit_HighlightItemFromAX:
|
---|
[52] | 131 | sub ax, [bp+MENUINIT.wHighlightedItem]
|
---|
[41] | 132 | jmp MenuScrollbars_MoveHighlightedItemByAX
|
---|
| 133 |
|
---|
[48] | 134 | ;--------------------------------------------------------------------
|
---|
| 135 | ; MenuInit_GetHighlightedItemToAX
|
---|
| 136 | ; Parameters
|
---|
| 137 | ; SS:BP: Ptr to MENU
|
---|
| 138 | ; Returns:
|
---|
| 139 | ; AX: Index of highlighted item or NO_ITEM_HIGHLIGHTED
|
---|
| 140 | ; Corrupts registers:
|
---|
| 141 | ; Nothing
|
---|
| 142 | ;--------------------------------------------------------------------
|
---|
[133] | 143 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[48] | 144 | ALIGN JUMP_ALIGN
|
---|
| 145 | MenuInit_GetHighlightedItemToAX:
|
---|
[52] | 146 | mov ax, [bp+MENUINIT.wHighlightedItem]
|
---|
[48] | 147 | ret
|
---|
[133] | 148 | %endif
|
---|
[41] | 149 |
|
---|
[48] | 150 |
|
---|
[41] | 151 | ;--------------------------------------------------------------------
|
---|
| 152 | ; MenuInit_SetTitleHeightFromAL
|
---|
| 153 | ; MenuInit_SetInformationHeightFromAL
|
---|
| 154 | ; MenuInit_SetTotalItemsFromAX
|
---|
| 155 | ; Parameters
|
---|
| 156 | ; AX/AL: Parameter
|
---|
| 157 | ; SS:BP: Ptr to MENU
|
---|
| 158 | ; Returns:
|
---|
| 159 | ; Nothing
|
---|
| 160 | ; Corrupts registers:
|
---|
| 161 | ; Nothing
|
---|
| 162 | ;--------------------------------------------------------------------
|
---|
[133] | 163 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[41] | 164 | ALIGN JUMP_ALIGN
|
---|
| 165 | MenuInit_SetTitleHeightFromAL:
|
---|
| 166 | mov [bp+MENUINIT.bTitleLines], al
|
---|
| 167 | ret
|
---|
| 168 |
|
---|
| 169 | ALIGN JUMP_ALIGN
|
---|
| 170 | MenuInit_SetInformationHeightFromAL:
|
---|
| 171 | mov [bp+MENUINIT.bInfoLines], al
|
---|
| 172 | ret
|
---|
| 173 |
|
---|
| 174 | ALIGN JUMP_ALIGN
|
---|
| 175 | MenuInit_SetTotalItemsFromAX:
|
---|
| 176 | mov [bp+MENUINIT.wItems], ax
|
---|
| 177 | ret
|
---|
[133] | 178 | %endif
|
---|
[41] | 179 |
|
---|
| 180 |
|
---|
| 181 | ;--------------------------------------------------------------------
|
---|
| 182 | ; MenuInit_SetUserDataFromDSSI
|
---|
| 183 | ; MenuInit_GetUserDataToDSSI
|
---|
| 184 | ; Parameters
|
---|
| 185 | ; DS:SI: User data (MenuInit_SetUserDataFromDSSI)
|
---|
| 186 | ; SS:BP: Ptr to MENU
|
---|
| 187 | ; Returns:
|
---|
| 188 | ; DS:SI: User data (MenuInit_GetUserDataToDSSI)
|
---|
| 189 | ; Corrupts registers:
|
---|
| 190 | ; Nothing
|
---|
| 191 | ;--------------------------------------------------------------------
|
---|
[133] | 192 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[41] | 193 | ALIGN JUMP_ALIGN
|
---|
| 194 | MenuInit_SetUserDataFromDSSI:
|
---|
| 195 | mov [bp+MENU.dwUserData], si
|
---|
| 196 | mov [bp+MENU.dwUserData+2], ds
|
---|
| 197 | ret
|
---|
| 198 |
|
---|
| 199 | ALIGN JUMP_ALIGN
|
---|
| 200 | MenuInit_GetUserDataToDSSI:
|
---|
| 201 | lds si, [bp+MENU.dwUserData]
|
---|
| 202 | ret
|
---|
[133] | 203 | %endif
|
---|