diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt index 38e228aa5..3782a710d 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt @@ -1454,6 +1454,7 @@ internal class AssignmentAsmGen(private val program: PtProgram, in ByteDatatypes -> { assignExpressionToRegister(expr.left, RegisterOrPair.A, dt==DataType.BYTE) asmgen.out(""" + cmp #0 beq + lda #1 + eor #1""") diff --git a/compiler/res/prog8lib/cx16/diskio.p8 b/compiler/res/prog8lib/cx16/diskio.p8 index afa2639eb..090674789 100644 --- a/compiler/res/prog8lib/cx16/diskio.p8 +++ b/compiler/res/prog8lib/cx16/diskio.p8 @@ -32,8 +32,9 @@ diskio { 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 + sub fastmode(ubyte mode) -> bool { + ; -- set fast serial mode (0=none, 1=auto_tx, 2=fast writes, 3=both) for the SD card. + ; Returns success status (fails on emulator host fs for example) list_filename[0] = 'u' list_filename[1] = '0' list_filename[2] = '>' @@ -41,6 +42,7 @@ diskio { list_filename[4] = mode | $30 list_filename[5] = 0 send_command(list_filename) + return status_code()==0 } sub directory() -> bool { diff --git a/examples/test.p8 b/examples/test.p8 index 71bd6529c..bba164ac0 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -7,7 +7,18 @@ main { sub start() { - txt.iso() - cx16.iso_cursor_char(iso:'_') + str command = "u0>b1" + diskio.send_command(command) + ;txt.print(diskio.status()) + txt.print_bool(diskio.status_code()==0) + txt.nl() + txt.print_bool(status_code()==0) + txt.nl() + ;txt.print_bool(diskio.status_code()==0) + } + + sub status_code() -> ubyte { + cx16.r0++ + return 30 } }