From 4badfa381f9fc4d8fa41a7ee4eb096b7a032c344 Mon Sep 17 00:00:00 2001 From: s3lph Date: Mon, 7 Feb 2022 09:41:15 +0100 Subject: [PATCH] Restructure project, build 4K, 8K, 16K and 32K memtest variants --- .gitignore | 5 +-- Makefile | 37 ++++++++++--------- emu6502.c => src/emu6502.c | 2 +- fake6502.c => src/fake6502.c | 0 .../memtest6502.asm | 0 5 files changed, 22 insertions(+), 22 deletions(-) rename emu6502.c => src/emu6502.c (97%) rename fake6502.c => src/fake6502.c (100%) rename memtest-f000.901465.asm => src/memtest6502.asm (100%) diff --git a/.gitignore b/.gitignore index a7389f5..3555515 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ emu6502 -*.o65 -*.bin -*.map \ No newline at end of file +out +tmp \ No newline at end of file diff --git a/Makefile b/Makefile index d01d671..f4a7e07 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,26 @@ -.PHONY: all memtest-f000.901465.bin memtest-f000.901465.o65 ascii memtest-f000.901465+ascii.o65 emu5602 +.PHONY: all memtest6502 emu5602 -all: memtest-f000.901465.bin ascii emu5602 +all: memtest6502 emu5602 clean: - rm -f memtest-f000.901465.bin memtest-f000.901465.o65 memtest-f000.901465.map - rm -f memtest-f000.901465+ascii.bin memtest-f000.901465+ascii.o65 memtest-f000.901465+ascii.map - rm -f emu6502 + rm -rf tmp out -memtest-f000.901465.bin: memtest-f000.901465.o65 - dd if=memtest-f000.901465.o65 bs=1 skip=2 of=memtest-f000.901465.bin +memtest6502: + mkdir -p tmp out + xa '-D_MEMEND=$$8000' -M -A F000 -O PETSCREEN -c -C -v -o tmp/memtest32k-f000.o65 src/memtest6502.asm + dd if=tmp/memtest32k-f000.o65 bs=1 skip=2 of=out/memtest32k-f000.901465.bin + xa '-D_MEMEND=$$4000' -M -A F000 -O PETSCREEN -c -C -v -o tmp/memtest16k-f000.o65 src/memtest6502.asm + dd if=tmp/memtest16k-f000.o65 bs=1 skip=2 of=out/memtest16k-f000.901465.bin + xa '-D_MEMEND=$$2000' -M -A F000 -O PETSCREEN -c -C -v -o tmp/memtest8k-f000.o65 src/memtest6502.asm + dd if=tmp/memtest8k-f000.o65 bs=1 skip=2 of=out/memtest8k-f000.901465.bin + xa '-D_MEMEND=$$1000' -M -A F000 -O PETSCREEN -c -C -v -o tmp/memtest4k-f000.o65 src/memtest6502.asm + dd if=tmp/memtest4k-f000.o65 bs=1 skip=2 of=out/memtest4k-f000.901465.bin + # Test image for the emulator built with ASCII charset instead of PETSCII + xa '-D_MEMEND=$$1000' -M -A F000 -O ASCII -c -C -v -l tmp/memtest4k-f000-ascii.map -o tmp/memtest4k-f000-ascii.o65 src/memtest6502.asm + dd if=tmp/memtest4k-f000-ascii.o65 bs=1 skip=2 of=out/memtest4k-f000-ascii.emu6502.bin -memtest-f000.901465.o65: - xa -M -A F000 -O PETSCREEN -c -C -v -l memtest-f000.901465.map -o memtest-f000.901465.o65 memtest-f000.901465.asm +emu5602: memtest6502 + # _END is set to the address of the last instruction s.t. the emulator knows when to terminate + gcc -D_END=$$(cat tmp/memtest4k-f000-ascii.map | grep ^done, | cut -d, -f2 | tr -d ' ,') -o out/emu6502 src/emu6502.c src/fake6502.c -ascii: memtest-f000.901465+ascii.o65 - dd if=memtest-f000.901465+ascii.o65 bs=1 skip=2 of=memtest-f000.901465+ascii.bin - -memtest-f000.901465+ascii.o65: - xa -M '-D_MEMEND=$$1000' -A F000 -O ASCII -c -C -v -l memtest-f000.901465+ascii.map -o memtest-f000.901465+ascii.o65 memtest-f000.901465.asm - - -emu5602: - gcc -D_END=$$(cat memtest-f000.901465+ascii.map | grep ^done, | cut -d, -f2 | tr -d ' ,') -o emu6502 emu6502.c fake6502.c diff --git a/emu6502.c b/src/emu6502.c similarity index 97% rename from emu6502.c rename to src/emu6502.c index bb93fb6..a831984 100644 --- a/emu6502.c +++ b/src/emu6502.c @@ -67,7 +67,7 @@ int main() { ram = (uint8_t*) malloc(RAMSIZE); screen = (uint8_t*) malloc(0x400); memset(screen, 'X', 0x400); - int ffd = open("memtest-f000.901465+ascii.bin", O_RDONLY); + int ffd = open("out/memtest4k-f000-ascii.emu6502.bin", O_RDONLY); f000 = mmap(0, 0x1000, PROT_READ, MAP_PRIVATE, ffd, 0); reset6502(); diff --git a/fake6502.c b/src/fake6502.c similarity index 100% rename from fake6502.c rename to src/fake6502.c diff --git a/memtest-f000.901465.asm b/src/memtest6502.asm similarity index 100% rename from memtest-f000.901465.asm rename to src/memtest6502.asm