Changeset 111 for trunk/bootcode/regular/driveio.asm
- Timestamp:
- Apr 8, 2017, 12:27:09 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/regular/driveio.asm
r110 r111 58 58 ; Those are originally loaded on startup and will NOT get reloaded. 59 59 DriveIO_LoadConfiguration Proc Near Uses ax bx cx dx es 60 61 IFDEF AUX_DEBUG 62 IF 0 63 pushf 64 pusha 65 push si 66 mov si, offset $+5 67 jmp @F 68 db 10,'DriveIO_LoadConfiguration:',10,0 69 @@: 70 call AuxIO_Print 71 pop si 72 ;~ call DEBUG_DumpRegisters 73 ;~ call AuxIO_DumpParagraph 74 ;~ call AuxIO_TeletypeNL 75 popa 76 popf 77 ENDIF 78 ENDIF 79 60 80 mov ax, cs 61 81 mov es, ax … … 73 93 74 94 DriveIO_SaveConfiguration Proc Near Uses ax bx cx dx ds es si 95 96 IFDEF AUX_DEBUG 97 IF 0 98 pushf 99 pusha 100 push si 101 mov si, offset $+5 102 jmp @F 103 db 10,'DriveIO_SaveConfiguration:',10,0 104 @@: 105 call AuxIO_Print 106 pop si 107 ;~ call DEBUG_DumpRegisters 108 ;~ call AuxIO_DumpParagraph 109 ;~ call AuxIO_TeletypeNL 110 popa 111 popf 112 ENDIF 113 ENDIF 114 75 115 mov ax, cs 76 116 mov ds, ax … … 238 278 ; Ugly, need to cleanup. 239 279 DriveIO_LVMAdjustToInfoSector Proc Near 280 281 IFDEF AUX_DEBUG 282 IF 0 283 pusha 284 push si 285 mov si, offset $+5 286 jmp @F 287 db 10,'DriveIO_LVMAdjustToInfoSector:',10,0 288 @@: 289 call AuxIO_Print 290 pop si 291 call DEBUG_DumpRegisters 292 ;~ call AuxIO_DumpParagraph 293 ;~ call AuxIO_TeletypeNL 294 popa 295 ENDIF 296 ENDIF 297 240 298 push cx ; Save Cyl/Sec part 241 299 xor ch,ch ; Clear low Cyl part … … 258 316 or cl,63 ; Adjust CHS part !FIX ME for > 63! !! FIX HUGE DRIVE !! 259 317 318 IFDEF AUX_DEBUG 319 IF 0 320 pusha 321 push si 322 mov si, offset $+5 323 jmp @F 324 db 10,'adjusted',10,0 325 @@: 326 call AuxIO_Print 327 pop si 328 call DEBUG_DumpRegisters 329 ;~ call AuxIO_DumpParagraph 330 ;~ call AuxIO_TeletypeNL 331 popa 332 ENDIF 333 ENDIF 260 334 261 335 ret … … 326 400 ; ######################################################################### 327 401 DriveIO_SavePartition Proc Near Uses ax bx cx dx si 402 403 IFDEF AUX_DEBUG 404 IF 0 405 pushf 406 pusha 407 push si 408 mov si, offset $+5 409 jmp @F 410 db 10,'DriveIO_SavePartition:',10,0 411 @@: 412 call AuxIO_Print 413 pop si 414 ;~ call DEBUG_DumpRegisters 415 ;~ call AuxIO_DumpParagraph 416 ;~ call AuxIO_TeletypeNL 417 popa 418 popf 419 ENDIF 420 ENDIF 421 328 422 mov ax, wptr cs:[CurPartition_Location+0] 329 423 mov bx, wptr cs:[CurPartition_Location+2] … … 356 450 ; Keeps DS:SI for caller, sets carry if valid LVM sector encountered 357 451 DriveIO_LoadLVMSector Proc Near Uses ax bx cx dx 452 453 IFDEF AUX_DEBUG 454 IF 0 455 pushf 456 pusha 457 push si 458 mov si, offset $+5 459 jmp @F 460 db 10,'DriveIO_LoadLVMSector:',10,0 461 @@: 462 call AuxIO_Print 463 pop si 464 ;~ call DEBUG_DumpRegisters 465 ;~ call AuxIO_DumpParagraph 466 ;~ call AuxIO_TeletypeNL 467 popa 468 popf 469 ENDIF 470 ENDIF 471 358 472 test byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so 359 473 jnz DIOLLVMS_NoLVMSector ; don't load but declare as bad! … … 402 516 ; Keeps DS:SI for caller, saves at anytime w/o checks (!) 403 517 DriveIO_SaveLVMSector Proc Near Uses ax bx cx dx 518 519 IFDEF AUX_DEBUG 520 IF 0 521 pushf 522 pusha 523 push si 524 mov si, offset $+5 525 jmp @F 526 db 10,'DriveIO_SaveLVMSector:',10,0 527 @@: 528 call AuxIO_Print 529 pop si 530 ;~ call DEBUG_DumpRegisters 531 ;~ call AuxIO_DumpParagraph 532 ;~ call AuxIO_TeletypeNL 533 popa 534 popf 535 ENDIF 536 ENDIF 537 404 538 test byte ptr [CFG_IgnoreLVM], 1 ; We are supposed to ignore LVM, so 405 539 jnz DIOSLVMS_SevereError ; don't save at anytime (security!) … … 476 610 DriveIO_LoadSector Proc Near Uses ax bx cx dx ds si es di 477 611 612 IFDEF AUX_DEBUG 613 IF 0 614 pushf 615 pusha 616 push si 617 mov si, offset $+5 618 jmp @F 619 db 10,'DriveIO_LoadSector:',10,0 620 @@: 621 call AuxIO_Print 622 pop si 623 ;~ call DEBUG_DumpRegisters 624 ;~ call AuxIO_DumpParagraph 625 ;~ call AuxIO_TeletypeNL 626 popa 627 popf 628 ENDIF 629 ENDIF 630 478 631 ; Is the drive not a harddrive? 479 632 cmp dl, 80h … … 494 647 cmp bptr cs:[LBASwitchTable+di], bl 495 648 jbe DIOLS_UseExtension 649 496 650 DIOLS_UseNormal: 497 mov di, 3 651 652 IFDEF AUX_DEBUG 653 IF 0 654 pusha 655 push si 656 mov si, offset $+5 657 jmp @F 658 db 10,'DriveIO_ReadSectorCHS:',10,0 659 @@: 660 call AuxIO_Print 661 pop si 662 call DEBUG_DumpRegisters 663 call AuxIO_DumpParagraph 664 call AuxIO_TeletypeNL 665 popa 666 ENDIF 667 ENDIF 668 669 mov di, 3 ; retry count 498 670 DIOLS_ErrorLoop: 499 671 push ds … … 503 675 int 13h 504 676 jnc DIOLS_Success 505 dec di 677 dec di ; decrement retry count 506 678 jnz DIOLS_ErrorLoop 507 679 … … 552 724 DriveIO_ReadSectorLBA Proc Near Uses bx cx dx si di ds es 553 725 726 IFDEF AUX_DEBUG 727 IF 0 728 pushf 729 pusha 730 push si 731 mov si, offset $+5 732 jmp @F 733 db 10,'DriveIO_ReadSectorLBA:',10,0 734 @@: 735 call AuxIO_Print 736 pop si 737 call DEBUG_DumpRegisters 738 call AuxIO_DumpParagraph 739 call AuxIO_TeletypeNL 740 popa 741 popf 742 ENDIF 743 ENDIF 744 554 745 ; One sector to read 555 746 mov cs:[INT13X_DAP_NumBlocks], 1 … … 602 793 ;############################################################################## 603 794 DriveIO_WriteSectorLBA Proc Near Uses bx cx dx si di ds es 795 796 IFDEF AUX_DEBUG 797 IF 0 798 pusha 799 push si 800 mov si, offset $+5 801 jmp @F 802 db 10,'DriveIO_WriteSectorLBA:',10,0 803 @@: 804 call AuxIO_Print 805 pop si 806 call DEBUG_DumpRegisters 807 call AuxIO_DumpParagraph 808 call AuxIO_TeletypeNL 809 popa 810 ENDIF 811 ENDIF 604 812 605 813 ; Mask reserved bits for wrte flags -- should check version here … … 794 1002 DriveIO_SaveSector Proc Near Uses ax bx cx dx ds si es di 795 1003 1004 IFDEF AUX_DEBUG 1005 IF 0 1006 pushf 1007 pusha 1008 push si 1009 mov si, offset $+5 1010 jmp @F 1011 db 10,'DriveIO_SaveSector:',10,0 1012 @@: 1013 call AuxIO_Print 1014 pop si 1015 ;~ call DEBUG_DumpRegisters 1016 ;~ call AuxIO_DumpParagraph 1017 ;~ call AuxIO_TeletypeNL 1018 popa 1019 popf 1020 ENDIF 1021 ENDIF 796 1022 797 1023 ;! … … 808 1034 inc cx 809 1035 xor dh,dh 810 ENDIF811 ENDIF812 813 814 ;!815 ;! DEBUG_BLOCK816 ;! Check what is being written to disk.817 ;! Uncomment below to activate.818 ;!819 __DIO_SS_DMP__ EQU820 IFDEF AUX_DEBUG821 IFDEF __DIO_SS_DMP__822 pusha823 push si824 mov si,offset [dioss]825 call AuxIO_Print826 pop si827 call DEBUG_DumpRegisters828 call AuxIO_DumpSector829 call AuxIO_TeletypeNL830 popa831 1036 ENDIF 832 1037 ENDIF … … 904 1109 905 1110 DIOSS_UseNormal: 906 mov di, 3 1111 1112 IFDEF AUX_DEBUG 1113 IF 0 1114 pusha 1115 push si 1116 mov si, offset $+5 1117 jmp @F 1118 db 10,'DriveIO_WriteSectorCHS:',10,0 1119 @@: 1120 call AuxIO_Print 1121 pop si 1122 call DEBUG_DumpRegisters 1123 call AuxIO_DumpParagraph 1124 call AuxIO_TeletypeNL 1125 popa 1126 ENDIF 1127 ENDIF 1128 1129 mov di, 3 ; retry count 907 1130 DIOSS_ErrorLoop: 908 1131 push ds … … 912 1135 int 13h 913 1136 jnc DIOSS_Success 914 dec di 1137 dec di ; decrement retry count 915 1138 jnz DIOSS_ErrorLoop 916 1139 call MBR_SaveError … … 967 1190 ; Loads sector at [LVMSector] ! 968 1191 DriveIO_LoadMasterLVMSector Proc Near 969 pusha 970 971 ;~ mov si,offset db_lmlvm 972 ;~ call AuxIO_Print 973 974 ;~ ; Physical disk 975 ;~ mov al,'<' 976 ;~ call VideoIO_PrintSingleChar 977 ;~ mov al,dl 978 ;~ call VideoIO_PrintHexByte 979 ;~ mov al,'>' 980 ;~ call VideoIO_PrintSingleChar 981 ;~ 982 ;~ call AuxIO_TeletypeHexByte 983 ;~ call AuxIO_TeletypeNL 984 1192 1193 IFDEF AUX_DEBUG 1194 IF 0 1195 pushf 1196 pusha 1197 push si 1198 mov si, offset $+5 1199 jmp @F 1200 db 10,'DriveIO_LoadMasterLVMSector:',10,0 1201 @@: 1202 call AuxIO_Print 1203 pop si 1204 ;~ call DEBUG_DumpRegisters 1205 ;~ call AuxIO_DumpParagraph 1206 ;~ call AuxIO_TeletypeNL 1207 popa 1208 popf 1209 ENDIF 1210 ENDIF 1211 1212 pusha 985 1213 986 1214 ; Loop over the sector-translation table, … … 1000 1228 ; Get the sector-number of the next possible LVM sector (255,127,63) 1001 1229 ; using the translation table and the counter as the index 1002 mov bx,offset secs_per_track_table1003 mov ax,cx 1004 dec ax 1005 xlatb 1006 dec al 1230 mov bx,offset [secs_per_track_table] 1231 mov ax,cx ; 1-based index to sec_per_track_table 1232 dec ax ; Adjust to 0-based 1233 xlatb ; Get the (well known) SPT 1234 dec al ; Minus 1 for LVM-record 1007 1235 1008 1236 ; … … 1012 1240 ; 1013 1241 1014 ;~ push ax 1015 ;~ push ax 1016 ;~ mov al,'$' 1017 ;~ call VideoIO_PrintSingleChar 1018 ;~ pop ax 1019 ;~ call VideoIO_PrintHexByte 1020 ;~ mov al,'$' 1021 ;~ call VideoIO_PrintSingleChar 1022 ;~ pop ax 1023 1024 IFDEF AUX_DEBUG 1025 ; Dump the value 1026 ;~ call AuxIO_TeletypeHexByte 1027 ;~ call AuxIO_TeletypeNL 1028 ENDIF 1242 1243 IFDEF AUX_DEBUG 1244 IF 0 1245 pushf 1246 pusha 1247 push si 1248 mov si, offset $+5 1249 jmp @F 1250 db 10,'geo',10,0 1251 @@: 1252 call AuxIO_Print 1253 pop si 1254 call DEBUG_DumpRegisters 1255 call AuxIO_DumpParagraph 1256 call AuxIO_TeletypeNL 1257 popa 1258 popf 1259 ENDIF 1260 ENDIF 1261 1029 1262 1030 1263 ; Setup the requested LBA sector number … … 1036 1269 1037 1270 IFDEF AUX_DEBUG 1038 pushf 1039 pusha 1040 pushf 1041 xor ax, ax 1042 mov al, dl 1043 call AuxIO_TeletypeHexWord 1044 mov al, '#' 1045 call AuxIO_Teletype 1046 popf 1047 mov ax,0000h 1048 rcl al, 1 1049 call AuxIO_TeletypeHexWord 1050 mov al, '#' 1051 call AuxIO_Teletype 1052 mov ax,word ptr [INT13X_DAP_Absolute+0] 1053 call AuxIO_TeletypeHexWord 1054 mov al, '#' 1055 call AuxIO_Teletype 1056 popa 1057 popf 1271 IF 0 1272 pushf 1273 pusha 1274 pushf 1275 xor ax, ax 1276 mov al, dl 1277 call AuxIO_TeletypeHexWord 1278 mov al, '#' 1279 call AuxIO_Teletype 1280 popf 1281 mov ax,0000h 1282 rcl al, 1 1283 call AuxIO_TeletypeHexWord 1284 mov al, '#' 1285 call AuxIO_Teletype 1286 mov ax,word ptr [INT13X_DAP_Absolute+0] 1287 call AuxIO_TeletypeHexWord 1288 mov al, '#' 1289 call AuxIO_Teletype 1290 popa 1291 popf 1292 ENDIF 1058 1293 ENDIF 1059 1294 … … 1068 1303 call LVM_ValidateSector 1069 1304 1070 ; pushf 1071 ; mov ah,0 1072 ; rcl ah,1 1073 ; mov al,'|' 1074 ; call VideoIO_PrintSingleChar 1075 ; mov al,ah 1076 ; call VideoIO_PrintHexByte 1077 ; mov al,'|' 1078 ; call VideoIO_PrintSingleChar 1079 ; popf 1305 IFDEF AUX_DEBUG 1306 IF 0 1307 pushf 1308 pusha 1309 push si 1310 mov si, offset $+5 1311 jmp @F 1312 db 10,'lvm record',10,0 1313 @@: 1314 call AuxIO_Print 1315 pop si 1316 call DEBUG_DumpRegisters 1317 call AuxIO_DumpParagraph 1318 call AuxIO_TeletypeNL 1319 popa 1320 popf 1321 ENDIF 1322 ENDIF 1080 1323 1081 1324 … … 1195 1438 ; DL contains BIOS disk-number; 80h for first, 81h for second, etc. 1196 1439 DriveIO_GatherDiskInfo Proc Near 1440 1441 IFDEF AUX_DEBUG 1442 IF 0 1443 pushf 1444 pusha 1445 push si 1446 mov si, offset $+5 1447 jmp @F 1448 db 10,'DriveIO_GatherDiskInfo:',10,0 1449 @@: 1450 call AuxIO_Print 1451 pop si 1452 ;~ call DEBUG_DumpRegisters 1453 ;~ call AuxIO_DumpParagraph 1454 ;~ call AuxIO_TeletypeNL 1455 popa 1456 popf 1457 ENDIF 1458 ENDIF 1459 1197 1460 pushf 1198 1461 push bx … … 1360 1623 secs_per_track_table db 63,127,255,255,255,255 1361 1624 1362 ;db_lmlvm:db 'Load Master LVM -- disk: ',01625 db_lmlvm db 'Load Master LVM -- disk: ',0
Note:
See TracChangeset
for help on using the changeset viewer.