emul/8086/pcat: fix broken int13h logic
I had forgotten that heads index increment before track index.
This commit is contained in:
parent
ba21b6a9f5
commit
5a77b80d3d
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user