Nicely done iss. I left out the DOKE-to-activate line bit (this allows "!" to become a user defined command pointing at the new machine code).
The line quoted sets up a pointer to the just-loaded machine code, and then immediately executes it. As per the above posts, one wrong byte and you've potentially lost it all.
So definitely CSAVE your loader before running it, otherwise much frustration.
It's a shortcut for assembler/disassembler listings that the address (on the left, #9700) refers to the first byte on that line, and it's assumed that all subsequent bytes on the line are placed one address higher. As mentioned, 6502 opcodes can be 1,2 or 3 bytes, but you'll sometimes see data tables that take it further (8 or 16 at a time) :-I notice that for 9700, the corresponding value is A59C, so I guess they go in pairs?
Code: Select all
#9900: 00 05 08 AA BE FD DE 4A
#9908: AA 55 06 3E 2F 00 42 E3
#9910: etc...
But they are a little bit harder to POKE in from BASIC, as you have to then make some arrangement to deal with all the jumping around, e.g. knowing all data is #00-#FF, but addresses are probably going to be #0400+, you could do icky things like this to pick up the starting addresses of each block from the data stream ...
Code: Select all
10 A = #0
20 READ D
25 IF D = #FFFF THEN END : REM End marker, not address, not data!
30 IF D > #FF THEN A = D : GOTO 20 : REM An address, not data!
35 POKE A, D
40 A = A + 1
50 GOTO 20
100 DATA #9700, #A9, #4C, #DE, #AD (etc.)
...
210 REM CHANGING ADDRESS
220 DATA #8000, #AA, #55 (etc.)
....
430 REM ALL DONE
440 DATA #FFFF