From 73f1e24e3c1d38db44d23ceab45b62de33df2428 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 29 Oct 2019 22:15:44 +0100 Subject: [PATCH] LOAD/SAVE preparation routines should be OK now --- STATUS.md | 8 ++--- .../{f49e.load_int.s => f49e.load_prep.s} | 13 ++++++++- c64/kernal/iostack/f5dd.save_int.s | 12 -------- c64/kernal/iostack/f5dd.save_prep.s | 29 +++++++++++++++++++ c64/kernal/jumptable/ffd5.jload.s | 2 +- c64/kernal/jumptable/ffd8.jsave.s | 2 +- 6 files changed, 47 insertions(+), 19 deletions(-) rename c64/kernal/iostack/{f49e.load_int.s => f49e.load_prep.s} (58%) delete mode 100644 c64/kernal/iostack/f5dd.save_int.s create mode 100644 c64/kernal/iostack/f5dd.save_prep.s diff --git a/STATUS.md b/STATUS.md index 448fefa5..d754ca4f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -128,13 +128,13 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFC0` | `$F34A` | `OPEN` | DONE | | | `$FFC3` | `$F291` | `CLOSE` | DONE | | | `$FFC6` | `$F20E` | `CHKIN` | DONE | | -| `$FFC9` | `$F250` | `CKOUT` | PARTIAL | | +| `$FFC9` | `$F250` | `CKOUT` | DONE | | | `$FFCC` | `$F333` | `CLRCHN` | DONE | | | `$FFCF` | `$F157` | `CHRIN` | PARTIAL | | | `$FFD2` | `$F1CA` | `CHROUT` | PARTIAL | | -| `$FFD5` | `$F49E` | `LOAD` | PARTIAL | not yet clear what's this entry doing | -| `($0330)` | `$F4A5` | `LOAD` | PARTIAL | no VERIFY support, no STOP key, check $F49E addr | -| `$FFD8` | `$F5DD` | `SAVE` | NOT 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 | | `($0332)` | `$F5ED` | `SAVE` | NOT DONE | | | `$FFDB` | | `SETTIM` | DONE | | | `$FFDE` | | `RDTIM` | DONE | | diff --git a/c64/kernal/iostack/f49e.load_int.s b/c64/kernal/iostack/f49e.load_prep.s similarity index 58% rename from c64/kernal/iostack/f49e.load_int.s rename to c64/kernal/iostack/f49e.load_prep.s index ca8fca9c..cc045026 100644 --- a/c64/kernal/iostack/f49e.load_int.s +++ b/c64/kernal/iostack/f49e.load_prep.s @@ -1,11 +1,22 @@ +// +// LOAD preparation routine +// + +// +// Input (according to http://sta.c64.org/cbm64krnfunc.html) +// .A - 0 for load, non-0 for verify +// .X and .Y - load address (if secondary address is 0) +// + // // Note: Although the vector at $330 points to $F4A5, the Kernal jump table points to $F49E // (see also Mapping the C64, page 76). By experimenting I have discovered that $F49E performs // indirect jump via ($0330) vector, after setting MEMUSS. // -LOAD_INT: + +LOAD_PREP: sty MEMUSS+1 stx MEMUSS+0 diff --git a/c64/kernal/iostack/f5dd.save_int.s b/c64/kernal/iostack/f5dd.save_int.s deleted file mode 100644 index 7ef54a41..00000000 --- a/c64/kernal/iostack/f5dd.save_int.s +++ /dev/null @@ -1,12 +0,0 @@ - -// -// XXX Note: something unusual was done with LOAD routine - although the vector at $330 points to $F4A5, -// the Kernal jump table points to $F49E (see also Mapping the C64, page 76). By experimenting -// I have already discovered that $F4A5 performs indirect jump via ($0330) vector, but it must -// be doing a little bit more - not sure yet, what. Something similar is done with SAVE. -// -// This has to be clarified. -// - -SAVE_INT: - jmp (ISAVE) diff --git a/c64/kernal/iostack/f5dd.save_prep.s b/c64/kernal/iostack/f5dd.save_prep.s new file mode 100644 index 00000000..d7cf3f86 --- /dev/null +++ b/c64/kernal/iostack/f5dd.save_prep.s @@ -0,0 +1,29 @@ + +// +// SAVE preparation routine +// + +// +// Input (according to http://sta.c64.org/cbm64krnfunc.html) +// .A - address of zero page register holding start address of memory area to save +// .X and .Y - end address of memory area plus 1 +// + +// +// Note: Experimenting can easily confirm that SAVE preparation routine does similar +// actions as LOAD preparation routine. +// + +SAVE_PREP: + + sty EAL+1 + stx EAL+0 + + tax + + lda $01, x + sta STAL+1 + lda $00, x + sta STAL+0 + + jmp (ISAVE) diff --git a/c64/kernal/jumptable/ffd5.jload.s b/c64/kernal/jumptable/ffd5.jload.s index ef66f320..002e01fd 100644 --- a/c64/kernal/jumptable/ffd5.jload.s +++ b/c64/kernal/jumptable/ffd5.jload.s @@ -1,4 +1,4 @@ // load RAM from a device // C64 Programmer's Reference Guide Page 272 - jmp LOAD_INT + jmp LOAD_PREP diff --git a/c64/kernal/jumptable/ffd8.jsave.s b/c64/kernal/jumptable/ffd8.jsave.s index 1213f478..25f3fbec 100644 --- a/c64/kernal/jumptable/ffd8.jsave.s +++ b/c64/kernal/jumptable/ffd8.jsave.s @@ -1,4 +1,4 @@ // SAVE RAM to device // C64 Programmer's Reference Guide Page 273 - jmp SAVE_INT + jmp SAVE_PREP