From: Marko Mäkelä (marko.makela_at_hut.fi)
Date: 2004-12-29 12:26:27
Rich, > OK... so I could take the bytes of an assembled piece of code and > write a file containing the first two bytes as the load address and > followed by the bytes of the assembled piece and the loader will load > my code at the requested address and then JMP to that address, or does > it JSR? It will load the code, but not start it. Auto-starting programs are implemented by overwriting some system vector. On the 8032, you can use the "print to screen" vector; on older PETs I'm not aware of an auto-start mechanism. You can have a look at the c2nload source code for my implementation of an auto-starting loader for all Commodore 8-bit computers equipped with a tape interface. Once that loader has started, it loads the actual program and starts it by writing a RUN or SYS command to the keyboard buffer. For older PETs (or actually all PETs), I wrote a c2nload loader that is started from BASIC. It'll detect the ROM version and the cassette buffer that contains the rest of the loader. If anyone knows a better solution, I'd like to know of it. It's customary to write a one-line BASIC header that contains a SYS command. Sometimes, the line number of that BASIC header is the year of publication. On the PET, you could use 2004 SYS1037 or 2004 SYS1039:NEW and have the machine code start at $040d or $040f. That'll be like JSR; an RTS will exit to BASIC, unless you fiddle with the stack pointer. Marko Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.