summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LINKS8
-rw-r--r--doc/MINIMAL.650249
-rw-r--r--emu/6522.h1
-rw-r--r--emu/emul.c19
4 files changed, 77 insertions, 0 deletions
diff --git a/LINKS b/LINKS
index 7f1a915..e312378 100644
--- a/LINKS
+++ b/LINKS
@@ -120,6 +120,10 @@ https://github.com/davepoo/6502Emulator
https://github.com/spacerace/6502
https://www.masswerk.at/products.php
+other minimal PC projects
+https://github.com/slu4coder/Minimalistic-8-Bit-CPU
+https://www.youtube.com/channel/UCXYQcMpUBT3aaQKfmAVJNow
+
other emulators:
https://github.com/pdewacht/oberon-risc-emu (RISC-5 Wirth Emulator, as inspiration)
@@ -149,3 +153,7 @@ https://github.com/vndmtrx/check-cmake-example
cmake:
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
+
+languages for 6502:
+https://dwheeler.com/6502/
+http://cowlark.com/cowgol/
diff --git a/doc/MINIMAL.6502 b/doc/MINIMAL.6502
new file mode 100644
index 0000000..ae2044d
--- /dev/null
+++ b/doc/MINIMAL.6502
@@ -0,0 +1,49 @@
+Immediate ADI
+Absolute ADA
+Relative ADR
+
+little endian
+
+lda
+sta
+clr
+neg
+inc
+dec
+cpi
+adc
+sbc
+jmp
+jsr
+
+nop
+clc
+sec
+not
+lsl
+rol
+lsr
+ror
+asr
+rts
+phs
+pls
+
+
+rel
+word at abs adr
+SP+rel
+
+bran
+
+no interrups, but win/out
+
+0x7fff 255 byte stack (instead of 0x100 to 0x1ff on 6502)
+
+sts/lds store relative to stack
+function calls with parameters
+
+XXW codes, acting on 16-bit words
+
+WIN, OUT as shortcurs, not really necessary
+relative addressing for jumps would help to write relocatable code by hand
diff --git a/emu/6522.h b/emu/6522.h
index d3bade7..27e191c 100644
--- a/emu/6522.h
+++ b/emu/6522.h
@@ -38,6 +38,7 @@ typedef struct via_6522_t
uint8_t ddrb;
uint8_t pcr;
uint8_t ier;
+ uint8_t ifr;
bool debug;
diff --git a/emu/emul.c b/emu/emul.c
index 21ab58b..7086737 100644
--- a/emu/emul.c
+++ b/emu/emul.c
@@ -81,6 +81,7 @@ static void print_help( void )
"(f) fini (continue to next rts)\n"
"(c) for continue running\n"
"(b) break to single stepping\n"
+ "(d) toggle debug output\n"
"(+) speed up\n"
"(-) speed down\n"
"(p) push the button\n"
@@ -124,6 +125,19 @@ void emul_run( emul_t *emul, int nof_steps )
case SDLK_s:
cpu_6502_run_steps( emul->cpu, 1 );
break;
+ case SDLK_d:
+ if( emul->speed < 250 ) {
+ emul->debug = !emul->debug;
+ fprintf( stderr, "debug mode is %s\n", ( emul->debug) ? "on" : "off" );
+ if( emul->debug ) {
+ emul->cpu->debug_flags |= DEBUG_STATUS;
+ } else {
+ emul->cpu->debug_flags &= ~DEBUG_STATUS;
+ }
+ } else {
+ fprintf( stderr, "enabling debug mode now not possible, CPU is too fast!\n" );
+ }
+ break;
case SDLK_EQUALS:
case SDLK_KP_EQUALS:
case SDLK_PLUS:
@@ -133,6 +147,11 @@ void emul_run( emul_t *emul, int nof_steps )
emul->speed = CPU_FREQUENCY;
}
fprintf( stderr, "CPU speed is %1.6f MHz now\n", ( (double)emul->speed / 1000000 ) );
+ if( emul->speed > 250 ) {
+ emul->debug = false;
+ emul->cpu->debug_flags &= ~DEBUG_STATUS;;
+ fprintf( stderr, "disabling debug mode because the CPU is too fast now!\n" );
+ }
break;
case SDLK_MINUS:
case SDLK_KP_MINUS: