| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Reading the directory - raw mode
I might have dreamt it but.. I distinctively remember being able to control ”output mode” from the regular reading $ command. I’d rather not parse quoted strings and what not and I’d rather not read raw sectors.
I remeber being able to change output format.. |
|
| |
soci
Registered: Sep 2003 Posts: 480 |
Use a secondary address of 2-14 to do that. Format varies by device. |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Use a secondary address of 2-14 to do that. Format varies by device.
Thanks!!! Formats specified anywhere? |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
It's just a step above raw sectors. I guess you know the directory format, being the original author of CC1541. :)
So parsing the BASIC-style cooked directory might actually be the better idea.
But why do you need to read and parse the directory? |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: It's just a step above raw sectors. I guess you know the directory format, being the original author of CC1541. :)
So parsing the BASIC-style cooked directory might actually be the better idea.
But why do you need to read and parse the directory?
To locate savegames |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Then you should have perfect control over your naming scheme.
I think parsing the directory in cooked mode is the better option. Works consistently across all drives, and you're using KERNAL calls anyways.
And it can't be so hard or error-prone to do some kind of pattern matching in order to list your savegames, can it? Doesn't even require handling quoted strings and what not. :) |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Then you should have perfect control over your naming scheme.
I think parsing the directory in cooked mode is the better option. Works consistently across all drives, and you're using KERNAL calls anyways.
And it can't be so hard or error-prone to do some kind of pattern matching in order to list your savegames, can it? Doesn't even require handling quoted strings and what not. :)
Just did. :)
1) Enter kernel hell
2 I read each null-terminated line into a buffer.
3) Scan from the end until normal character, then scans backwards until space. => File type found
4) Then I continue to scan backwards until " found. If not, bail
5) Then I scan from 0 and forward until " found. If not bail
=> Filename found
6) Verify filetype, pattern match filename, add to valid file buffer list.
7) Repeat 2) until EOF
8) Leave kernel hell
9) Present nice file picker UI |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
why dont you just let the drive do the work for you?
a) pick a prefix for your savegames, like "leet.game1" "leet.game2"
b) open "$:leet*" |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: why dont you just let the drive do the work for you?
a) pick a prefix for your savegames, like "leet.game1" "leet.game2"
b) open "$:leet*"
Wasnt aware it could be done. Awesome! I’ll remove my filter stuff but keep the quote parsing. Can you enforce filetype also? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
of course - open "$:bla*,p" |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Actually, "$:bla*=p" - see http://unusedino.de/ec64/technical/aay/c1541/ro41c398.htm (and http://unusedino.de/ec64/technical/aay/c1541/ro41da55.htm). :) |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: of course - open "$:bla*,p"
\o/ |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
OK :) |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
School book example of an XY-problem: https://en.m.wikipedia.org/wiki/XY_problem |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
wow, didnt know kernal can do such nifty shit :) |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
The drive does it, the Kernal does nothing. I wasn't until the 128 that they actually told this stuff in the normal manual. The Drive's KERNAL is actually quite nice, feature packed.. just nobody ever uses it.
The 128 has some really nice stuff in its BASIC commands.
RUN"* loads and runs the first file on the disk ;)
DIRECTORY <filter here> shows the directory with the filter and doesn't destroy BASIC ;)
I really need to get on with my Super Kernal Idea so I can port this stuff back down the C64... |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting oziphantomThe Drive's KERNAL is actually quite nice, feature packed.. just nobody ever uses it. The ROM OS is as big as the computer's KERNAL and BASIC combined, and packs quite some functionality indeed. But it's just too slow in most of what it does, and that dwarfs all the goodness. :) |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
One of my favourite obscure functions is the utility loader, which would load specially-named and -typed files ("&:*" USR files, IIRC) to drive RAM and execute them, and it even comes with an actual checksum and not just EORed parity. |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
doesn't your loader load your custom code form the disk and then upload back to the drive from the C64? |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Yes, it does. Might sound a little roundabout to load a file from disk only to send code back to the drive, but the loader needs to execute code on all connected drives, not just the primary one with an inserted disk. And also it needs to detect drive models and modify the code a little here and there accordingly. Plus having one or many weird files plainly visible in the directory isn't what most users want. |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Dutch Breeze uses the utility loader IIRC. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting tlrDutch Breeze uses the utility loader IIRC. Interesting. And they encrypted the code. Guess somebody was very proud of his IRQ loader and guarding its secrets closely. Wasn't Dutch Breeze one of the first demos to load in the background?
I've first come across the utility loader with North & South. Probably, other Infragrames titles used it and the same loader as well. |
| |
Dano
Registered: Jul 2004 Posts: 234 |
Road to Excess had a IRQ-Loaderpart aswell. Not sure if this was the first.
That typical IRQ Loader from back in the days was it from G.I. Joe? The one with the $CC00 and $CF00 calls iirc?
What's a utility loader btw? |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Dutch breeze may have been an early loading in the background demo while doing something really meaningful.
Demos like this existed before, e.g AB which I helped integrate the above mentioned GI-Joe loader into.
Gergamygg III is using it during demo parts.
Non-demo uses as emulating the tape loading in this crack: Rambo: First Blood Part II were much earlier. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting danoWhat's a utility loader btw? It's a rarely-used obscure feature of the drive's ROM OS. More information in these classic comp.sys.cbm posts: https://groups.google.com/forum/#!searchin/comp.sys.cbm/|sort:d.. |