diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index d15beae..0000000 --- a/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -* text=auto -*.js text -*.css text -*.html text diff --git a/Makefile b/Makefile index 75b6ca7..557bced 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ OBJS=perfect6502.o netlist_sim.o -OBJS+=cbmbasic.o runtime.o runtime_init.o plugin.o console.o emu.o +OBJS+=cbmbasic/cbmbasic.o cbmbasic/runtime.o cbmbasic/runtime_init.o cbmbasic/plugin.o cbmbasic/console.o cbmbasic/emu.o #OBJS+=measure.o CFLAGS=-Werror -Wall -O3 -CC=clang +CC=cc all: cbmbasic cbmbasic: $(OBJS) - $(CC) -o cbmbasic $(OBJS) + $(CC) -o cbmbasic/cbmbasic $(OBJS) clean: - rm -f $(OBJS) cbmbasic + rm -f $(OBJS) cbmbasic/cbmbasic diff --git a/Makefile.apple1basic b/Makefile.apple1basic index c9a99e3..0db8ead 100644 --- a/Makefile.apple1basic +++ b/Makefile.apple1basic @@ -1,6 +1,6 @@ -OBJS=perfect6502.o apple1basic.o +OBJS=perfect6502.o apple1basic/apple1basic.o CFLAGS=-Werror -Wall -O3 -CC=clang +CC=cc all: apple1basic diff --git a/README.md b/README.md index 8751f00..53af6af 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Consequently, *perfect6502* is * *perfect*: It is not a reimplementation of the 6502, but a simulation of the original transistors. Its complete behavior, its internal state and its outputs are half-cycle exact. -* *slow*: Even though *perfect6502* is highly optimized C code, achieves only 1/150 of the speed of a 1 MHz 6502 on a high-end CPU of 2014. +* *slow*: Even though *perfect6502* is highly optimized C code, achieves only 1/30 of the speed of a 1 MHz 6502 on a high-end CPU of 2020. *perfect6502* is useful for * understanding and reverse engineering the 6502 @@ -20,7 +20,7 @@ You can compile the project with and run it with - $ ./cbmbasic + $ cbmbasic/cbmbasic You should get the following output: @@ -30,6 +30,10 @@ You should get the following output: READY. +## Benchmarking + +You can use the UNIX `time` tool to measure the performance of the emulator. Run `time cbmbasic/cbmbasic` and press Ctrl+C once it has reached `READY.` – the "user" time is the effective time that was required to reach character input. On a 1 MHz 6502, this takes 0.05 sec. + # Credits *perfect6502* is is written by [Michael Steil](http://www.pagetable.com/) and derived from the JavaScript [visual6502](https://github.com/trebonian/visual6502) implementation by Greg James, Brian Silverman and Barry Silverman. diff --git a/apple1basic.bin b/apple1basic/apple1basic.bin similarity index 100% rename from apple1basic.bin rename to apple1basic/apple1basic.bin diff --git a/apple1basic.c b/apple1basic/apple1basic.c similarity index 98% rename from apple1basic.c rename to apple1basic/apple1basic.c index 31759c1..409b91e 100644 --- a/apple1basic.c +++ b/apple1basic/apple1basic.c @@ -2,7 +2,7 @@ #ifndef _WIN32 #include -#include "perfect6502.h" +#include "../perfect6502.h" /************************************************************ * diff --git a/cbmbasic.bin b/cbmbasic/cbmbasic.bin similarity index 100% rename from cbmbasic.bin rename to cbmbasic/cbmbasic.bin diff --git a/cbmbasic.c b/cbmbasic/cbmbasic.c similarity index 92% rename from cbmbasic.c rename to cbmbasic/cbmbasic.c index 6b42d3c..95bd0a7 100644 --- a/cbmbasic.c +++ b/cbmbasic/cbmbasic.c @@ -1,4 +1,4 @@ -#include "perfect6502.h" +#include "../perfect6502.h" #include "runtime.h" #include "runtime_init.h" diff --git a/console.c b/cbmbasic/console.c similarity index 100% rename from console.c rename to cbmbasic/console.c diff --git a/console.h b/cbmbasic/console.h similarity index 100% rename from console.h rename to cbmbasic/console.h diff --git a/emu.c b/cbmbasic/emu.c similarity index 100% rename from emu.c rename to cbmbasic/emu.c diff --git a/glue.h b/cbmbasic/glue.h similarity index 100% rename from glue.h rename to cbmbasic/glue.h diff --git a/plugin.c b/cbmbasic/plugin.c similarity index 100% rename from plugin.c rename to cbmbasic/plugin.c diff --git a/plugin.h b/cbmbasic/plugin.h similarity index 100% rename from plugin.h rename to cbmbasic/plugin.h diff --git a/readdir.c b/cbmbasic/readdir.c similarity index 100% rename from readdir.c rename to cbmbasic/readdir.c diff --git a/readdir.h b/cbmbasic/readdir.h similarity index 100% rename from readdir.h rename to cbmbasic/readdir.h diff --git a/runtime.c b/cbmbasic/runtime.c similarity index 100% rename from runtime.c rename to cbmbasic/runtime.c diff --git a/runtime.h b/cbmbasic/runtime.h similarity index 100% rename from runtime.h rename to cbmbasic/runtime.h diff --git a/runtime_init.c b/cbmbasic/runtime_init.c similarity index 97% rename from runtime_init.c rename to cbmbasic/runtime_init.c index b8fc0f6..d17fa49 100644 --- a/runtime_init.c +++ b/cbmbasic/runtime_init.c @@ -1,6 +1,6 @@ #include -#include "perfect6502.h" +#include "../perfect6502.h" /* XXX hook up memory[] with RAM[] in runtime.c */ /************************************************************ @@ -20,7 +20,7 @@ void init_monitor() { FILE *f; - f = fopen("cbmbasic.bin", "r"); + f = fopen("cbmbasic/cbmbasic.bin", "r"); fread(memory + 0xA000, 1, 17591, f); fclose(f); diff --git a/runtime_init.h b/cbmbasic/runtime_init.h similarity index 100% rename from runtime_init.h rename to cbmbasic/runtime_init.h diff --git a/stat.h b/cbmbasic/stat.h similarity index 100% rename from stat.h rename to cbmbasic/stat.h diff --git a/netlist_sim.c b/netlist_sim.c index 07cbc12..3cca57a 100644 --- a/netlist_sim.c +++ b/netlist_sim.c @@ -42,7 +42,7 @@ typedef uint16_t count_t; * ************************************************************/ -#if 0 /* faster on 64 bit CPUs */ +#if 1 /* faster on 64 bit CPUs */ typedef unsigned long long bitmap_t; #define BITMAP_SHIFT 6 #define BITMAP_MASK 63