Changeset 233 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages
- Timestamp:
- Feb 4, 2012, 6:21:22 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm
r200 r233 46 46 istruc MENUITEM 47 47 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 48 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfrom ShiftedItemInDSSI48 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI 49 49 at MENUITEM.szName, dw g_szItemIdeDevice 50 50 at MENUITEM.szQuickInfo, dw g_szNfoIdeDevice … … 93 93 istruc MENUITEM 94 94 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 95 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfrom UnshiftedItemInDSSI95 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI 96 96 at MENUITEM.szName, dw g_szItemSerialCOM 97 97 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialCOM 98 98 at MENUITEM.szHelp, dw g_szHelpIdeSerialCOM 99 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU 99 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS 100 100 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 101 101 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 102 102 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice 103 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 104 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgbChoiceToValueLookupForCOM 105 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForCOM 107 106 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWriteCOM 108 107 iend … … 115 114 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialPort 116 115 at MENUITEM.szHelp, dw g_szHelpIdeSerialPort 117 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU 116 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE 118 117 at MENUITEM.bType, db TYPE_MENUITEM_HEX 119 118 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 120 119 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeCmdPort 121 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT122 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT120 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 8h 121 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 3f8h 123 122 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw IdeControllerMenu_SerialReadPort 124 123 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWritePort … … 128 127 istruc MENUITEM 129 128 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI 130 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfrom UnshiftedItemInDSSI129 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI 131 130 at MENUITEM.szName, dw g_szItemSerialBaud 132 131 at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialBaud 133 132 at MENUITEM.szHelp, dw g_szHelpIdeSerialBaud 133 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS 134 134 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE 135 135 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL 136 136 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice 137 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 138 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgbChoiceToValueLookupForBaud 139 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForBaud 142 140 iend 143 141 … … 188 186 dw g_szValueCfgDeviceSerial 189 187 190 g_rgszValueToStringLookupForCOM: 188 g_rgbChoiceToValueLookupForCOM: 189 dw '1' 190 dw '2' 191 dw '3' 192 dw '4' 193 dw '5' 194 dw '6' 195 dw '7' 196 dw '8' 197 dw '9' 198 dw 'A' 199 dw 'B' 200 dw 'C' 201 dw 'x' ; must be last entry (see reader/write routines) 202 g_rgszChoiceToStringLookupForCOM: 191 203 dw g_szValueCfgCOM1 192 204 dw g_szValueCfgCOM2 … … 202 214 dw g_szValueCfgCOMC 203 215 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 216 dw NULL 217 218 DEVICE_SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values 219 220 PackedCOMPortAddresses: ; COM1 - COMC (or COM12) 221 db DEVICE_SERIAL_COM1 >> 2 222 db DEVICE_SERIAL_COM2 >> 2 223 db DEVICE_SERIAL_COM3 >> 2 224 db DEVICE_SERIAL_COM4 >> 2 225 db DEVICE_SERIAL_COM5 >> 2 226 db DEVICE_SERIAL_COM6 >> 2 227 db DEVICE_SERIAL_COM7 >> 2 228 db DEVICE_SERIAL_COM8 >> 2 229 db DEVICE_SERIAL_COM9 >> 2 230 db DEVICE_SERIAL_COMA >> 2 231 db DEVICE_SERIAL_COMB >> 2 232 db DEVICE_SERIAL_COMC >> 2 233 db DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines) 234 DEVICE_SERIAL_DEFAULT_COM EQU '1' 235 236 g_rgbChoiceToValueLookupForBaud: 237 dw (115200 / 115200) & 0xff 238 dw (115200 / 57600) & 0xff 239 dw (115200 / 38400) & 0xff 240 dw (115200 / 28800) & 0xff 241 dw (115200 / 19200) & 0xff 242 dw (115200 / 9600) & 0xff 243 dw (115200 / 4800) & 0xff 244 dw (115200 / 2400) & 0xff 245 g_rgszChoiceToStringLookupForBaud: 246 dw g_szValueCfgBaud115_2 247 dw g_szValueCfgBaud57_6 248 dw g_szValueCfgBaud38_4 249 dw g_szValueCfgBaud28_8 250 dw g_szValueCfgBaud19_2 251 dw g_szValueCfgBaud9600 252 dw g_szValueCfgBaud4800 253 dw g_szValueCfgBaud2400 254 dw NULL 255 DEVICE_SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff) 216 256 217 257 ; Section containing code … … 240 280 lea ax, [bx+IDEVARS.wPort] 241 281 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 282 283 lea ax, [bx+IDEVARS.bSerialPort] 242 284 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 243 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 285 286 lea ax, [bx+IDEVARS.bSerialBaud] 244 287 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 them246 288 247 289 lea ax, [bx+IDEVARS.wPortCtrl] 248 290 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 291 292 lea ax, [bx+IDEVARS.bSerialCOMPortChar] 293 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax 249 294 250 295 lea ax, [bx+IDEVARS.bIRQ] … … 382 427 ALIGN JUMP_ALIGN 383 428 DisplayMasterSlaveMenu: 429 ; 430 ; block mode is not supported on serial drives, disable/enable the option as appropriate 431 ; 432 push bx 433 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] 434 call Buffers_GetRomvarsValueToAXfromOffsetInBX 435 mov bx, g_MenuitemMasterSlaveBlockModeTransfers 436 cmp al,DEVICE_SERIAL_PORT 437 jz .isSerial 438 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE 439 jmp .isDone 440 .isSerial: 441 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE 442 .isDone: 443 pop bx 444 384 445 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX 385 446 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility 386 387 PackedCOMPortAddresses: ; COM1 - COMC (or COM12)388 db (DEVICE_SERIAL_COM1 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1389 db (DEVICE_SERIAL_COM2 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1390 db (DEVICE_SERIAL_COM3 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1391 db (DEVICE_SERIAL_COM4 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1392 db (DEVICE_SERIAL_COM5 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1393 db (DEVICE_SERIAL_COM6 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1394 db (DEVICE_SERIAL_COM7 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1395 db (DEVICE_SERIAL_COM8 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1396 db (DEVICE_SERIAL_COM9 - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1397 db (DEVICE_SERIAL_COMA - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1398 db (DEVICE_SERIAL_COMB - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1399 db (DEVICE_SERIAL_COMC - DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) >> 1400 db 0 ; null terminated401 447 402 448 ;------------------------------------------------------------------------------------------ … … 474 520 jz .done ; if we were already serial, nothing to do 475 521 476 mov ax,DEVICE_SERIAL_DEFAULT_COM 522 mov byte [es:di+IDEVARS.bSerialBaud-IDEVARS.wPort],DEVICE_SERIAL_DEFAULT_BAUD 523 524 mov al,DEVICE_SERIAL_DEFAULT_COM 525 add di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort 477 526 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 527 mov [es:di],al 483 528 484 add di,IDEVARS.bIRQ - IDEVARS.wPort ; clear out the interrupt information, we don't use interrupts485 mov al,0486 mov [es:di],al487 488 529 .done: 489 530 pop di … … 494 535 495 536 ; 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 537 ; Doesn't modify COM character (unless it is not recognized, which would be an error case), 538 ; But does update the port address based on COM port selection 539 ; 540 ALIGN JUMP_ALIGN 541 IdeControllerMenu_SerialWriteCOM: 542 push ax 543 push bx 544 push si 545 546 mov si,g_rgbChoiceToValueLookupForCOM 547 mov bx,PackedCOMPortAddresses 548 549 .loop: 550 mov ah,[bx] 551 552 cmp ah,(DEVICE_SERIAL_DEFAULT_CUSTOM_PORT >> 2) 553 jz .notFound 554 555 cmp al,[si] 556 jz .found 557 558 inc si 559 inc si 560 inc bx 561 562 jmp .loop 563 564 .notFound: 565 mov al, 'x' 566 567 .found: 568 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah 569 570 pop si 571 pop bx 572 pop ax 573 509 574 ret 510 511 .over10: 512 sub al, 'A'-10+1 ; convert ASCII value 'A'-'C' to numeric 575 576 577 ; 578 ; Packed Port (byte) -> Numeric Port (word) 579 ; 580 ALIGN JUMP_ALIGN 581 IdeControllerMenu_SerialReadPort: 582 xor ah,ah 583 shl ax,1 584 shl ax,1 513 585 ret 514 586 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,1 << DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION ; 248h 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 587 ; 588 ; Numeric Port (word) -> Packed Port (byte) 589 ; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers 598 590 ; 599 591 ALIGN JUMP_ALIGN 600 592 IdeControllerMenu_SerialWritePort: 601 593 push bx 602 603 sub ax,DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT ; convert from numeric to packed port number 594 push si 595 604 596 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] 597 shr ax,1 598 and al,0feh ; force 8-byte boundary 599 600 mov si,g_rgbChoiceToValueLookupForCOM 601 mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list 602 603 .loop: 604 mov ah,[si] 605 cmp ah,'x' 606 jz .found 607 608 cmp al,[bx] 609 jz .found 610 611 inc si 612 inc si 610 613 inc bx 611 test ah,ah612 j z .notfound613 cmp al,ah 614 jnz .next 615 616 sub bx,PackedCOMPortAddresses + 1 ; FOUND!, +1 since we already incremented 617 mov ax,bx614 615 jmp .loop 616 617 .found: 618 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah 619 620 pop si 618 621 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 622 623 ret 624 625 626 627 628 629 630
Note:
See TracChangeset
for help on using the changeset viewer.