add 6502 CPU emu

This commit is contained in:
Thomas Bernard
2019-11-23 16:46:39 +01:00
parent 317239c9cf
commit 6d69200bc3
5 changed files with 144 additions and 1 deletions

26
3rdparty/6502-illegal-opcode.patch vendored Normal file
View File

@@ -0,0 +1,26 @@
commit 800f1f7b0393d61fb03aad776e79e8f801014512
Author: Thomas Bernard <miniupnp@free.fr>
Date: Sat Nov 23 16:32:04 2019 +0100
silent "unused parameter" warning
6502.c:379:53: warning: unused parameter 'object' [-Wunused-parameter]
379 | #define INSTRUCTION(name) static zuint8 name(M6502 *object)
| ~~~~~~~^~~~~~
6502.c:766:1: note: in expansion of macro 'INSTRUCTION'
766 | INSTRUCTION(illegal) {return 2;}
| ^~~~~~~~~~~
diff --git a/sources/6502.c b/sources/6502.c
index 9a95cf0..6b8f8d5 100644
--- a/sources/6502.c
+++ b/sources/6502.c
@@ -763,7 +763,7 @@ INSTRUCTION(brk)
}
-INSTRUCTION(illegal) {return 2;}
+INSTRUCTION(illegal) {(void)object; return 2;}
/* MARK: - Instruction Function Table */

21
3rdparty/Makefile vendored
View File

@@ -129,6 +129,12 @@ RECOILARCH=$(RECOIL).tar.gz
RECOILURL=https://downloads.sourceforge.net/project/recoil/recoil/$(RECOILVER)/$(RECOILARCH)
RECOILURLALT=http://nanard.free.fr/grafx2/$(RECOILARCH)
RECOILSHA256=b9691db9e0d2b6cec23c9dec8628ecf6870f1e9d34ce95513fb4a671d781b19c
#https://github.com/redcode/6502/releases/download/v0.1/6502-v0.1.tar.xz
REDCODE6502=6502-v0.1
REDCODE6502ARCH=6502-v0.1.tar.xz
REDCODE6502URL=https://github.com/redcode/6502/releases/download/v0.1/$(REDCODE6502ARCH)
REDCODE6502SHA256=bba50f327163d40b1014f5affc8042137f37b200dae50a4f0fe56b5769b3940f
REDCODE6502PATCHES = 6502-illegal-opcode.patch
ARCHIVES = $(addprefix archives/, $(SDLARCH) $(SDLIMAGEARCH) $(SDLTTFARCH) \
$(SDL2ARCH) $(SDL2IMAGEARCH) $(SDL2TTFARCH) $(LIBPNGARCH) \
@@ -604,17 +610,30 @@ endif
recoil: $(RECOIL)/.ok
$(CP) $(RECOIL)/README ../doc/README-recoil.txt
6502: 6502/.ok
$(CP) 6502/README ../doc/README-6502.txt
6502/.ok: archives/$(REDCODE6502ARCH)
$(TAR) xJf $<
cd $(@D) ; for p in $(REDCODE6502PATCHES) ; do echo "applying $$p" ; patch -p1 < ../$$p ; done
touch $@
# generic rule to unpack tarball and apply patches
%/.ok: archives/%.tar.gz
$(TAR) xzf $<
cd $(@D) ; for p in $($(shell echo $* | cut -d- -f1 | tr a-z A-Z | tr -d _)PATCHES) ; do echo "applying $$p" ; patch -p1 < ../$$p ; done
touch $@
# the following archive name won't work with the generic rule
# the following archive names won't work with the generic rule
archives/$(JPEGARCH):
@$(MKDIR) $(@D)
cd $(@D) && $(GETURL) $(JPEGURL)
archives/$(REDCODE6502ARCH):
@$(MKDIR) $(@D)
cd $(@D) && $(GETURL) $(REDCODE6502URL)
@[ "`$(SHA256CMD) < $@`" = "$(REDCODE6502SHA256)" ] || ( $(RM) $@ && echo "$@ SHA256 mismatch !" && false )
# generic rule to download tarballs
archives/%.tar.gz:
@$(MKDIR) $(@D)