Page 1 of 1
Save command writes 1 byte too much (bug or feature?)
Posted: Tue Aug 08, 2006 11:47 am
by BlueScreen
Suppose I use the save command in the monitor like this:
s "filename.bin" 2000 2200
It saves 0x200 bytes, not 0x201.
Posted: Wed Aug 09, 2006 4:22 am
by LocalH
That seems to me like correct behavior. Traditionally, C= MLMs have the following S command:
S "FILENAME" <start> <end+1>
Posted: Thu Aug 10, 2006 9:34 am
by RFBcsa

I tried it out by saving block C000-CFFF expecting the save to be 4096 bytes. However, it did not. There were only 4095 bytes. Apparently the last byte at CFFF is missing.
However, it al depends on the command specifications which I don't have at hand. If it reads Til then all is well, if it reads Until then one byte is missing.
I tried saving the entire ram (0000-FFFF).
It contains 65535 bytes (0-65534).
Where is the missing byte?

Posted: Thu Aug 10, 2006 5:42 pm
by Stuart Toomer
I have passed this on to Hakan for investigation.
Posted: Thu Aug 10, 2006 8:02 pm
by Donski
RFBcsa wrote::shock: I tried it out by saving block C000-CFFF expecting the save to be 4096 bytes. However, it did not. There were only 4095 bytes. Apparently the last byte at CFFF is missing.
However, it al depends on the command specifications which I don't have at hand. If it reads Til then all is well, if it reads Until then one byte is missing.
I tried saving the entire ram (0000-FFFF).
It contains 65535 bytes (0-65534).
Where is the missing byte?

Again, as localh has stated, that's normal. In all the machine language monitors for the Commodore I've used, including the one I wrote, the end address is always +1. When you wish to save C000-CFFF, you use C000-D000. It's simply because that's the way the CBM Kernal was written. It saves a byte, increases the register, compares the register to the end, and when it's equal then it quits before it saves another byte. If it were to save another byte as you expected, then they would've had to specially add that into the program. Learn to deal with it.
Posted: Thu Aug 10, 2006 10:36 pm
by Stuart Toomer
Reply from Hakan:
This is not a bug, it is working like it should. In CCS64, as well as in the majority of all C64 native machine code monitors (e.g. Hes-mon), all end-addresses are specified as non-inclusive (up to address but not including). To save entire C64 RAM, “s filename 0000 0000” is correct syntax.
Posted: Thu Aug 24, 2006 6:11 am
by RFBcsa
Thanks for the information Donski, Stuart.
I've learned something today.
In 'those days' I used the Power Cartridge's build in monitor to go into the memory. Just as an extra I looked up the Save command in the manual but there wasn't anything mentioned about the issue. It only states S "filename",[device],[begin address],[end address]. So I tested it with the Cartridge Rom I have and I can say that it also output without the 1 byte. I guess this is something that completely slipped by me when I was using the monitor at the time.
Posted: Sun Oct 15, 2006 2:08 pm
by Michael Plate
RFBcsa wrote:I tried saving the entire ram (0000-FFFF).
It contains 65535 bytes (0-65534).
Where is the missing byte?
To get the missing byte use '10000' as end address!
Ciao,
Michael
Posted: Sun Oct 15, 2006 4:22 pm
by Donski
Michael Plate wrote:RFBcsa wrote:I tried saving the entire ram (0000-FFFF).
It contains 65535 bytes (0-65534).
Where is the missing byte?
To get the missing byte use '10000' as end address!

Ciao,
Michael
I can't say about the CCS64 monitor as I haven't tried that yet, but I know that in some machine language monitors it wouldn't work. The reason is that they will use the 1st 4 characters, so 10000 would be the same as 1000.
Oh yeah, just in case anyone is checking, these numbers are wrong,,,
It contains 65535 bytes (0-65534).
it should read,,,
It contains 65536 bytes (0-65535).
Even the numbers you typed were missing a byte.
Posted: Sun Oct 15, 2006 9:52 pm
by RFBcsa
Just my point, it didn't save the entire memory.