Add rule for making VM ROM
This commit is contained in:
parent
422769d7d9
commit
b0baaafa21
8
Makefile
8
Makefile
|
@ -24,8 +24,6 @@ disass: CFLAGS += -DTRACE -lreadline
|
||||||
disass: bin/disass.o bin/vm.o
|
disass: bin/disass.o bin/vm.o
|
||||||
$(CC) $(CFLAGS) -o bin/$@ $^
|
$(CC) $(CFLAGS) -o bin/$@ $^
|
||||||
|
|
||||||
# TODO: add rule to make rom.h
|
|
||||||
|
|
||||||
bin/%.o: src/%.c
|
bin/%.o: src/%.c
|
||||||
$(CC) $(CFLAGS) -o $@ -c $^
|
$(CC) $(CFLAGS) -o $@ -c $^
|
||||||
|
|
||||||
|
@ -33,6 +31,12 @@ bin/vm.o:
|
||||||
bin/main.o:
|
bin/main.o:
|
||||||
bin/disass.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
|
hard: bin/main.o bin/vm.o
|
||||||
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
|
$(CC) $(CFLAGS) -o bin/$@$(TRACE_SUFFIX) $^
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ int main()
|
||||||
if (memory == NULL)
|
if (memory == NULL)
|
||||||
perror("Failed to allocate memory. Aborting...");
|
perror("Failed to allocate memory. Aborting...");
|
||||||
|
|
||||||
// __src_rom_bin* comes from "rom.h", generated by make from rom.bin
|
// src_rom_bin* comes from "rom.h", generated by make from rom.bin
|
||||||
vm_init(&cpu, memory, __src_rom_bin, __src_rom_bin_len);
|
vm_init(&cpu, memory, src_rom_bin, src_rom_bin_len);
|
||||||
printf("Fill in the rest of the flag: RS{");
|
printf("Fill in the rest of the flag: RS{");
|
||||||
fgets(flag_input, 20, stdin);
|
fgets(flag_input, 20, stdin);
|
||||||
flag_input[strcspn(flag_input, "\n")] = 0; // trim trailing newline
|
flag_input[strcspn(flag_input, "\n")] = 0; // trim trailing newline
|
||||||
|
|
|
@ -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,
|
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,
|
0xff, 0x0d, 0xcb, 0x02, 0x01, 0xcb, 0x02, 0x40, 0x77, 0x12, 0x00, 0x00,
|
||||||
0x00, 0x30, 0x30, 0x30
|
0x00, 0x30, 0x30, 0x30
|
||||||
};
|
};
|
||||||
unsigned int __src_rom_bin_len = 1120;
|
unsigned int src_rom_bin_len = 1120;
|
||||||
|
|
Loading…
Reference in New Issue