I ran a validation of an old disk, and it turns out this ruined a game (won't load) and deleted my old high score list on David's Midnight Magic. I would like to edit the code to get the high score list back, but when I load the program and type list, it displays 711 SYS(2069) DMM. What does this mean? I notice a similar message from Jumpman Jr. (which incidentally allows me to run the game by typing the sys command). Further, as per above, how can I move past this and actually view the code? The high score list must be there somewhere.

  • 2
    It's possible that the "validation" destroyed the high score list entirely. Which tool did you use to validate it? (This is tangential to the actual question.) – wizzwizz4 Sep 8 at 10:18
  • 2
    I typed first OPEN 15,8,15 then PRINT#15,"V". Before doing anything else, I allowed the drive to finish, even though the screen displayed READY. I am using an original CBM64 with a 1541-II floppy drive, so no emulator. In other words: No tools in particular, but the commands supported natively by the floppy drive. – Canned Man Sep 8 at 15:46
  • Make sure everything you want to keep comes off that floppy; I think it is dying. – wizzwizz4 Sep 8 at 20:51
  • 4
    The Validate DOS command rearranges the free blocks on the disk. If the highscore list was hidden somewhere in the free blocks (not unlikely), it's gone now. – Janka Sep 8 at 23:46
up vote 11 down vote accepted

SYS is the BASIC instruction to execute a routine written in machine code. There is no more BASIC code to view, the entire game is implemented as a machine code program, and the BASIC only exists as a stub to make it easier to load and run.

The best approach to viewing what the code actually does and potentially being able to restore your table (if it is still there at all) is to load the program into an emulator that has an integrated machine-level monitor/debugger. The most popular C64 emulator is VICE and although I've never used it so can't comment on how good it is, it definitely includes a monitor with the ability to disassemble code.

  • How would you go about doing that when it is saved on LD floppies? Is there any way to connect a 1541-II to a modern PC? I know it runs on a serial connection. Might there be ways to connect it to an IBM serial connection? – Canned Man Sep 8 at 15:49
  • I'm afraid I've never worked with C64 disks at all, so have no idea about that. If there isn't a question here on the subject already, it would be a very good topic for a new one... – Jules Sep 8 at 15:56
  • Have a look at the ZoomFloppy: go4retro.com/products/zoomfloppy – bodgit Sep 10 at 13:23

A lot of Commodore 8-bit computer games used a disk that had random-access files on them. This means they were written directly to disk blocks, not via a program, sequential or relative file, which are the three ways Commodore DOS officially supports files.

Random files are protected by having the programmer manually mark the blocks as being used. This works perfectly well... unless you validate the disk like you did. When this happens, Commodore DOS scans the disk and sees if any blocks (sectors) aren't tied to a file in the disk directory. This means all PRG, SEQ and REL files will continue to be protected (or re-protected, if some of the blocks were accidentally de-allocated). However, it means if there are any random file blocks, they will be marked as being available.

Even now, you still don't have a problem, but if you write a file to the disk, there is a chance DOS will use a block that had a random file on it, and this data will then be overwritten.

I suspect this is what happened to you, in which case you'll need a backup to restore your high score list (now you've learned the importance of backups :) ).

As Jules said, SYS is the BASIC instruction to execute a routine in machine code. Very much like GOSUB. USR is the equivalent of DEF FN.

There are 2 ways in which machine code is loaded

  1. It is saved with the code. This is great against piracy but it is a pain to modify. Also any minor mod you make might wipe out the assembler.

  2. There is a bunch of data statements with a whole bunch of numbers and somewhere in the code, there is a loop which reads the data and pokes it to consecutive locations.

If the second method is used, you're in luck. Somewhere in the code, it will overwrite one of the data statements and resave the file. All you have to do is convert the bunch of numbers to assembler to work out what it is doing.

If you haven't used 6502 assembler before be aware of the switch statement trick in 6502 assembler which jumps to the middle of the BIT instruction.

Also noticed that the instruction said

711  SYS(2069) DMM

DMM probably means David's Midnight Magic. There may be others using the same routine which pass different parameters across.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.