[293] | 1 | ; Project name : XTIDE Universal BIOS Configurator
|
---|
[2] | 2 | ; Description : Menu for configuring IDEVARS.
|
---|
| 3 |
|
---|
| 4 | ; Section containing initialized data
|
---|
| 5 | SECTION .data
|
---|
| 6 |
|
---|
| 7 | ; -Back to previous menu
|
---|
| 8 | ; +Master Drive
|
---|
| 9 | ; +Slave Drive
|
---|
| 10 | ; Command Block (base port) address (01F0h)
|
---|
| 11 | ; Control Block address (03F0h)
|
---|
| 12 | ; Bus type (16-bit)
|
---|
| 13 | ; Enable Interrupt (Y)
|
---|
| 14 | ; IRQ (14)
|
---|
| 15 |
|
---|
| 16 | ALIGN WORD_ALIGN
|
---|
| 17 | g_MenuPageIdeVars:
|
---|
| 18 | istruc MENUPAGE
|
---|
| 19 | at MENUPAGE.bItemCnt, db 8
|
---|
| 20 | iend
|
---|
| 21 | istruc MENUPAGEITEM ; Back to previous menu
|
---|
| 22 | at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateLeaveSubmenu
|
---|
| 23 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 24 | at MENUPAGEITEM.szName, dw g_szPreviousMenu
|
---|
| 25 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeBack
|
---|
| 26 | at MENUPAGEITEM.szHelp, dw g_szNfoIdeBack
|
---|
| 27 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 28 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_BACK
|
---|
| 29 | iend
|
---|
| 30 | g_MenuPageItemIdeMaster:
|
---|
| 31 | istruc MENUPAGEITEM ; Master Drive
|
---|
| 32 | at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateMasterOrSlaveMenu
|
---|
| 33 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 34 | at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageDrvParams
|
---|
| 35 | at MENUPAGEITEM.szName, dw g_szItemIdeMaster
|
---|
| 36 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeMaster
|
---|
| 37 | at MENUPAGEITEM.szHelp, dw g_szNfoIdeMaster
|
---|
| 38 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 39 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
|
---|
| 40 | iend
|
---|
| 41 | g_MenuPageItemIdeSlave:
|
---|
| 42 | istruc MENUPAGEITEM ; Slave Drive
|
---|
| 43 | at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateMasterOrSlaveMenu
|
---|
| 44 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 45 | at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageDrvParams
|
---|
| 46 | at MENUPAGEITEM.szName, dw g_szItemIdeSlave
|
---|
| 47 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeSlave
|
---|
| 48 | at MENUPAGEITEM.szHelp, dw g_szNfoIdeSlave
|
---|
| 49 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 50 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
|
---|
| 51 | iend
|
---|
| 52 | g_MenuPageItemIdeBusType:
|
---|
| 53 | istruc MENUPAGEITEM ; Bus type
|
---|
| 54 | at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateSubmenuForGettingLookupValue
|
---|
| 55 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_LookupString
|
---|
| 56 | at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageBusType
|
---|
| 57 | at MENUPAGEITEM.rgszLookup, dw g_rgszBusTypeValueToString
|
---|
| 58 | at MENUPAGEITEM.szName, dw g_szItemIdeBusType
|
---|
| 59 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeBusType
|
---|
| 60 | at MENUPAGEITEM.szHelp, dw g_szNfoIdeBusType
|
---|
| 61 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 62 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
|
---|
| 63 | iend
|
---|
| 64 | g_MenuPageItemIdeCmdPort:
|
---|
| 65 | istruc MENUPAGEITEM ; Command Block (base port) address
|
---|
| 66 | at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetHexWordFromUser
|
---|
| 67 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 68 | at MENUPAGEITEM.szName, dw g_szItemIdeCmdPort
|
---|
| 69 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeCmdPort
|
---|
| 70 | at MENUPAGEITEM.szHelp, dw g_szHelpIdeCmdPort
|
---|
| 71 | at MENUPAGEITEM.szDialog, dw g_szDlgIdeCmdPort
|
---|
| 72 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 73 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_HEX_WORD
|
---|
| 74 | iend
|
---|
| 75 | g_MenuPageItemIdeCtrlPort:
|
---|
| 76 | istruc MENUPAGEITEM ; Control Block address (03F0h)
|
---|
| 77 | at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetHexWordFromUser
|
---|
| 78 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 79 | at MENUPAGEITEM.szName, dw g_szItemIdeCtrlPort
|
---|
| 80 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeCtrlPort
|
---|
| 81 | at MENUPAGEITEM.szHelp, dw g_szHelpIdeCtrlPort
|
---|
| 82 | at MENUPAGEITEM.szDialog, dw g_szDlgIdeCtrlPort
|
---|
| 83 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 84 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_HEX_WORD
|
---|
| 85 | iend
|
---|
| 86 | g_MenuPageItemIdeEnIRQ:
|
---|
| 87 | istruc MENUPAGEITEM ; Enable interrupt
|
---|
| 88 | at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateEnableInterrupt
|
---|
| 89 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 90 | at MENUPAGEITEM.wValueMask, dw 000Fh
|
---|
| 91 | at MENUPAGEITEM.szName, dw g_szItemIdeEnIRQ
|
---|
| 92 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeEnIRQ
|
---|
| 93 | at MENUPAGEITEM.szHelp, dw g_szHelpIdeEnIRQ
|
---|
| 94 | at MENUPAGEITEM.szDialog, dw g_szDlgIdeEnIRQ
|
---|
| 95 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 96 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_FLAG
|
---|
| 97 | iend
|
---|
| 98 | g_MenuPageItemIdeIRQ:
|
---|
| 99 | istruc MENUPAGEITEM ; IRQ
|
---|
| 100 | at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetByteFromUser
|
---|
| 101 | at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
|
---|
| 102 | at MENUPAGEITEM.wValueMin, dw 2
|
---|
| 103 | at MENUPAGEITEM.wValueMax, dw 15
|
---|
| 104 | at MENUPAGEITEM.szName, dw g_szItemIdeIRQ
|
---|
| 105 | at MENUPAGEITEM.szInfo, dw g_szNfoIdeIRQ
|
---|
| 106 | at MENUPAGEITEM.szHelp, dw g_szHelpIdeIRQ
|
---|
| 107 | at MENUPAGEITEM.szDialog, dw g_szDlgIdeIRQ
|
---|
| 108 | at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
|
---|
| 109 | at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_UNSIGNED_BYTE
|
---|
| 110 | iend
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 | ; Section containing code
|
---|
| 114 | SECTION .text
|
---|
| 115 |
|
---|
| 116 | ;--------------------------------------------------------------------
|
---|
[293] | 117 | ; Stores IDEVARS specific pointers to IDE Controller Menu
|
---|
[2] | 118 | ; MENUPAGEITEM structs.
|
---|
| 119 | ;
|
---|
| 120 | ; IdeControllerMenu_SetIdevarsOffset
|
---|
| 121 | ; Parameters:
|
---|
| 122 | ; AX: Offset to IDEVARS
|
---|
| 123 | ; DS: CS
|
---|
| 124 | ; Returns:
|
---|
| 125 | ; Nothing
|
---|
| 126 | ; Corrupts registers:
|
---|
| 127 | ; BX, CX
|
---|
| 128 | ;--------------------------------------------------------------------
|
---|
| 129 | ALIGN JUMP_ALIGN
|
---|
| 130 | IdeControllerMenu_SetIdevarsOffset:
|
---|
[293] | 131 | eMOVZX cx, [g_MenuPageIdeVars+MENUPAGE.bItemCnt]
|
---|
[2] | 132 | dec cx
|
---|
| 133 | mov bx, g_MenuPageItemIdeMaster+MENUPAGEITEM.pValue
|
---|
| 134 | ALIGN JUMP_ALIGN
|
---|
| 135 | .StoreIdevarsLoop:
|
---|
| 136 | mov [bx], ax
|
---|
| 137 | add bx, MENUPAGEITEM_size
|
---|
| 138 | loop .StoreIdevarsLoop
|
---|
| 139 |
|
---|
| 140 | ; Add offsets to values
|
---|
| 141 | add WORD [g_MenuPageItemIdeMaster+MENUPAGEITEM.pValue], BYTE IDEVARS.drvParamsMaster
|
---|
| 142 | add WORD [g_MenuPageItemIdeSlave+MENUPAGEITEM.pValue], BYTE IDEVARS.drvParamsSlave
|
---|
| 143 | add WORD [g_MenuPageItemIdeBusType+MENUPAGEITEM.pValue], BYTE IDEVARS.bBusType
|
---|
| 144 | add WORD [g_MenuPageItemIdeCmdPort+MENUPAGEITEM.pValue], BYTE IDEVARS.wPort
|
---|
| 145 | add WORD [g_MenuPageItemIdeCtrlPort+MENUPAGEITEM.pValue], BYTE IDEVARS.wPortCtrl
|
---|
| 146 | add WORD [g_MenuPageItemIdeEnIRQ+MENUPAGEITEM.pValue], BYTE IDEVARS.bIRQ
|
---|
| 147 | add WORD [g_MenuPageItemIdeIRQ+MENUPAGEITEM.pValue], BYTE IDEVARS.bIRQ
|
---|
| 148 | ret
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | ;--------------------------------------------------------------------
|
---|
| 152 | ; IdeControllerMenu_ActivateMasterOrSlaveMenu
|
---|
| 153 | ; Parameters:
|
---|
| 154 | ; DS:SI Ptr to MENUPAGE
|
---|
| 155 | ; DS:DI Ptr to MENUPAGEITEM
|
---|
| 156 | ; SS:BP: Ptr to MENUVARS
|
---|
| 157 | ; Returns:
|
---|
| 158 | ; CF: Set if menuitem changed
|
---|
| 159 | ; Cleared if no changes
|
---|
| 160 | ; Corrupts registers:
|
---|
| 161 | ; AX, BX, CX, DX
|
---|
| 162 | ;--------------------------------------------------------------------
|
---|
| 163 | ALIGN JUMP_ALIGN
|
---|
| 164 | IdeControllerMenu_ActivateMasterOrSlaveMenu:
|
---|
| 165 | mov ax, [di+MENUPAGEITEM.pValue] ; AX=Offset to DRVPARAMS
|
---|
| 166 | call DrvParamsMenu_SetDrvParamsOffset
|
---|
| 167 | call DrvParamsMenu_SetMenuitemVisibility
|
---|
| 168 | jmp MainPageItem_ActivateSubmenu
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | ;--------------------------------------------------------------------
|
---|
| 172 | ; IdeControllerMenu_ActivateEnableInterrupt
|
---|
| 173 | ; Parameters:
|
---|
| 174 | ; DS:SI Ptr to MENUPAGE
|
---|
| 175 | ; DS:DI Ptr to MENUPAGEITEM
|
---|
| 176 | ; SS:BP: Ptr to MENUVARS
|
---|
| 177 | ; Returns:
|
---|
| 178 | ; CF: Set if menuitem changed
|
---|
| 179 | ; Cleared if no changes
|
---|
| 180 | ; Corrupts registers:
|
---|
| 181 | ; AX, BX, CX, DX
|
---|
| 182 | ;--------------------------------------------------------------------
|
---|
| 183 | ALIGN JUMP_ALIGN
|
---|
| 184 | IdeControllerMenu_ActivateEnableInterrupt:
|
---|
| 185 | call MenuPageItem_GetBoolFromUser
|
---|
| 186 | jc SHORT IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges
|
---|
| 187 | ret
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | ;--------------------------------------------------------------------
|
---|
| 191 | ; IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges
|
---|
| 192 | ; Parameters:
|
---|
| 193 | ; DS:SI: Ptr to MENUPAGE
|
---|
| 194 | ; SS:BP: Ptr to MENUVARS
|
---|
| 195 | ; Returns:
|
---|
| 196 | ; CF: Cleared since no need to draw changes
|
---|
| 197 | ; Corrupts registers:
|
---|
| 198 | ; AX, BX, CX, DX
|
---|
| 199 | ;--------------------------------------------------------------------
|
---|
| 200 | ALIGN JUMP_ALIGN
|
---|
| 201 | IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges:
|
---|
| 202 | call IdeControllerMenu_SetMenuitemVisibility
|
---|
| 203 | call MenuPage_InvalidateItemCount
|
---|
| 204 | clc ; No need to redraw Full Mode menuitem
|
---|
| 205 | ret
|
---|
| 206 |
|
---|
| 207 | ;--------------------------------------------------------------------
|
---|
| 208 | ; Enables or disables menuitems based on current configuration.
|
---|
| 209 | ;
|
---|
| 210 | ; IdeControllerMenu_SetMenuitemVisibility
|
---|
| 211 | ; Parameters:
|
---|
| 212 | ; DS: CS
|
---|
| 213 | ; Returns:
|
---|
| 214 | ; Nothing
|
---|
| 215 | ; Corrupts registers:
|
---|
| 216 | ; BX
|
---|
| 217 | ;--------------------------------------------------------------------
|
---|
| 218 | ALIGN JUMP_ALIGN
|
---|
| 219 | IdeControllerMenu_SetMenuitemVisibility:
|
---|
| 220 | jmp SHORT IdeControllerMenu_EnableOrDisableIrqSelect
|
---|
| 221 |
|
---|
| 222 | ALIGN JUMP_ALIGN
|
---|
| 223 | IdeControllerMenu_EnableOrDisableIrqSelect:
|
---|
| 224 | mov bx, [g_MenuPageItemIdeIRQ+MENUPAGEITEM.pValue]
|
---|
| 225 | cmp BYTE [bx], 0 ; Interrupts disabled?
|
---|
| 226 | je SHORT .DisableIrqMenuitem
|
---|
| 227 | or BYTE [g_MenuPageItemIdeIRQ+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
|
---|
| 228 | ret
|
---|
| 229 | ALIGN JUMP_ALIGN
|
---|
| 230 | .DisableIrqMenuitem:
|
---|
| 231 | and BYTE [g_MenuPageItemIdeIRQ+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
|
---|
| 232 | ret
|
---|