Save command writes 1 byte too much (bug or feature?)

Reports of emulation bugs discovered in CCS64.

Moderator: Håkan Sundell

Post Reply
BlueScreen
Posts: 3
Joined: Tue Aug 08, 2006 11:43 am

Save command writes 1 byte too much (bug or feature?)

Post by BlueScreen »

Suppose I use the save command in the monitor like this:
s "filename.bin" 2000 2200

It saves 0x200 bytes, not 0x201.
LocalH
Posts: 5
Joined: Wed Aug 25, 2004 11:57 pm

Post by LocalH »

That seems to me like correct behavior. Traditionally, C= MLMs have the following S command:

S "FILENAME" <start> <end+1>
RFBcsa
Posts: 22
Joined: Thu Aug 21, 2003 4:58 pm
Contact:

Post by RFBcsa »

: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?
:lol:
Stuart Toomer
Site Co-Admin
Posts: 786
Joined: Wed Aug 20, 2003 2:46 pm
Location: East Yorkshire, England

Post by Stuart Toomer »

I have passed this on to Hakan for investigation.
Kind regards,

Stuart Toomer.
Donski
Posts: 11
Joined: Thu Jun 22, 2006 2:39 pm
Location: Michigan

Post 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?
:lol:

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.
Anything is possible, when you don't know what you're talking about.
Stuart Toomer
Site Co-Admin
Posts: 786
Joined: Wed Aug 20, 2003 2:46 pm
Location: East Yorkshire, England

Post 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.
Kind regards,

Stuart Toomer.
RFBcsa
Posts: 22
Joined: Thu Aug 21, 2003 4:58 pm
Contact:

Post 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.
Michael Plate
Posts: 10
Joined: Sun Oct 15, 2006 1:51 pm

Post 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! :P

Ciao,
Michael
Donski
Posts: 11
Joined: Thu Jun 22, 2006 2:39 pm
Location: Michigan

Post 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! :P

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.
Anything is possible, when you don't know what you're talking about.
RFBcsa
Posts: 22
Joined: Thu Aug 21, 2003 4:58 pm
Contact:

Post by RFBcsa »

Just my point, it didn't save the entire memory.
Post Reply