Skip to content

Commit c317664

Browse files
committed
CP/M-IDE - Pro IDE optimisation
1 parent b9a7a4f commit c317664

File tree

9 files changed

+4884
-4875
lines changed

9 files changed

+4884
-4875
lines changed

ROMs/CPM-IDE/acia/cpm22bios.asm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ putc_buffer_tx:
11881188

11891189
ld de,__IO_PIO_IDE_COMMAND<<8|__IDE_CMD_READ
11901190
call ide_write_byte_preset ;ask the drive to read it
1191+
11911192
call ide_wait_ready ;make sure drive is ready to proceed
11921193
call ide_wait_drq ;wait until it's got the data
11931194

@@ -1219,18 +1220,17 @@ putc_buffer_tx:
12191220

12201221
ld de,__IO_PIO_IDE_COMMAND<<8|__IDE_CMD_WRITE
12211222
call ide_write_byte_preset ;instruct drive to write a sector
1223+
12221224
call ide_wait_ready ;make sure drive is ready to proceed
12231225
call ide_wait_drq ;wait until it wants the data
12241226

12251227
call ide_write_block ;send the data to the drive from (HL++)
1226-
call ide_wait_ready
12271228

1229+
; call ide_wait_ready
12281230
; ld de, __IO_PIO_IDE_COMMAND<<8|__IDE_CMD_CACHE_FLUSH
12291231
; call ide_write_byte ;tell drive to flush its hardware cache
1230-
; call ide_wait_ready ;wait until the write is complete
12311232

1232-
scf ;carry = 1 on return = operation ok
1233-
ret
1233+
jp ide_wait_ready ;wait until the write is complete
12341234

12351235
PUBLIC _cpm_bios_tail
12361236
_cpm_bios_tail: ;tail of the cpm bios

ROMs/CPM-IDE/acia/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <stdio.h>
1414
#include <string.h>
1515
#include <sys/compiler.h>
16+
#include <cpu.h>
1617

1718
#include <arch.h>
1819
#include <arch/rc2014.h>
@@ -145,6 +146,7 @@ int8_t ya_mkcpm(char ** args) /* initialise CP/M with up to 4 drives */
145146
i++; // go to next file
146147
}
147148
fprintf(stdout,"Initialised CP/M\n");
149+
cpu_delay_ms(1); // output message before queue is flushed
148150
cpm_boot();
149151
}
150152
return 1;

ROMs/CPM-IDE/pro/cpm22bios.asm

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ siob_putc_buffer_tx:
13071307
ret
13081308

13091309
;------------------------------------------------------------------------------
1310-
; Routines that talk with the IDE drive, these should be called by
1310+
; Routines that talk with the IDE drive, these should not be called by
13111311
; the main program.
13121312

13131313
; read a sector
@@ -1331,21 +1331,17 @@ siob_putc_buffer_tx:
13311331
call ide_wait_drq ;wait until it's got the data
13321332

13331333
;Read a block of 512 bytes (one sector) from the drive
1334-
;16 bit data register and store it in memory at (HL++)
1334+
;8 bit data register and store it in memory at (HL++)
13351335

1336-
ld b,0 ;keep iterative count in b
1337-
.ide_rdblk
1338-
in a,(__IO_CF_IDE_DATA) ;read the data byte (hl++)
1339-
ld (hl+),a
1340-
in a,(__IO_CF_IDE_DATA) ;read the data byte (hl++)
1341-
ld (hl+),a
1342-
djnz ide_rdblk ;keep iterative count in b
1336+
ld bc,__IO_CF_IDE_DATA&0xFF ;keep iterative count in b, I/O port in c
1337+
inir
1338+
inir
13431339

13441340
scf ;carry = 1 on return = operation ok
13451341
ret
13461342

13471343
;------------------------------------------------------------------------------
1348-
; Routines that talk with the IDE drive, these should be called by
1344+
; Routines that talk with the IDE drive, these should not be called by
13491345
; the main program.
13501346

13511347
; write a sector
@@ -1369,15 +1365,11 @@ siob_putc_buffer_tx:
13691365
call ide_wait_drq ;wait until it wants the data
13701366

13711367
;Write a block of 512 bytes (one sector) from (HL++) to
1372-
;the drive 16 bit data register
1373-
1374-
ld b,0 ;keep iterative count in b
1375-
.ide_wrblk
1376-
ld a,(hl+)
1377-
out (__IO_CF_IDE_DATA),a ;write the data byte (hl++)
1378-
ld a,(hl+)
1379-
out (__IO_CF_IDE_DATA),a ;write the data byte (hl++)
1380-
djnz ide_wrblk ;keep iterative count in b
1368+
;the drive 8 bit data register
1369+
1370+
ld bc,__IO_CF_IDE_DATA&0xFF ;keep iterative count in b, I/O port in c
1371+
otir
1372+
otir
13811373

13821374
; call ide_wait_ready
13831375
; ld a,__IDE_CMD_CACHE_FLUSH

ROMs/CPM-IDE/pro/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <stdio.h>
1414
#include <string.h>
1515
#include <sys/compiler.h>
16+
#include <cpu.h>
1617

1718
#include <arch.h>
1819
#include <arch/rc2014.h>
@@ -158,6 +159,7 @@ int8_t ya_mkcpm(char ** args) /* initialise CP/M with up to 4 drives */
158159
i++; // go to next file
159160
}
160161
fprintf(output,"Initialised CP/M\n");
162+
cpu_delay_ms(1); // output message before queue is flushed
161163
cpm_boot();
162164
}
163165
return 1;

0 commit comments

Comments
 (0)