How can I view BASIC code hidden by SYS?

How can I view BASIC code hidden by SYS?



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.


711 SYS(2069) DMM






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 '18 at 10:18







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 '18 at 15:46



OPEN 15,8,15


PRINT#15,"V"






Make sure everything you want to keep comes off that floppy; I think it is dying.

– wizzwizz4
Sep 8 '18 at 20:51






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 '18 at 23:46




3 Answers
3



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.


SYS



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 '18 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 '18 at 15:56






Have a look at the ZoomFloppy: go4retro.com/products/zoomfloppy

– bodgit
Sep 10 '18 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



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.



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.



Thanks for contributing an answer to Retrocomputing Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




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.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)