- Timestamp:
- Nov 21, 2011, 11:01:08 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r196 r199 34 34 35 35 ; Bit defines for ROMVARS.wFlags 36 FLG_ROMVARS_FULLMODE EQU (1<<0) ; Full operating mode (steals base RAM, supports EBIOS etc.) 37 FLG_ROMVARS_DRVXLAT EQU (1<<2) ; Enable drive number translation 38 FLG_ROMVARS_MODULE_SERIAL EQU (1<<3) 39 FLG_ROMVARS_MODULE_EBIOS EQU (1<<4) 36 FLG_ROMVARS_FULLMODE EQU (1<<0) ; Full operating mode (steals base RAM, supports EBIOS etc.) 37 FLG_ROMVARS_DRVXLAT EQU (1<<2) ; Enable drive number translation 38 FLG_ROMVARS_SERIAL_SCANDETECT EQU (1<<3) ; Scan COM ports at the end of drive detection. Can also be invoked 39 ; by holding down the ALT key at the end of drive detection. 40 ; (Conveniently, this is 8, a fact we exploit when testing the bit) 41 FLG_ROMVARS_MODULE_SERIAL EQU (1<<6) ; Here in case the configuration needs to know functionality is present 42 FLG_ROMVARS_MODULE_EBIOS EQU (1<<7) ; Here in case the configuration needs to know functionality is present 40 43 41 44 ; Boot Menu Display Modes (see Assembly Library Display.inc for standard modes) … … 58 61 endstruc 59 62 63 ; Default values for Port and PortCtrl, shared with the configurator 64 ; 65 DEVICE_XTIDE_DEFAULT_PORT EQU 300h 66 DEVICE_XTIDE_DEFAULT_PORTCTRL EQU 308h 67 DEVICE_ATA_DEFAULT_PORT EQU 1F0h 68 DEVICE_ATA_DEFAULT_PORTCTRL EQU 3F0h 69 DEVICE_SERIAL_DEFAULT_COM EQU 0 ; COM1 70 DEVICE_SERIAL_DEFAULT_BAUD EQU 1 ; 9600 71 60 72 ; Device types for IDEVARS.bDevice 73 ; 61 74 DEVICE_8BIT_DUAL_PORT_XTIDE EQU (0<<1) 62 75 DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 EQU (1<<1) … … 65 78 DEVICE_32BIT_ATA EQU (4<<1) 66 79 DEVICE_SERIAL_PORT EQU (5<<1) 80 67 81 68 82 ; Master/Slave drive specific parameters … … 80 94 81 95 96 ; Defines for IDEVARS.bSerialPackedPortAndBaud (same format used by DPT.bSerialPortAndBaud) 97 ; 98 ; pppp ppbb 99 ; i/o port address = p * 2 + 240h 100 ; baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K 101 ; 102 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK EQU 0fch 103 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS EQU 03fh 104 DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT EQU 240h 105 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK EQU 3h 106 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS EQU 3h 107 108 ; Defines for IDEVARS.wSerialPrintBaud 109 ; 110 ; pppp ppnn nnnn nnnn 111 ; unsigned number to output = n 112 ; postfix character = p + '0' (designed for '0' and 'K', although other values are possible) 113 ; 114 ; Note that the contents of this word is only used for printing by the BIOS when a drive is detected. 115 ; It is not used for any other purpose, and so long as it conforms to the structure, any values can be used. 116 ; 117 DEVICE_SERIAL_PRINTBAUD_NUMBERMASK EQU 003ffh 118 DEVICE_SERIAL_PRINTBAUD_POSTCHARMASK EQU 0fc00h 119 DEVICE_SERIAL_PRINTBAUD_POSTCHARADD EQU '0' 120 ; 121 ; These are defined here (instead of in the configurator) for consistency since they could also be used 122 ; in main.asm as a default for an IDEVARS structure. 123 ; 124 DEVICE_SERIAL_PRINTBAUD_2400 EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 240) ; Prints "2400" 125 DEVICE_SERIAL_PRINTBAUD_9600 EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 960) ; Prints "9600" 126 DEVICE_SERIAL_PRINTBAUD_38_4 EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 38) ; Prints "38K" 127 DEVICE_SERIAL_PRINTBAUD_115_2 EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 115) ; Prints "115K" 128 129 ; 130 ; COM Number to I/O Port Address Mapping 131 ; 132 ; COM Number: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 133 ; Corresponds to I/O port: 3f8, 2f8, 3e8, 2e8, 2f0, 3e0, 2e0, 260, 368, 268, 360, 270 134 ; Corresponds to Packed I/O port (hex): 37, 17, 35, 15, 16, 34, 14, 4, 25, 5, 24, 6 135 ; 136 DEVICE_SERIAL_COM1 EQU 3f8h 137 DEVICE_SERIAL_COM2 EQU 2f8h 138 DEVICE_SERIAL_COM3 EQU 3e8h 139 DEVICE_SERIAL_COM4 EQU 2e8h 140 DEVICE_SERIAL_COM5 EQU 2f0h 141 DEVICE_SERIAL_COM6 EQU 3e0h 142 DEVICE_SERIAL_COM7 EQU 2e0h 143 DEVICE_SERIAL_COM8 EQU 260h 144 DEVICE_SERIAL_COM9 EQU 368h 145 DEVICE_SERIAL_COMA EQU 268h 146 DEVICE_SERIAL_COMB EQU 360h 147 DEVICE_SERIAL_COMC EQU 270h 148 149 82 150 %endif ; ROMVARS_INC -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r196 r199 119 119 mov cl, dl 120 120 121 and cl, SerialCommand_PackedPortAndBaud_BaudMask121 and cl, DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK 122 122 shl cl, 1 123 123 mov ch, SerialCommand_UART_divisorLow_startingBaud … … 125 125 adc ch, 0 126 126 127 and dl, SerialCommand_PackedPortAndBaud_PortMask127 and dl, DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK 128 128 mov dh, 0 129 129 shl dx, 1 ; port offset already x4, needs one more shift to be x8 130 add dx, SerialCommand_PackedPortAndBaud_StartingPort130 add dx, DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT 131 131 132 132 ; … … 501 501 SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH: 502 502 503 mov d l,[cs:bp+IDEVARS.bSerialPackedPortAndBaud]503 mov dx,[cs:bp+IDEVARS.bSerialCOMDigit] 504 504 test dl,dl 505 505 jz SerialCommand_AutoSerial 506 506 507 xchg dh,dl ; dh (the COM character to print) will be transmitted to the server, 508 ; so we know this is not an auto detect 509 507 510 ; fall-through 508 511 SerialCommand_IdentifyDeviceInDL_DriveInBH: … … 543 546 ; 544 547 545 SerialCommand_ScanPortAddresses: db 0b8h, 0f8h, 0bch, 0bah, 0fah, 0beh, 0feh, 0 546 ; Corresponds to I/O port: 3f8, 2f8, 3e8, 2e8, 2f0, 3e0, 2e0, 260, 368, 268, 360, 270 547 ; COM Assignments: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 548 ; Corresponds to Packed I/O port (hex): 37, 17, 35, 15, 16, 34, 14, 4, 25, 5, 24, 6 548 SerialCommand_ScanPortAddresses: db DEVICE_SERIAL_COM7 >> 2 549 db DEVICE_SERIAL_COM6 >> 2 550 db DEVICE_SERIAL_COM5 >> 2 551 db DEVICE_SERIAL_COM4 >> 2 552 db DEVICE_SERIAL_COM3 >> 2 553 db DEVICE_SERIAL_COM2 >> 2 554 db DEVICE_SERIAL_COM1 >> 2 555 db 0 549 556 550 557 ALIGN JUMP_ALIGN … … 581 588 ; Pack into dl, baud rate starts at 0 582 589 ; 583 add dx,-(SerialCommand_PackedPortAndBaud_StartingPort) 584 shr dx,1 590 add dx,-(DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) 591 shr dx,1 ; dh is zero at this point, and will be sent to the server, 592 ; so we know this is an auto detect 585 593 586 594 jmp .testFirstBaud -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm
r196 r199 31 31 add bp, BYTE IDEVARS_size ; Point to next IDEVARS 32 32 loop .DriveDetectLoop 33 34 33 %ifdef MODULE_SERIAL 35 test BYTE [es:BDA.bKBFlgs1], 8 ; alt key depressed 36 jz .done 34 mov al,[cs:ROMVARS.wFlags] 35 or al,[es:BDA.bKBFlgs1] 36 and al,8 ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT 37 jz .done 37 38 mov bp, ROMVARS.ideVarsSerialAuto 38 39 mov si, g_szDetectCOMAuto 39 ;;; fall-through 40 ;;; fall-through 40 41 %else 41 42 ret 43 %endif 44 45 %if FLG_ROMVARS_SERIAL_SCANDETECT != 8 46 %error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_ALWAYSDETECT is the same bit as the ALT key code in the BDA. Changes in the code will be needed if these values are no longer the same." 42 47 %endif 43 48 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r196 r199 53 53 %ifdef MODULE_SERIAL 54 54 ; 55 ; Baud rate is packed into one word: 56 ; High order 6 bits: number to add to '0' to get postfix character ('0' or 'K') 57 ; Low order 10 bits: binary number to display (960, 240, 38, or 115) 58 ; To get 9600: '0'<<10 + 960 59 ; To get 2400: '0'<<10 + 240 60 ; To get 38K: ('K'-'0')<<10 + 38 61 ; To get 115K: ('K'-'0')<<10 + 115 62 ; 55 ; Print baud rate from .wSerialPackedPrintBaud, in two parts - %u and then %c 56 ; 63 57 mov ax,cx ; Unpack baud rate number 64 and ax, 03ffh58 and ax,DEVICE_SERIAL_PRINTBAUD_NUMBERMASK 65 59 push ax 66 60 67 61 mov al,ch ; Unpack baud rate postfix ('0' or 'K') 68 eSHR_IM al,2 69 add al, '0'62 eSHR_IM al,2 ; also effectively masks off the postfix 63 add al,DEVICE_SERIAL_PRINTBAUD_POSTCHARADD 70 64 push ax 71 65 %endif -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r192 r199 82 82 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory 83 83 84 at ROMVARS.ideVars0+IDEVARS.wPort, dw 1F0h; Controller Command Block base port85 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 3F0h; Controller Control Block base port84 at ROMVARS.ideVars0+IDEVARS.wPort, dw DEVICE_ATA_DEFAULT_PORT ; Controller Command Block base port 85 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw DEVICE_ATA_DEFAULT_PORTCTRL ; Controller Control Block base port 86 86 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA 87 87 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 … … 96 96 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db FLG_DRVPARAMS_BLOCKMODE 97 97 98 at ROMVARS.ideVars2+IDEVARS.wPort, dw 300h; Controller Command Block base port99 at ROMVARS.ideVars2+IDEVARS.wPortCtrl, dw 308h; Controller Control Block base port98 at ROMVARS.ideVars2+IDEVARS.wPort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 99 at ROMVARS.ideVars2+IDEVARS.wPortCtrl, dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port 100 100 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_8BIT_DUAL_PORT_XTIDE 101 101 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0 … … 127 127 at ROMVARS.bStealSize, db 1 ; Steal 1kB from base memory in full mode 128 128 129 at ROMVARS.ideVars0+IDEVARS.wPort, dw 300h; Controller Command Block base port130 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw 308h; Controller Control Block base port129 at ROMVARS.ideVars0+IDEVARS.wPort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 130 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port 131 131 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_DUAL_PORT_XTIDE 132 132 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 ; IRQ -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Inc/MenuStructs.inc
r108 r199 50 50 .wMaxValue: 51 51 .wValueBitmask resb 2 ; Bitmask for item value flag 52 .fnValueReader resb 2 ; Called just after ROMVARS is read, providing a hook for further action 53 .fnValueWriter resb 2 ; Called just before ROMVARS is written, providing a hook for further action 52 54 endstruc 53 55 -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menuitem.asm
r181 r199 190 190 ALIGN JUMP_ALIGN 191 191 .TranslateChoiceToValueUsingLookupTable: 192 ; 193 ; if the lookup pointer is NULL, no translation is needed 194 ; 195 mov bx, [si+MENUITEM.itemValue+ITEM_VALUE.rgwChoiceToValueLookup] 196 test bx, bx 197 jz .StoreByteOrWordValueFromAXtoESDIwithItemInDSSI 198 192 199 shl ax, 1 ; Shift for WORD lookup 193 add ax, [si+MENUITEM.itemValue+ITEM_VALUE.rgwChoiceToValueLookup] 194 xchg bx, ax 200 add bx, ax 195 201 mov ax, [bx] ; Lookup complete 196 202 ; Fall to .StoreByteOrWordValueFromAXtoESDIwithItemInDSSI … … 210 216 ALIGN JUMP_ALIGN 211 217 .StoreByteOrWordValueFromAXtoESDIwithItemInDSSI: 218 push bx 219 mov bx,[si+MENUITEM.itemValue+ITEM_VALUE.fnValueWriter] 220 test bx,bx 221 jz SHORT .NoWriter 222 223 call bx 224 225 .NoWriter: 226 pop bx 212 227 test BYTE [si+MENUITEM.bFlags], FLG_MENUITEM_BYTEVALUE 213 228 jnz SHORT .StoreByteFromAL 214 229 215 230 mov [es:di+1], ah 216 231 ALIGN JUMP_ALIGN … … 269 284 push es 270 285 push di 286 push bx 271 287 call GetConfigurationBufferToESDIforMenuitemInDSSI 272 288 add di, [si+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] 273 289 mov ax, [es:di] 290 291 mov bx, [si+MENUITEM.itemValue+ITEM_VALUE.fnValueReader] 292 test bx,bx 293 jz SHORT .NoReader 294 295 call bx 296 297 .NoReader: 298 pop bx 274 299 pop di 275 300 pop es -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm
r144 r199 10 10 at MENUPAGE.fnEnter, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility 11 11 at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility 12 at MENUPAGE.wMenuitems, dw 612 at MENUPAGE.wMenuitems, dw 7 13 13 iend 14 14 … … 66 66 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootFloppyDrvs 67 67 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBootFloppyDrvs 68 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForFloppyDrives68 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL 69 69 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFloppyDrives 70 70 iend … … 101 101 iend 102 102 103 g_MenuitemBootMenuSerialScanDetect: 104 istruc MENUITEM 105 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 106 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI 107 at MENUITEM.szName, dw g_szItemSerialDetect 108 at MENUITEM.szQuickInfo, dw g_szNfoSerialDetect 109 at MENUITEM.szHelp, dw g_szHelpSerialDetect 110 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_FLAGVALUE 111 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 112 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags 113 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgSerialDetect 114 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag 115 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans 116 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_SERIAL_SCANDETECT 117 iend 118 103 119 g_rgwChoiceToValueLookupForDisplayModes: 104 120 dw DEFAULT_TEXT_MODE … … 118 134 dw g_szValueBootDispModeMono 119 135 120 g_rgwChoiceToValueLookupForFloppyDrives: ; (No translation)121 dw 0122 dw 1123 dw 2124 dw 3125 dw 4126 136 g_rgszValueToStringLookupForFloppyDrives: 127 137 dw g_szValueBootFloppyDrvsAuto -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm
r153 r199 10 10 at MENUPAGE.fnEnter, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility 11 11 at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility 12 at MENUPAGE.wMenuitems, dw 812 at MENUPAGE.wMenuitems, dw 11 13 13 iend 14 14 … … 50 50 at MENUITEM.szQuickInfo, dw g_szNfoIdeDevice 51 51 at MENUITEM.szHelp, dw g_szNfoIdeDevice 52 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE 52 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_MODIFY_MENU 53 53 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 54 54 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL … … 57 57 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForDevice 58 58 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForDevice 59 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_WriteDevice 59 60 iend 60 61 … … 89 90 iend 90 91 92 g_MenuitemIdeControllerSerialCOM: 93 istruc MENUITEM 94 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 95 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI 96 at MENUITEM.szName, dw g_szItemSerialCOM 97 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialCOM 98 at MENUITEM.szHelp, dw g_szHelpIdeSerialCOM 99 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU 100 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 101 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 102 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice 103 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szSerialCOMChoice 104 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL 105 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForCOM 106 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw IdeControllerMenu_SerialReadCOM 107 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWriteCOM 108 iend 109 110 g_MenuitemIdeControllerSerialPort: 111 istruc MENUITEM 112 at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI 113 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI 114 at MENUITEM.szName, dw g_szItemSerialPort 115 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialPort 116 at MENUITEM.szHelp, dw g_szHelpIdeSerialPort 117 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU 118 at MENUITEM.bType, db TYPE_MENUITEM_HEX 119 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 120 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeCmdPort 121 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 240h 122 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 438h 123 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw IdeControllerMenu_SerialReadPort 124 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWritePort 125 iend 126 127 g_MenuitemIdeControllerSerialBaud: 128 istruc MENUITEM 129 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 130 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI 131 at MENUITEM.szName, dw g_szItemSerialBaud 132 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialBaud 133 at MENUITEM.szHelp, dw g_szHelpIdeSerialBaud 134 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 135 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 136 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice 137 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szSerialBaudChoice 138 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL 139 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForBaud 140 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw IdeControllerMenu_SerialReadBaud 141 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWriteBaud 142 iend 143 91 144 g_MenuitemIdeControllerEnableInterrupt: 92 145 istruc MENUITEM … … 135 188 dw g_szValueCfgDeviceSerial 136 189 190 g_rgszValueToStringLookupForCOM: 191 dw g_szValueCfgCOM1 192 dw g_szValueCfgCOM2 193 dw g_szValueCfgCOM3 194 dw g_szValueCfgCOM4 195 dw g_szValueCfgCOM5 196 dw g_szValueCfgCOM6 197 dw g_szValueCfgCOM7 198 dw g_szValueCfgCOM8 199 dw g_szValueCfgCOM9 200 dw g_szValueCfgCOMA 201 dw g_szValueCfgCOMB 202 dw g_szValueCfgCOMC 203 dw g_szValueCfgCOMx 204 205 g_rgszValueToStringLookupForBaud: 206 dw g_szValueCfgBaud2400 207 dw g_szValueCfgBaud9600 208 dw g_szValueCfgBaud38_4 209 dw g_szValueCfgBaud115_2 210 211 g_wPrintBaud: 212 dw DEVICE_SERIAL_PRINTBAUD_2400 213 dw DEVICE_SERIAL_PRINTBAUD_9600 214 dw DEVICE_SERIAL_PRINTBAUD_38_4 215 dw DEVICE_SERIAL_PRINTBAUD_115_2 137 216 138 217 ; Section containing code … … 161 240 lea ax, [bx+IDEVARS.wPort] 162 241 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 163 242 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 243 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 244 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 245 ;; baud also modifies the next two bytes (print chars in wPortCtrl), but it never reads them 246 164 247 lea ax, [bx+IDEVARS.wPortCtrl] 165 248 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax … … 168 251 mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 169 252 mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 253 170 254 ret 171 255 … … 185 269 pop ds 186 270 call .EnableOrDisableIRQ 271 call .EnableOrDisableSerial 187 272 mov si, g_MenupageForIdeControllerMenu 188 273 jmp Menupage_ChangeToNewMenupageInDSSI … … 226 311 ret 227 312 228 313 .EnableOrDisableSerial: 314 mov bx, g_MenuitemIdeControllerCommandBlockAddress 315 call .DisableMenuitemFromCSBX 316 317 mov bx, g_MenuitemIdeControllerControlBlockAddress 318 call .DisableMenuitemFromCSBX 319 320 mov bx, g_MenuitemIdeControllerEnableInterrupt 321 call .DisableMenuitemFromCSBX 322 323 mov bx, g_MenuitemIdeControllerSerialBaud 324 call .DisableMenuitemFromCSBX 325 326 mov bx, g_MenuitemIdeControllerSerialCOM 327 call .DisableMenuitemFromCSBX 328 329 mov bx, g_MenuitemIdeControllerSerialPort 330 call .DisableMenuitemFromCSBX 331 332 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] 333 call Buffers_GetRomvarsValueToAXfromOffsetInBX 334 cmp al,DEVICE_SERIAL_PORT 335 jnz .DisableAllSerial 336 337 mov bx, g_MenuitemIdeControllerSerialCOM 338 call .EnableMenuitemFromCSBX 339 340 mov bx, g_MenuitemIdeControllerSerialBaud 341 call .EnableMenuitemFromCSBX 342 343 mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] 344 call Buffers_GetRomvarsValueToAXfromOffsetInBX 345 mov bx, g_MenuitemIdeControllerSerialPort 346 cmp al,'x' 347 jz .EnableMenuitemFromCSBX 348 jmp .DisableMenuitemFromCSBX 349 350 .DisableAllSerial: 351 352 mov bx, g_MenuitemIdeControllerCommandBlockAddress 353 call .EnableMenuitemFromCSBX 354 355 mov bx, g_MenuitemIdeControllerControlBlockAddress 356 call .EnableMenuitemFromCSBX 357 358 mov bx, g_MenuitemIdeControllerEnableInterrupt 359 call .EnableMenuitemFromCSBX 360 361 ret 362 229 363 ;-------------------------------------------------------------------- 230 364 ; MENUITEM activation functions (.fnActivate) … … 250 384 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX 251 385 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility 386 387 PackedCOMPortAddresses: ; COM1 - COMC (or COM12) 388 db (DEVICE_SERIAL_COM1 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 389 db (DEVICE_SERIAL_COM2 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 390 db (DEVICE_SERIAL_COM3 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 391 db (DEVICE_SERIAL_COM4 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 392 db (DEVICE_SERIAL_COM5 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 393 db (DEVICE_SERIAL_COM6 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 394 db (DEVICE_SERIAL_COM7 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 395 db (DEVICE_SERIAL_COM8 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 396 db (DEVICE_SERIAL_COM9 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 397 db (DEVICE_SERIAL_COMA - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 398 db (DEVICE_SERIAL_COMB - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 399 db (DEVICE_SERIAL_COMC - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1 400 db 0 ; null terminated 401 402 ;------------------------------------------------------------------------------------------ 403 ; 404 ; Reader/Writer Routines 405 ; 406 ; For serial drives, we pack the port number and baud rate into a single byte, and thus 407 ; we need to take care to properly read/write just the bits we need. In addition, since 408 ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly 409 ; default the values stored in both these words when switching in and out of the Serial 410 ; device choice. 411 ; 412 ; Writers: 413 ; Parameters: 414 ; AX: Value that the MENUITEM system was interacting with 415 ; ES:DI: ROMVARS location where the value is to be stored 416 ; DS:SI: MENUITEM pointer 417 ; Returns: 418 ; AX: Value to actually write to ROMVARS 419 ; Corrupts registers: 420 ; AX 421 ; 422 ; Readers: 423 ; Parameters: 424 ; AX: Value read from the ROMVARS location 425 ; ES:DI: ROMVARS location where the value was just read from 426 ; DS:SI: MENUITEM pointer 427 ; Returns: 428 ; AX: Value that the MENUITEM system will interact with and display 429 ; Corrupts registers: 430 ; AX 431 ; 432 433 ; 434 ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are 435 ; changing in/out of a Serial device (since we use these bytes in radically different ways). Also clear the 436 ; interrupt informtion is we are moving into Serial (since the serial device does not use interrupts). 437 ; 438 ALIGN JUMP_ALIGN 439 IdeControllerMenu_WriteDevice: 440 push ax 441 push bx 442 push di 443 444 mov bl,[es:di] ; what is the current Device? 445 446 add di,IDEVARS.wPort - IDEVARS.bDevice ; Get ready to set the Port addresses 447 448 cmp al,DEVICE_SERIAL_PORT 449 jz .changingToSerial 450 451 cmp bl,DEVICE_SERIAL_PORT 452 jnz .done ; if we weren't Serial before, nothing to do 453 454 .changingFromSerial: 455 cmp al,DEVICE_16BIT_ATA 456 jl .xtide 457 458 mov ax,DEVICE_ATA_DEFAULT_PORT ; Defaults for 16-bit and better ATA devices 459 mov bx,DEVICE_ATA_DEFAULT_PORTCTRL 460 jmp .writeNonSerial 461 462 .xtide: 463 mov ax,DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices 464 mov bx,DEVICE_XTIDE_DEFAULT_PORTCTRL 465 466 .writeNonSerial: 467 mov [es:di],ax ; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl 468 mov [es:di+2],bx 469 470 jmp .done 471 472 .changingToSerial: 473 cmp bl,DEVICE_SERIAL_PORT 474 jz .done ; if we were already serial, nothing to do 475 476 mov ax,DEVICE_SERIAL_DEFAULT_COM 477 call IdeControllerMenu_SerialWriteCOM 478 mov [es:di],ax 479 480 mov ax,DEVICE_SERIAL_DEFAULT_BAUD 481 call IdeControllerMenu_SerialWriteBaud 482 mov [es:di],ax 483 484 add di,IDEVARS.bIRQ - IDEVARS.wPort ; clear out the interrupt information, we don't use interrupts 485 mov al,0 486 mov [es:di],al 487 488 .done: 489 pop di 490 pop bx 491 pop ax 492 493 ret 494 495 ; 496 ; "COMn" ASCII characer -> Numeric COM number 497 ; 498 ALIGN JUMP_ALIGN 499 IdeControllerMenu_SerialReadCOM: 500 xor ah,ah ; clear out packedportbaud value 501 502 cmp al,'x' ; base this on the ASCII character used to print 503 jz .custom 504 505 cmp al,'A' 506 jae .over10 507 508 sub al, '0'+1 ; convert ASCII value '0'-'9' to numeric 509 ret 510 511 .over10: 512 sub al, 'A'-10+1 ; convert ASCII value 'A'-'C' to numeric 513 ret 514 515 .custom: 516 mov al, 12 ; convert ASCII value 'x' (for custom) to numeric 517 ret 518 519 ; 520 ; Numeric COM number -> Packed port address, and update ASCII character for printing "COMn" 521 ; 522 ALIGN JUMP_ALIGN 523 IdeControllerMenu_SerialWriteCOM: 524 push bx 525 526 cmp al,12 ; custom? 527 jge .custom 528 529 mov bx,ax ; lookup packed port address based on COM address 530 mov ah,[cs:bx+PackedCOMPortAddresses] 531 532 cmp al,9 ; COMA or higher, but not custom 533 jge .atorabove10 534 535 add al, '0'+1 ; convert numeric to ASCII '1' to '9' 536 jmp IdeControllerMenu_SerialWriteCOM_PackAndRet 537 538 .custom: 539 mov al,'x' ; ASCII value 'x' for custom 540 mov ah,0 ; 240h is default custom value 541 jmp IdeControllerMenu_SerialWriteCOM_PackAndRet 542 543 .atorabove10: 544 add al, 'A'-10+1 ; convert numeric to ASCII 'A' to 'C' 545 546 IdeControllerMenu_SerialWriteCOM_PackAndRet: 547 mov bl,[es:di+1] ; read baud rate bits 548 and bl,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK 549 or ah,bl 550 551 pop bx 552 ret 553 554 ; 555 ; Packed Baud -> Numeric Baud 556 ; 557 ALIGN JUMP_ALIGN 558 IdeControllerMenu_SerialReadBaud: 559 xchg al,ah 560 and ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK ; also clears high order byte 561 ret 562 563 ; 564 ; Numeric Baud -> Packed Baud, also update ASCII printing characters for baud rate 565 ; 566 ALIGN JUMP_ALIGN 567 IdeControllerMenu_SerialWriteBaud: 568 and ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS ; ensure we only have the bits we want 569 570 push bx 571 572 mov bx,ax ; lookup printing word for wPortCtrl 573 shl bx,1 574 mov bx,[cs:bx+g_wPrintBaud] 575 mov [es:di+2],bx 576 577 xchg al,ah ; or in port bits 578 mov bx,[es:di] 579 and bh,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK 580 or ax,bx 581 582 pop bx 583 ret 584 585 ; 586 ; Packed Port -> Numeric Port 587 ; 588 ALIGN JUMP_ALIGN 589 IdeControllerMenu_SerialReadPort: 590 mov al,ah 591 and ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK ; note that this clears AH 592 shl ax,1 593 add ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT 594 ret 595 596 ; 597 ; Numeric Port -> Packed Port, convert from Custom to a defined COM port if we match one 598 ; 599 ALIGN JUMP_ALIGN 600 IdeControllerMenu_SerialWritePort: 601 push bx 602 603 sub ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT ; convert from numeric to packed port number 604 shr ax,1 605 and al,DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK 606 607 mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list 608 .next: 609 mov ah,[cs:bx] 610 inc bx 611 test ah,ah 612 jz .notfound 613 cmp al,ah 614 jnz .next 615 616 sub bx,PackedCOMPortAddresses + 1 ; FOUND!, +1 since we already incremented 617 mov ax,bx 618 pop bx 619 jmp IdeControllerMenu_SerialWriteCOM ; if found, use that logic to get ASCII character 620 621 .notfound: 622 xchg ah,al 623 mov al,'x' 624 jmp IdeControllerMenu_SerialWriteCOM_PackAndRet 625 626 -
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm
r185 r199 67 67 g_szDlgFileFilter: db "*.*",NULL 68 68 69 69 70 g_szNfoMainExitToDOS: db "Quits XTIDE Universal BIOS Configurator.",NULL 70 71 g_szNfoMainLoadFile: db "Load BIOS file to be configured or flashed.",NULL … … 111 112 g_szItemIdeEnIRQ: db "Enable interrupt",NULL 112 113 g_szItemIdeIRQ: db "IRQ",NULL 114 g_szItemSerialCOM: db "COM Port",NULL 115 g_szItemSerialBaud: db "Baud Rate",NULL 116 g_szItemSerialPort: db "COM Port I/O address",NULL 117 118 g_szItemIdeSerialComPort: db "COM port",NULL 119 g_szItemIdeSerialBaudRate: db "Baud rate",NULL 113 120 114 121 g_szDlgDevice: db "Select controller type.",NULL … … 117 124 g_szDlgIdeEnIRQ: db "Enable interrupt?",NULL 118 125 g_szDlgIdeIRQ: db "Enter IRQ channel (2...7 for 8-bit controllers, 2...15 for any other controller).",NULL 119 126 120 127 g_szNfoIdeBackToCfgMenu:db "Back to XTIDE Universal BIOS Configuration Menu.",NULL 121 128 g_szNfoIdeMaster: db "Settings for Master Drive.",NULL … … 123 130 g_szNfoIdeDevice: db "Select controller device type.",NULL 124 131 g_szNfoIdeCmdPort: db "IDE Controller Command Block (base port) address.",NULL 125 g_szNfoIdeCtrlPort: db "IDE Controller Control Block address. Usually Cmd Block + 200h.",NULL132 g_szNfoIdeCtrlPort: db "IDE Controller Control Block address. Usually Cmd Block + 8 for XTIDE, and Cmd Block + 200h for ATA.",NULL 126 133 g_szNfoIdeEnIRQ: db "Interrupt or polling mode.",NULL 127 134 g_szNfoIdeIRQ: db "IRQ channel to use.",NULL 135 g_szNfoIdeSerialCOM: db "Select a COM port by number.",NULL 136 g_szNfoIdeSerialBaud: db "Select the COM port's Baud Rate. The server must match this speed. Note UART clock multipliers may impact the actual speed.",NULL 137 g_szNfoIdeSerialPort: db "Select a COM port by custom I/O port address. Address must be in the range 240h and 438h and be on an 8-byte boundary.", NULL 128 138 129 139 g_szHelpIdeCmdPort: incbin "IDE_CommandPort.txt" … … 135 145 g_szHelpIdeIRQ: incbin "IDE_IRQ.txt" 136 146 db NULL 147 g_szHelpIdeSerialCOM: incbin "IDE_SerialCOM.txt" 148 db NULL 149 g_szHelpIdeSerialPort: incbin "IDE_SerialPort.txt" 150 db NULL 151 g_szHelpIdeSerialBaud: incbin "IDE_SerialBaud.txt" 152 db NULL 137 153 138 154 g_szMultichoiceCfgDevice: … … 144 160 db "Serial port virtual device",NULL 145 161 162 g_szSerialCOMChoice: 163 db "COM1 - Port 3f8h",LF 164 db "COM2 - Port 2f8h",LF 165 db "COM3 - Port 3e8h",LF 166 db "COM4 - Port 2e8h",LF 167 db "COM5 - Port 2f0h",LF 168 db "COM6 - Port 3e0h",LF 169 db "COM7 - Port 2e0h",LF 170 db "COM8 - Port 260h",LF 171 db "COM9 - Port 368h",LF 172 db "COMA - Port 268h",LF 173 db "COMB - Port 360h",LF 174 db "COMC - Port 270h",LF 175 db "COMx - Custom Port",NULL 176 177 g_szValueCfgCOM1: db "COM1",NULL 178 g_szValueCfgCOM2: db "COM2",NULL 179 g_szValueCfgCOM3: db "COM3",NULL 180 g_szValueCfgCOM4: db "COM4",NULL 181 g_szValueCfgCOM5: db "COM5",NULL 182 g_szValueCfgCOM6: db "COM6",NULL 183 g_szValueCfgCOM7: db "COM7",NULL 184 g_szValueCfgCOM8: db "COM8",NULL 185 g_szValueCfgCOM9: db "COM9",NULL 186 g_szValueCfgCOMA: db "COMA",NULL 187 g_szValueCfgCOMB: db "COMB",NULL 188 g_szValueCfgCOMC: db "COMC",NULL 189 g_szValueCfgCOMx: db "Custom",NULL 190 191 g_szSerialBaudChoice: 192 db "2400 baud",LF 193 db "9600 baud",LF 194 db "38.4K baud",LF 195 db "115.2K baud",NULL 196 197 g_szValueCfgBaud2400: db "2400",NULL 198 g_szValueCfgBaud9600: db "9600",NULL 199 g_szValueCfgBaud38_4: db "38.4K",NULL 200 g_szValueCfgBaud115_2: db "115.2K",NULL 201 146 202 g_szValueCfgDeviceDual8b: db "XTIDE",NULL 147 203 g_szValueCfgDeviceMod: db "Chuck(G)",NULL … … 149 205 g_szValueCfgDevice16b: db "16-bit",NULL 150 206 g_szValueCfgDevice32b: db "32-bit",NULL 151 g_szValueCfgDeviceSerial: db " serial",NULL207 g_szValueCfgDeviceSerial: db "Serial",NULL 152 208 153 209 … … 184 240 g_szItemBootFloppyDrvs: db "Number of Floppy Drives",NULL 185 241 g_szItemBootSwap: db "Swap boot drive numbers",NULL 242 g_szItemSerialDetect: db "Scan for Serial Drives",NULL 186 243 187 244 g_szDlgBootTimeout: db "Enter Boot Menu selection timeout in BIOS timer ticks (1...1092, 0 disables timeout).",NULL … … 190 247 g_szDlgBootFloppyDrvs: db "Select number of Floppy Drives to display on boot menu.",NULL 191 248 g_szDlgBootSwap: db "Enable drive number translation?",NULL 192 249 g_szDlgSerialDetect: db "Scan for serial drives?",NULL 250 193 251 g_szNfoBootTimeout: db "Menu item selection timeout in BIOS timer ticks.",NULL 194 252 g_szNfoBootDrive: db "Default drive on boot menu.",NULL … … 196 254 g_szNfoBootFloppyDrvs: db "Number of Floppy Drives to display on boot menu.",NULL 197 255 g_szNfoBootSwap: db "Drive Number Translation (swap first drive with selected).",NULL 256 g_szNfoSerialDetect: db "Will scan COM ports for a serial drive. Can also be invoked by holding down ALT at the end of standard drive detection.",NULL 198 257 199 258 g_szHelpBootTimeout: incbin "Bootmenu_Timeout.txt" … … 205 264 g_szHelpBootSwap: incbin "Bootmenu_SwapDrives.txt" 206 265 db NULL 266 g_szHelpSerialDetect: incbin "Bootmenu_SerialDetect.txt" 267 db NULL 207 268 208 269 g_szMultichoiceBootDispMode:
Note:
See TracChangeset
for help on using the changeset viewer.