| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Loading and saving to disk using kernel
Assume: Machine booted from cart. Cart ROM at $8000-$bfff. IO at $Dxxx and KERNAL at $e000-$ffff
What calls do I have to do to use KERNEL load/save?
What RAM and ZP will be trashed by this?
How will it affect my IRQs? (I have CIA1 and raster IRQs running via $0314/15) |
|
... 23 posts hidden. Click here to view all posts.... |
| |
Grue
Registered: Dec 2001 Posts: 146 |
While these tricks are nice and clever keep in mind that it will break compability with alternative kernals.
Quoting Danzig@JackAsser: Don't know if its of any value for you but if you use $ee13 you can jump to $ee20 instead and use
LDA #$00
STA $A5
JSR $EE85
JSR $EEA9
BPL *-3
SEI
jsr $ee20
with moving the SEI below the BPL the routine just rips ~30 rasterlines while loading. One might call it "pretty cheap irq loader" :-D
Org (KERNAL):
.,EE13 78 SEI
.,EE14 A9 00 LDA #$00
.,EE16 85 A5 STA $A5
.,EE18 20 85 EE JSR $EE85
.,EE1B 20 A9 EE JSR $EEA9
.,EE1E 10 FB BPL $EE1B
PS: AFAIR the source of this "trick" was some issue of "64er" |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Yeah, I keep it simple and blank the screen. Speaking of alternative Kernels... what about their memory footprint while loading/saving? |
| |
Flavioweb
Registered: Nov 2011 Posts: 447 |
To avoid problems with the pletora of alternative fl, you can just backup/reset/restore the vectors.
But should be interesting to investigate this... |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Quote: To avoid problems with the pletora of alternative fl, you can just backup/reset/restore the vectors.
But should be interesting to investigate this...
The vectors are one thing, but I would imagine an alternative kernel to perhaps reserve a 256 byte sector buffer for speed etc no? Or are they all "compatible" to each other? Or is it simply assumed that ZP and $200-$3ff is a no-go for own code when it comes to kernel compatibility? |
| |
cadaver
Registered: Feb 2002 Posts: 1153 |
I go by the assumption that any alternative kernal will not use at least more memory or more ZP locations, may come to yet bite my ass :)
Outside ZP starting your own memory use from $0334 should be OK, no need to avoid $0334-$03ff range unless you use tape IO. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1378 |
Quoting OswaldkernAl
And Betty when you call me you can calllll, meeeee, Al :) |
| |
Martin Piper
Registered: Nov 2007 Posts: 634 |
Code used for Berzerk Redux. I used the disk drive for hiscore storage with an optional custom load/save: https://github.com/martinpiper/C64Public/blob/master/BerzerkRed..
Citadel2 cartridge code, works with kernal replacement and CBM80 boot carts (EF and GMod2). Also tests cart banking: https://github.com/martinpiper/C64Public/blob/master/Citadel2/C.. |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Quote: Code used for Berzerk Redux. I used the disk drive for hiscore storage with an optional custom load/save: https://github.com/martinpiper/C64Public/blob/master/BerzerkRed..
Citadel2 cartridge code, works with kernal replacement and CBM80 boot carts (EF and GMod2). Also tests cart banking: https://github.com/martinpiper/C64Public/blob/master/Citadel2/C..
Awesome Martin! Thanks! |
| |
Rastah Bar
Registered: Oct 2012 Posts: 336 |
I saved a file with this routine from codebase:
https://codebase64.org/doku.php?id=base:saving_a_file
That works fine.
But when I want to load it again via
https://codebase64.org/doku.php?id=base:loading_a_file
it never returns from JSR $FFD5. It gets stuck in some loop at $EE30.
I'm not using any ZP adresses above $8f. But I did disable timer interrupts earlier:
lda #$7f
sta $dc0d
sta $dd0d
lda $dc0d
lda $dd0d
Enabling them before calling the load routine doesn't seem to help. I also disabled raster IRQs before calling the routine:
sei
lda #0
sta $d01a
inc $d019
lda #$37
sta $01 ;I used $fffe and $ffff, so this should be fine
The call to the load routine is done from main.
Does anybody have an idea why the load routine doesn't return and/or suggestions what I could try? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11114 |
i'd try calling the IORESET (or whatever its called) kernal call before, if that does the trick strip it down :) |
Previous - 1 | 2 | 3 | 4 | 5 - Next |