Nathaniel.Borenstein@CMU-CS-ZOG.ARPA (08/21/84)
Can anyone point me to public sources or documentation for making Commodore 64 and Vic-20 programs automatically run when loaded? I know this can be done because most commercial software does it, but the programmer's reference manual and other documentation doesn't seem to tell me how to do it. Please send replies to nsb@CMU-CS-ZOG.ARPA. Thanks. -- Nathaniel
prindle@NADC.ARPA (08/21/84)
The best way to find out about auto-start files for the C-64 is to take one apart; I assume they will work the same way on the VIC: It's really quite simple, but you must understand assembly language and the Kernel calls necessary to do a load operation. You write an assembly language program assembled to start loading at $100 (the microprocessor stack). In the last half of the stack (approx $180-$1ff) you can put $01 or $02 in every byte. This causes the kernel load routine to return to address $102 or $203 respec- tively after the load is finished. Here you put the assembly code to reset the stack pointer to $ff, load the real program you want to run, and transfer control to it's starting address. Then, after you assemble this little program, force it to load at some other address ($801 is good) so you can save it on disk; the commodore assembler has this relocation feature, and I'm sure others do too. Lastly, you must use a disk utility (such as the public domain program Disk-Doctor) to change the load address back to $100 where it was assembled to run (the load address is in the second pair of bytes in the first sector of the file). Now when you say LOAD"THISPROG",8,1 it will start running automatically, and load the real program and start it. Same thing works with tape, but you need a different utility to modify the load address. Personally, I see no advantage in auto-start programs over the simple LOAD"FILE",8:{shift/run/stop-key} method, unless you are trying to make your program hard (never impossible) for others to copy. ~v