I've tried looking at Using xa65 assembler to create Commodore 64 .prg but I couldn't get the examples to work.
I'm using the VICE emulator.
So my super basic assembly program looks like this:
.byte $01, $08
lda #1
sta $0400
jmp $0801
and checking a hexdump after assembling confirms that it is correctly assembled. As far as I can find online, this should be enough for a usable .prg file. However, if I try to use VICE's "Autostart" feature, it doesn't work. So I tried creating a disk image using c1541 with the following command:
c1541 -format diskname,id d64 my_diskimage.d64 -attach my_diskimage.d64 -write my_program.prg myprog
and while I can create a disk image, and attach it to drive #8, running LOAD "*",8,1
doesn't work. It simply gets stuck on the loading.
I have no idea where I'm going wrong. I thought the 2-byte header followed by the binary data would be enough, and that after loading I could simply launch the program by typing SYS 2049
.
I'd like to resolve this obviously, but I'm also curious as to why
- VICE's autostart failed.
- The disk image loading gets stuck.
EDIT: I tried manually poking in the outputted values into $c000 and doing a sys call, but that didn't work either! Now I'm really confused. What I did was:
POKE 49152, 1
POKE 49153, 169
POKE 49154, 0
POKE 49155, 141
POKE 49156, 76
POKE 49157, 4
POKE 49158, 192
POKE 49159, 0
SYS 49152
For reference, the hexdump of the .prg file is
c000 01a9 008d 4c04 c000
Of course, with my pokes I ignored the first $c000, since that's just the .prg header.