1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-28 12:10:55 +10:00

emul/8086/pcat: fix broken int13h logic

I had forgotten that heads index increment before track index.
This commit is contained in:
Virgil Dupras 2020-10-25 12:21:44 -04:00
parent ba21b6a9f5
commit 5a77b80d3d
2 changed files with 5 additions and 5 deletions

View File

@ -6,8 +6,8 @@
#define WCOLS 80 #define WCOLS 80
#define WLINES 25 #define WLINES 25
#define SEC_PER_TRK 0x3f #define SEC_PER_TRK 0x24
#define TRK_PER_HEAD 0xff #define HEADCNT 2
extern uint8_t byteregtable[8]; extern uint8_t byteregtable[8];
extern union _bytewordregs_ regs; extern union _bytewordregs_ regs;
@ -49,7 +49,7 @@ static void int13() {
// CL = sector number (1-based), AL = sector count // CL = sector number (1-based), AL = sector count
// DH = head number, CH = track number // DH = head number, CH = track number
// ES:BX = dest addr // ES:BX = dest addr
fseek(fp, ((((dh*TRK_PER_HEAD)+ch)*SEC_PER_TRK)+cl-1)*512, SEEK_SET); fseek(fp, (((ch*HEADCNT*SEC_PER_TRK)+(dh*SEC_PER_TRK))+cl-1)*512, SEEK_SET);
for (int i=0; i<(al*512); i++) { for (int i=0; i<(al*512); i++) {
if (cmd == 0x03) { // write if (cmd == 0x03) { // write
fputc(getmem8(segregs[reges], bx+i), fp); fputc(getmem8(segregs[reges], bx+i), fp);
@ -62,7 +62,7 @@ static void int13() {
case 0x08: // poll sectors per track / per head case 0x08: // poll sectors per track / per head
// we just report a lot of them // we just report a lot of them
regs.wordregs[regcx] = SEC_PER_TRK; regs.wordregs[regcx] = SEC_PER_TRK;
regs.byteregs[regdh] = TRK_PER_HEAD-1; regs.byteregs[regdh] = HEADCNT-1;
break; break;
} }
} }

View File

@ -2,7 +2,7 @@
( AH=read sectors, AL=1 sector, BX=dest, ( AH=read sectors, AL=1 sector, BX=dest,
CH=trackno CL=secno DH=head DL=drive ) CH=trackno CL=secno DH=head DL=drive )
FDSPT C@ /MOD ( AX BX sec trk ) FDSPT C@ /MOD ( AX BX sec trk )
FDHEADS C@ /MOD SWAP ( AX BX sec head trk ) FDHEADS C@ /MOD ( AX BX sec head trk )
8 LSHIFT ROT OR 1+ ( AX BX head CX ) 8 LSHIFT ROT OR 1+ ( AX BX head CX )
SWAP 8 LSHIFT 0x03 C@ ( boot drive ) OR ( AX BX CX DX ) SWAP 8 LSHIFT 0x03 C@ ( boot drive ) OR ( AX BX CX DX )
13H 2DROP 2DROP 13H 2DROP 2DROP