Page 1 of 1

Format of LOAD"$" data

Posted: Tue Oct 31, 2023 8:00 pm
by unartic
Hi!

I've got some assemlby that loads the LOAD"$" equivalent into a part of memory, from which I now want to interpret the data.

Filename and blocksize is recognizable, but the rest of the data is not clear what it means. Nor how they files are seperated. It seems to be a $0 but, not always. I've included a screenshot of the debug window with the memory starting at $0811

I'm not able to find the specifications on the internet.

Can anyone help? :-)

Image

Re: Format of LOAD"$" data

Posted: Tue Oct 31, 2023 9:01 pm
by desertfish
The format is identical to a BASIC program. Line numbers are the block counts, and every line ends with 0 byte. I also think there's some pointer bytes that you can skip which are used in BASIC to point to the next line or something.

Anyway if you search around for how BASIC programs are stored in memory you're off to the races with this too

Re: Format of LOAD"$" data

Posted: Wed Nov 01, 2023 3:55 pm
by TomXP411
Somewhere in here, I have a BASIC program that reads a directory.

The general format for each line is something like:
  • 2 bytes: throw away
  • 2 bytes: line number (file size) in blocks. (1 block is 254 bytes)
  • some spaces
  • quote
  • filename
  • quote
  • some spaces
  • PRG
  • zero
So you can read each filename by:
  • read and discard 2 bytes
  • read 2 bytes and convert to integer
  • read text to byte 0
And when you encounter a line that's just two zeroes, that's the end of the listing.