Generate a PRG file

This commit is contained in:
Gregor Riepl 2022-08-22 19:00:42 +02:00
parent 9c71e8bbb0
commit 9f2054453d
4 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ plot/
*.bin *.bin
*.map *.map
*.lst *.lst
*.prg

View file

@ -4,17 +4,13 @@ MEMCFG := mem.cfg
.PHONY: all clean .PHONY: all clean
all: rs232.bin rs232.lst all: rs232.prg
clean: clean:
rm -f rs232.bin *.o *.lst *.map rm -f rs232.bin *.o *.lst *.map
rs232.bin: driver.o rs232.prg: driver.o
cl65 -v -C ${MEMCFG} -m rs232.map -o $@ $^ cl65 -v -C ${MEMCFG} -m rs232.map -o $@ $^
%.lst: %.bin
@# the start address shouldn't be hardcoded here...
da65 -o $@ -S 0x7000 $<
%.o: %.a65 %.o: %.a65
ca65 -v -l $(patsubst %.o,%.lst,$@) -t ${MACHINE} -o $@ $< ca65 -v -l $(patsubst %.o,%.lst,$@) -t ${MACHINE} -o $@ $<

View file

@ -40,6 +40,13 @@ BAUD_RATE = 300
rs_status: .byte 0 rs_status: .byte 0
; TODO add a state variable that can be monitored by the BASIC WAIT command ; TODO add a state variable that can be monitored by the BASIC WAIT command
; this is load address, for generating PRG files
; works, as long as the code segment comes right after these two bytes
.segment "LOADADDR"
.export LOADADDR
LOADADDR:
.word *+2
; entry points ; entry points
.code .code
; these are convenience entry points right at the beginning of the page, ; these are convenience entry points right at the beginning of the page,

View file

@ -1,6 +1,8 @@
MEMORY { MEMORY {
# $ED-$F7 seems to be an unused area in the zero page according to the BASIC 2.0/4.0 memory map # $ED-$F7 seems to be an unused area in the zero page according to the BASIC 2.0/4.0 memory map
ZP: file = "", define = yes, start = $00ED, size = $000A; ZP: file = "", define = yes, start = $00ED, size = $000A;
# let's create a PRG file - note that you must define this segment in your code
LOADADDR: file = %O, start = $6FFE, size = $0002;
# we're loading at $7000, max code size $800 bytes # we're loading at $7000, max code size $800 bytes
RAM: file = %O, start = $7000, size = $0800; RAM: file = %O, start = $7000, size = $0800;
# if we reside in ROM instead, we should have more space available # if we reside in ROM instead, we should have more space available
@ -10,6 +12,7 @@ MEMORY {
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
# change these two to "ROM" if you want to put them on a ROM chip # change these two to "ROM" if you want to put them on a ROM chip
CODE: load = RAM, type = ro; CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = RAM, type = ro;