diff --git a/MEMORY_MAP.txt b/MEMORY_MAP.txt new file mode 100644 index 0000000..c97534d --- /dev/null +++ b/MEMORY_MAP.txt @@ -0,0 +1,3 @@ +$0000-$00FF - Zero Page +$0100-$7FFF - User Ram +$8000-$8FFF - Scratch Memory diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c0480b4 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +# uBix-Retro + +MAKE=make + +all: emu kernel + +kernel: + ./tools/vasm/vasm6502_madmac ./src/kernel.s -o ./build/kernel -Fbin + +emu: + cd src/emu; make + +clean: + cd src/emu; make clean diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 0000000..9b881fb --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,2 @@ +kernel +6502 diff --git a/src/emu/Makefile b/src/emu/Makefile new file mode 100644 index 0000000..341dedc --- /dev/null +++ b/src/emu/Makefile @@ -0,0 +1,45 @@ +# uBix-Retro Emulator + + +#Linker +LD = ld + +#Binary File Name +BINARY = 6502 + +#Delete Program +REMOVE = rm -f + +#Objects +OBJS = fake6502.o main.o + +#Includes +INCLUDES = -I./include + +# Link The Binary +$(BINARY) : $(OBJS) + $(CC) $(CFLAGS) -o ../../build/$@ $(OBJS) + #strip $(BINARY) + +# Compile the source files +.cpp.o: + $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + +.cc.o: + $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + +.cc.s: + $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< + +.c.o: + $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + +.c.s: + $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< + +.S.o: + $(CC) -Wall $(CLFAGS) $(INCLUDES) -c -o $@ $< + +# Clean Up The junk +clean: + $(REMOVE) $(OBJS) ${BUILD_DIR}/bin/$(BINARY) diff --git a/src/emu/main.c b/src/emu/main.c index 25d547d..f651aa6 100644 --- a/src/emu/main.c +++ b/src/emu/main.c @@ -7,7 +7,7 @@ #include "fake6502.h" -#define ROM "./test.o" +#define ROM "./build/kernel" uint8_t *ram; diff --git a/src/kernel.s b/src/kernel.s new file mode 100644 index 0000000..70f4357 --- /dev/null +++ b/src/kernel.s @@ -0,0 +1,48 @@ +.org $0 +; Zero Page +.org $0100 +; User Ram +.org $8000 + +RESET: + cld + ldx $FF + lda $35 + txs + + +NMI: + nop + +IRQ: + nop + + +print2: +print: + lda $4000,x + cmp $FF + beq loop + jsr print_char + sta $3000 + +loop: + jsr loop2 + sta $7000 + lda #$BE + jmp print2 + +loop2: + sta $5000 + rts + +print_char: + sta $6000 + rts + + +; 6502 Vextor +.org $FFFA +.dc.w NMI ; NMI +.dc.w RESET ; RESET +.dc.w IRQ ; IRQ diff --git a/src/test.s b/src/test.s deleted file mode 100644 index d59f301..0000000 --- a/src/test.s +++ /dev/null @@ -1,32 +0,0 @@ - .org $0 - .org $8000 -reset: - cld - ldx #$FF - txs -print2: -print: - lda $4000,x - cmp $FF - beq loop - jsr print_char - sta $3000 - -loop: - jsr loop2 - sta $7000 - lda #$BE - jmp print2 - -loop2: - sta $5000 - rts - -print_char: - sta $6000 - rts - -.org $FFFA -.dc.w loop -.dc.w reset -.dc.w print_char