Add rule for making VM ROM

This commit is contained in:
Horseshoe Crab 2021-04-27 03:16:20 -04:00
parent 422769d7d9
commit b0baaafa21
3 changed files with 10 additions and 6 deletions

View File

@ -24,8 +24,6 @@ disass: CFLAGS += -DTRACE -lreadline
disass: bin/disass.o bin/vm.o
$(CC) $(CFLAGS) -o bin/$@ $^
# TODO: add rule to make rom.h
bin/%.o: src/%.c
$(CC) $(CFLAGS) -o $@ -c $^
@ -33,6 +31,12 @@ bin/vm.o:
bin/main.o:
bin/disass.o:
rom: rom.bin
xxd -i src/$^ > src/$@.h
rom.bin: src/rom.asm src/zeropage.incbin
./ass.sh src/rom.asm src/zeropage.incbin
hard: bin/main.o bin/vm.o
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^

View File

@ -23,8 +23,8 @@ int main()
if (memory == NULL)
perror("Failed to allocate memory. Aborting...");
// __src_rom_bin* comes from "rom.h", generated by make from rom.bin
vm_init(&cpu, memory, __src_rom_bin, __src_rom_bin_len);
// src_rom_bin* comes from "rom.h", generated by make from rom.bin
vm_init(&cpu, memory, src_rom_bin, src_rom_bin_len);
printf("Fill in the rest of the flag: RS{");
fgets(flag_input, 20, stdin);
flag_input[strcspn(flag_input, "\n")] = 0; // trim trailing newline

View File

@ -1,4 +1,4 @@
unsigned char __src_rom_bin[] = {
unsigned char src_rom_bin[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -94,4 +94,4 @@ unsigned char __src_rom_bin[] = {
0xff, 0x0d, 0xcb, 0x02, 0x01, 0xcb, 0x02, 0x40, 0x77, 0x12, 0x00, 0x00,
0x00, 0x30, 0x30, 0x30
};
unsigned int __src_rom_bin_len = 1120;
unsigned int src_rom_bin_len = 1120;