I've also been trying to figure out how to erase files from a floppy using the kernal. Little bit of a pain, since theres hardly anything telling you how to execute disk commands from assembler. I know you can do this in DOS...
open 15,8,15,"S0:FILE"
close 15
But, I wasn't sure how to actually do it in assembler. I finally found some code after a bit of hunting around and this is now what I do...
lda #15 ; file handle
ldx #8 ; device
tay ; command channel
jsr SETLFS ; set channel details
lda #8 ; length of filename ("S0:SCORE")
ldx #LO(HISCORENAME) ; pointer to score
ldy #HI(HISCORENAME)
jsr SETNAM ; Set file name
jsr OPEN ; perform OPEN command
lda #15
jsr CLOSE ; and close the channel
And thats all there is to it. When we have the turbo installed we'll have to issue a save with overwrite and get the turbo (on the disk drive side) to erase the file first. This is all to avoid the SAVE "@0:filename" bug. However, after all this is done, it'll mean we can save hiscores to disk for a proper record - which is cool.
12 comments:
Use LDX $AE instead of LDX #8 and it will use the device the game was loaded from.
--
TNT
Yep I would....except by the time this runs, Zero page is well fried :)
I intend to have the loader save the current device number somewhere safe for the game to pick up later.
I pair-coded a game with a friend who moved abroad half way through the project, yet managed to keep things going regardless. VoIP (skype), desktop sharing and virtual whiteboards is the next best thing to actually meeting in person.
Seriously, it works =)
/doynax
No, don't tell me: didn't you enjoyed the long chat? :D
-ed
Scartch/Save is the safest way really due to the 1541 SAVE"@0:blag" bug. Either that or writng directly to a track/sector, which I dont want to do incase the track is corrupted. You can always write the file again, but if a track becomes unreadable...its a bugger.
Yes, there will be a pause when saving the highscores, but thats not going to be THAT often - not really.
either 5 or 10 entries, haven't decided.
if you are less than or equal to an entry, you go under it. So if you equal the bottom one, you dont get on the table.
with the 4bytes of memory left, you can do whatever you want :)
What I really want is a SID card with a 256k or larger memory expansion - THAT would be nice.
The Turbo TNT is making is 1541,1571 & 1581. The memory map has changed a little. And although theres memory free just now, I'm trying to keep it for a couple of "surprises" :)
Zero page is up to 193 just now. But as I start to finish up, I'll move more common variables down into ZPage to help keep the speed up.
Yeah, spotted a few places in low memory that I could use. I'm trying not to so that unknown systems (and possible future systems) will still work. For example, if you wrote a RAM disk for your memory expansion and loaded the whole lot onto the disk, you would have just under 2K to do this. Or, if you wanted to "patch" the game to make use of memory expansion (or a new IDE device), then there is a known area thats free to do so.
I don't want to use the RAM since the SID card I think is much more important. But others can if they like - once the source is released feel free to do a RAM expanded version :)
I'll be using all the memory up to $fffb quite probably.
If there was a SID+Memory card, then I'd get more interested in it.
1541/1571 turbo is 173 bytes after installation, but that doesn't include save. I suspect that to take another 40-50 bytes, still keeping it below one page. Couple more bytes and the same code will talk to 1581 too, although the code in drive is somewhat different.
Oh, the speed? Xeo3 teaser takes 2:35 to load without any speeder in YAPE, with my loader it's 0:54. Only ~1 KB per second, but it keeps the screen on. How much data there is to load per level?
--
TNT
All sources will be released with the game. With save routine added it's now 212 bytes, but it doesn't yet do additional init handshake which allows interrupts on drive side (read: automatic write buffer flushing with 1581).
FLoad3.2 uses memory $055d-$07d7, my loader/saver uses $055d-$063b. That leaves some space for eye candy while loading if loader is detected. It's up to Mike if he wants to use it.
--
TNT
I forgot that c1541 (D64 tool which comes with VICE) doesn't use interleave at all! That didn't seem to matter with normal load tho.
Assuming YAPE uses normal 300 RPM for disk rotation, optimal interleave for my loader is 16. 43 seconds to load XeO3 teaser - that's ~12 seconds for 16 KB.
I suggest using interleave 17 because some drives rotate faster, and that also leaves some cycles for eye candy.
--
TNT
Post a Comment