PDA

View Full Version : Memory Locations for Games



jeff48356
December 26th, 2007, 12:40 PM
I noticed that for many Commodore 64 games, the programmer likes to use the memory area $A000-BFFF for part of the code. If there is plenty of room in the regular RAM area, what is the purpose for using the underlying RAM under the BASIC ROM? Is there an advantage to using this area?

atari2600a
December 26th, 2007, 01:18 PM
I've never touched a C64 before (although I do have experience w/ the 6502) but looking at a memory map it looks like it's just another 8KB of memory, interchangable w/ the BASIC ROM depending on a few bits in a register.

mbbrutman
December 26th, 2007, 01:33 PM
Back to what Dwight has said earlier about using a debugger ...

Is there a 'monitor' or debugger available built into the C64? I didn't think there was.

One of the problems with running a game under a debugger to crack it is that the game makes it hard to run the debugger .. For example, the game boots from a floppy and wipes out the debugger in memory.

Does the CPU on the C64 have a single step instruction mode supported by hardware? I know that the Intel chips have a flag that you can turn on that generates an interrupt and stops the processor after running one instruction. Does the MOS 6500 series have something similar?

jeff48356
December 26th, 2007, 01:54 PM
I forgot to say after all these posts that all these games are being run on a Windows PC using the VICE C-64 emulator. I haven't had an actual C-64 machine since I was in 9th grade (1987 or so). It was then that the machine stopped working, and I never got a new one. I can easily modify memory locations and disassemble machine code using the emulator with built-in debugger.

In fact, I'm typing this post on the same computer I use for playing the C-64 games, only in a different window. :)

carlsson
December 27th, 2007, 01:13 AM
I don't think $A000 is much more common than any other memory address. 8K cartridges will be located to $8000, and for other software you can store them pretty much anywhere in memory.

However, the VIC-II chip can read/write to 16K at a time. The default setting is the first block $0000-$3FFF, but many programs rather relocate it to $C000-$FFFF because there is RAM underlying ROM, and more difficult to use for other purposes. The VIC-II chip can't access the ROMs anyway, so for that purpose it is ideal to store graphics data in that section.

As to Mike's question: No, there is no built-in monitor in the C64. Likewise there is no single-step flag. However, using a cartridge like The Final Cartridge (III) or Action Replay (V or VI), these contain monitor programs that let you set breakpoints. These are intercepted and from there single-step instruction by instruction once inside the monitor.