This is a basic loader that shows how to poll for the run/stop key in C64 assembly. It just loops endlessly polling, using the built in subroutine $ffe1. once the run/stop key is pressed it branchs to the rts instruction and returns to basic.
First type in and run this basic program to load the assembly program.
10 a=4096 20 read d 30 if d=-1 then 90 40 print a;d 50 poke a,d 60 a=a+1 70 goto 20 90 end 100 data 32,225,255,240,3,76,0,16,96 999 data -1
Then type the following to run. Press the run/stop key (ESC in the VICE emulator) to exit the program
Here is a hex dump and dissably using a ML monitor. The machine code “20 e1 ff f0 03 4c 00 10 60” is the same as the data in the basic data statement, but the data statement uses decimal rather than the hex representation.
.d 1000 1008 ., 1000 20 e1 ff jsr $ffe1 ., 1003 f0 03 beq $1008 ., 1005 4c 00 10 jmp $1000 .a 1008 60 rts .a 1009
You can choose a different starting address other than 4096 (hex $1000) and also put more useful code in between the branch and jump statements.