cx16: added diskio.fastmode() to select the fast serial disk mode for the SD card

This commit is contained in:
Irmen de Jong 2024-04-02 22:17:51 +02:00
parent b385dc8c26
commit 9af4168ae2
5 changed files with 23 additions and 5 deletions

View File

@ -32,6 +32,17 @@ diskio {
cbm.CHKOUT(WRITE_IO_CHANNEL) cbm.CHKOUT(WRITE_IO_CHANNEL)
} }
sub fastmode(ubyte mode) {
; -- set fast serial mode (0=none, 1=auto_tx, 2=fast writes, 3=both) for the SD card
list_filename[0] = 'u'
list_filename[1] = '0'
list_filename[2] = '>'
list_filename[3] = 'b'
list_filename[4] = mode | $30
list_filename[5] = 0
send_command(list_filename)
}
sub directory() -> bool { sub directory() -> bool {
; -- Prints the directory contents to the screen. Returns success. ; -- Prints the directory contents to the screen. Returns success.

View File

@ -9,6 +9,7 @@ main {
uword duration uword duration
ubyte[256] bonkbuffer ubyte[256] bonkbuffer
;; diskio.fastmode(1)
set_screen_mode() set_screen_mode()
cbm.SETTIM(0,0,0) cbm.SETTIM(0,0,0)

View File

@ -8,8 +8,6 @@ main {
const ubyte HIRAM_START_BANK = 4 const ubyte HIRAM_START_BANK = 4
uword large = memory("large", 20000, 256) uword large = memory("large", 20000, 256)
bool verify = false
ubyte[256] buffer = 0 to 255 ubyte[256] buffer = 0 to 255
uword @zp buf_ptr uword @zp buf_ptr
@ -17,10 +15,11 @@ main {
txt.print("\n\ndisk benchmark on drive 8.\n") txt.print("\n\ndisk benchmark on drive 8.\n")
txt.print("with verification? y/n: ") txt.print("with verification? y/n: ")
cx16.r0L = cbm.CHRIN() bool verify = cbm.CHRIN()=='y'
txt.print("\nfast serial mode r+w? y/n: ")
bool fastserial = cbm.CHRIN()=='y'
txt.nl() txt.nl()
if cx16.r0L=='y' { if verify {
verify=true
; fill the buffers with random data, and calculate the checksum ; fill the buffers with random data, and calculate the checksum
for cx16.r0 in 0 to 19999 { for cx16.r0 in 0 to 19999 {
large[cx16.r0] = math.rnd() large[cx16.r0] = math.rnd()
@ -33,6 +32,11 @@ main {
uword crc32_h = cx16.r15 uword crc32_h = cx16.r15
} }
if fastserial
diskio.fastmode(3)
else
diskio.fastmode(0)
test_save() test_save()
test_save_blocks() test_save_blocks()
test_load_hiram() test_load_hiram()

View File

@ -29,6 +29,7 @@ main {
ubyte vera_rate ubyte vera_rate
sub start() { sub start() {
;; diskio.fastmode(1)
txt.print("name of .wav file to play on drive 8: ") txt.print("name of .wav file to play on drive 8: ")
while 0==txt.input_chars(MUSIC_FILENAME) { while 0==txt.input_chars(MUSIC_FILENAME) {
; until user types a name... ; until user types a name...

View File

@ -12,6 +12,7 @@ main {
str filename = "?"*40 str filename = "?"*40
repeat { repeat {
;; diskio.fastmode(1)
txt.print("\nenter bmx image filename: ") txt.print("\nenter bmx image filename: ")
if txt.input_chars(&filename)!=0 { if txt.input_chars(&filename)!=0 {