From 70bc8883020a2da4326439a8308513a7385dc568 Mon Sep 17 00:00:00 2001 From: Duncan Smith Date: Mon, 6 Sep 2010 18:09:29 -0700 Subject: Fixes to actually run code This is the version to run the first (trivial) infinite loop correctly. I hacked up the loader slightly to replace one of the (nonexistent) pages with a static byte array. z80 code executed: $4000: JP $4000 4000 c3 40 00 4003 This version also draws the opcode executed on the screen, to aid in debugging the emulator: move.b d0,$4c00+32*(128/8) Also, it turns out that I was mixing up the emulated SP (a4) and emulated PC (a6). That has been fixed. Further, it seems that movea defaults to a word operation in a68k. This led to pointer corruption, which has been fixed. --- loader.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'loader.c') diff --git a/loader.c b/loader.c index 56561c0..97f2d4c 100644 --- a/loader.c +++ b/loader.c @@ -8,9 +8,11 @@ #include #include "asm_vars.h" +#include "680.h" + HANDLE page_handles[256]; -char infloop[16] = { 0xc3, 0, 0, 0 }; +char infloop[16] = { 0xC3, 0x40, 0, 0, 0, 0 }; void init_load(void); void *deref_page(int); @@ -55,7 +57,8 @@ void init_load(void) mem_page_0 = pages[0]; mem_page_loc_0 = 0; - mem_page_1 = pages[0x1f]; +// mem_page_1 = pages[0x1f]; + mem_page_1 = infloop; mem_page_loc_1 = 0x1f; mem_page_2 = pages[0]; mem_page_loc_2 = 0; -- cgit v1.2.3