diff --git a/Makefile b/Makefile index 30c6b004..f375c2b6 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \ c64/kernal/rom_revision \ c64/kernal/rs232 \ c64/kernal/screen \ + c64/kernal/tape \ c64/kernal/time diff --git a/STATUS.md b/STATUS.md index d754ca4f..7c0e8663 100644 --- a/STATUS.md +++ b/STATUS.md @@ -130,8 +130,8 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFC6` | `$F20E` | `CHKIN` | DONE | | | `$FFC9` | `$F250` | `CKOUT` | DONE | | | `$FFCC` | `$F333` | `CLRCHN` | DONE | | -| `$FFCF` | `$F157` | `CHRIN` | PARTIAL | | -| `$FFD2` | `$F1CA` | `CHROUT` | PARTIAL | | +| `$FFCF` | `$F157` | `CHRIN` | PARTIAL | no screen support, keyboard does not preserve .Y | +| `$FFD2` | `$F1CA` | `CHROUT` | DONE | | | `$FFD5` | `$F49E` | `LOAD` | DONE | | | `($0330)` | `$F4A5` | `LOAD` | PARTIAL | no VERIFY support, no STOP key support | | `$FFD8` | `$F5DD` | `SAVE` | DONE | only this preparation routine part is done | @@ -139,7 +139,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFDB` | | `SETTIM` | DONE | | | `$FFDE` | | `RDTIM` | DONE | | | `$FFE1` | `$F6ED` | `STOP` | DONE | | -| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | only keyboard supported | +| `$FFE4` | `$F13E` | `GETIN` | PARTIAL | no screen device support | | `$FFE7` | `$F32F` | `CLALL` | DONE | | | `$FFEA` | | `UDTIM` | DONE | | | `$FFED` | | `SCREEN` | DONE | | diff --git a/c64/kernal/f13e.getin.s b/c64/kernal/f13e.getin.s index be8e3faa..0291988d 100644 --- a/c64/kernal/f13e.getin.s +++ b/c64/kernal/f13e.getin.s @@ -5,12 +5,24 @@ // - [RG64] C64 Programmer's Reference Guide - page 283 // - [CM64] Compute's Mapping the Commodore 64 - page 227/228 // -// CPU registers that has to be preserved (see [RG64]): .X, .Y +// CPU registers that has to be preserved (see [RG64]): for RS-232: .X, .Y // GETIN: - // XXX this should be a dispatcher for several different devices! + // Determine the device number + lda DFLTN - jmp read_kb_buf + // Try $00 - keyboard + beq_far getin_keyboard + +#if HAS_RS232 + + // Try $02 - RS-232 + cmp #$02 + beq_far getin_rs232 + +#endif // HAS_RS232 + + jmp chrin_getin diff --git a/c64/kernal/iec/chrout_iec.s b/c64/kernal/iec/chrout_iec.s new file mode 100644 index 00000000..38924b76 --- /dev/null +++ b/c64/kernal/iec/chrout_iec.s @@ -0,0 +1,12 @@ + +// +// IEC part of the CHROUT routine +// + + +chrout_iec: + + lda SCHAR + jsr JCIOUT + bcc_far chrout_done_success + jmp chrout_done_fail diff --git a/c64/kernal/iostack/f157.chrin.s b/c64/kernal/iostack/f157.chrin.s index 6ab21bfa..32da72d0 100644 --- a/c64/kernal/iostack/f157.chrin.s +++ b/c64/kernal/iostack/f157.chrin.s @@ -35,6 +35,8 @@ CHRIN: #endif // HAS_RS232 +chrin_getin: // jump entry for GETIN + #if CONFIG_IEC // Try IEC devices diff --git a/c64/kernal/f1ca.chrout.s b/c64/kernal/iostack/f1ca.chrout.s similarity index 80% rename from c64/kernal/f1ca.chrout.s rename to c64/kernal/iostack/f1ca.chrout.s index 9ebbe75d..b0103b59 100644 --- a/c64/kernal/f1ca.chrout.s +++ b/c64/kernal/iostack/f1ca.chrout.s @@ -6,7 +6,7 @@ // - [CM64] Compute's Mapping the Commodore 64 - page 228 // // CPU registers that has to be preserved (see [RG64]): .Y -// Additionally we have to preserve .X for out CHRIN implementation +// Additionally we have to preserve .X for out CHRIN and implementation // CHROUT: @@ -27,17 +27,17 @@ CHROUT: lda DFLTO cmp #$03 // screen - bne !+ - jmp chrout_screen -!: + beq_far chrout_screen + +#if HAS_RS232 + cmp #$02 + beq_far chrout_rs232 +#endif + +#if CONFIG_IEC jsr iec_check_devnum_oc - bcs chrout_done_unknown_device // not a supported device - -chrout_iec: - - lda SCHAR - jsr JCIOUT - bcc chrout_done_success + bcc_far chrout_iec +#if CONFIG_IEC // FALLTROUGH diff --git a/c64/kernal/f1ca.interop b/c64/kernal/iostack/f1ca.interop similarity index 100% rename from c64/kernal/f1ca.interop rename to c64/kernal/iostack/f1ca.interop diff --git a/c64/kernal/iostack/f4a5.load.s b/c64/kernal/iostack/f4a5.load.s index 0f1b0e36..53d31e53 100644 --- a/c64/kernal/iostack/f4a5.load.s +++ b/c64/kernal/iostack/f4a5.load.s @@ -40,9 +40,19 @@ LOAD: // Check whether we support the requested device lda FA +#if CONFIG_TAPE_NORMAL + cmp #$01 + beq_far load_tape_normal +#endif + +#if CONFIG_TAPE_TURBO + cmp #$07 + beq_far load_tape_turbo +#endif + #if CONFIG_IEC jsr iec_check_devnum_lvs bcc_far load_iec -#endif // CONFIG_IEC +#endif jmp lvs_illegal_device_number diff --git a/c64/kernal/keyboard/f142.read_kb_buf.s b/c64/kernal/keyboard/f142.getin_keyboard.s similarity index 80% rename from c64/kernal/keyboard/f142.read_kb_buf.s rename to c64/kernal/keyboard/f142.getin_keyboard.s index 8b72b9e2..3e3da159 100644 --- a/c64/kernal/keyboard/f142.read_kb_buf.s +++ b/c64/kernal/keyboard/f142.getin_keyboard.s @@ -6,7 +6,7 @@ // -read_kb_buf: +getin_keyboard: // XXX confirm that here is really a part of GETIN! // Check for a key lda NDX diff --git a/c64/kernal/rs232/chrout_rs232.s b/c64/kernal/rs232/chrout_rs232.s index 4617bc1a..9c3af02f 100644 --- a/c64/kernal/rs232/chrout_rs232.s +++ b/c64/kernal/rs232/chrout_rs232.s @@ -3,8 +3,6 @@ // RS-232 part of the CHROUT routine // -// XXX connect to I/O stack - #if HAS_RS232 diff --git a/c64/kernal/rs232/getin_rs232.s b/c64/kernal/rs232/getin_rs232.s index fd062e3a..17215ead 100644 --- a/c64/kernal/rs232/getin_rs232.s +++ b/c64/kernal/rs232/getin_rs232.s @@ -3,8 +3,6 @@ // RS-232 part of the GETIN routine // -// XXX connect to I/O stack - #if HAS_RS232 diff --git a/c64/kernal/tape/load_tape_normal.s b/c64/kernal/tape/load_tape_normal.s new file mode 100644 index 00000000..f480922e --- /dev/null +++ b/c64/kernal/tape/load_tape_normal.s @@ -0,0 +1,14 @@ + +// +// Tape (normal) part of the LOAD routine +// + + +#if CONFIG_TAPE_NORMAL + + +load_tape_normal: + STUB_IMPLEMENTATION() + + +#endif diff --git a/c64/kernal/tape/load_tape_turbo.s b/c64/kernal/tape/load_tape_turbo.s new file mode 100644 index 00000000..a6d7b1b1 --- /dev/null +++ b/c64/kernal/tape/load_tape_turbo.s @@ -0,0 +1,14 @@ + +// +// Tape (turbo) part of the LOAD routine +// + + +#if CONFIG_TAPE_TURBO + + +load_tape_turbo: + STUB_IMPLEMENTATION() + + +#endif