From 81295d66b59af1ca7cbd91f63c897d6f60b015b6 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 3 Sep 2006 01:15:46 +0000 Subject: Fixed bugs on BIT,RES and SET opcode macros. Fixed serious bug in POKE macro. Changes to GEMMA. --- Makefile | 10 +++++-- gemma.glade | 6 ++-- interface.c | 5 ++-- rundoc | 8 +++--- z80_decode.c | 91 ++++++++++++++++++++++++++++++----------------------------- z80_private.h | 14 +++++---- 6 files changed, 72 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 09d32ab..4ede2a0 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.13 2006-08-30 22:24:41 ianc Exp $ +# $Id: Makefile,v 1.14 2006-09-03 01:15:46 ianc Exp $ # # @@ -95,7 +95,7 @@ emma: $(BASE_O) $(EMMA_O) gemma: $(BASE_O) $(GEMMA_O) cc -o gemma $(BASE_O) $(GEMMA_O) `pkg-config --libs gtk+-2.0` -tests: emucpm.hex zexdoc.hex zexall.hex +tests: emucpm.hex zexdoc.hex zexall.hex test.hex emucpm.hex: emucpm.z80 tpasm -P Z80 -o intel emucpm.hex emucpm.z80 @@ -110,6 +110,12 @@ zexall.hex: zexall.z80 tail +4 _tmp | awk '{printf("%s 0x%s\n",$$2,$$1);}' > zexall.lbl rm -f _tmp +test.hex: test.z80 + tpasm -P Z80 -o intel test.hex test.z80 + +test.z80: + if [ ! -e test.z80 ] ; then touch test.z80 ; fi + clean: rm -f emma gemma $(BASE_O) $(EMMA_O) $(GEMMA_O) core *.hex *.lbl diff --git a/gemma.glade b/gemma.glade index 073a0e5..59201da 100644 --- a/gemma.glade +++ b/gemma.glade @@ -151,7 +151,7 @@ PC - 0 + 3 False False @@ -249,7 +249,7 @@ PC True - Run Until Expression: + Run Until Expression: False False GTK_JUSTIFY_LEFT @@ -257,7 +257,7 @@ PC False 0.5 0.5 - 0 + 8 0 PANGO_ELLIPSIZE_NONE -1 diff --git a/interface.c b/interface.c index ad0defe..425a16b 100644 --- a/interface.c +++ b/interface.c @@ -110,7 +110,7 @@ create_top_window (void) viewmode_check = gtk_check_button_new_with_mnemonic (_("View as Words")); gtk_widget_show (viewmode_check); - gtk_box_pack_start (GTK_BOX (hbox3), viewmode_check, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox3), viewmode_check, FALSE, FALSE, 3); memory_view = gtk_label_new (_("Memory View")); gtk_widget_show (memory_view); @@ -135,9 +135,10 @@ create_top_window (void) gtk_widget_show (hbox4); gtk_box_pack_start (GTK_BOX (vbox4), hbox4, FALSE, TRUE, 0); - label1 = gtk_label_new (_("Run Until Expression: ")); + label1 = gtk_label_new (_("Run Until Expression:")); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox4), label1, FALSE, FALSE, 0); + gtk_misc_set_padding (GTK_MISC (label1), 8, 0); breakpoint_text = gtk_entry_new (); gtk_widget_show (breakpoint_text); diff --git a/rundoc b/rundoc index 3cd0df4..6bbf705 100644 --- a/rundoc +++ b/rundoc @@ -1,7 +1,7 @@ i emucpm.hex i zexdoc.hex D zexdoc.lbl -#s -#r 0x100 -p 0x100 -n +s +r 0x100 +#p 0x100 +#n diff --git a/z80_decode.c b/z80_decode.c index 1433b30..4b6929c 100644 --- a/z80_decode.c +++ b/z80_decode.c @@ -281,7 +281,7 @@ do { \ */ #define RRCA \ do { \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&0xc8)|(cpu->AF.b[HI]&C_Z80); \ + cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]&C_Z80); \ cpu->AF.b[HI]=(cpu->AF.b[HI]>>1)|(cpu->AF.b[HI]<<7); \ SETHIDDEN(cpu->AF.b[HI]); \ } while(0) @@ -291,7 +291,7 @@ do { \ do { \ Z80Byte c; \ c=CARRY; \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&0xc8)|(cpu->AF.b[HI]&C_Z80); \ + cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]&C_Z80); \ cpu->AF.b[HI]=(cpu->AF.b[HI]>>1)|(c<<7); \ SETHIDDEN(cpu->AF.b[HI]); \ } while(0) @@ -319,7 +319,7 @@ do { \ #define RLCA \ do { \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&0xc8)|(cpu->AF.b[HI]>>7); \ + cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]>>7); \ cpu->AF.b[HI]=(cpu->AF.b[HI]<<1)|(cpu->AF.b[HI]>>7); \ SETHIDDEN(cpu->AF.b[HI]); \ } while(0) @@ -329,7 +329,7 @@ do { \ do { \ Z80Byte c; \ c=CARRY; \ - cpu->AF.b[LO]=(cpu->AF.b[LO]&0xc8)|(cpu->AF.b[HI]>>7); \ + cpu->AF.b[LO]=(cpu->AF.b[LO]&(S_Z80|Z_Z80|P_Z80))|(cpu->AF.b[HI]>>7); \ cpu->AF.b[HI]=(cpu->AF.b[HI]<<1)|c; \ SETHIDDEN(cpu->AF.b[HI]); \ } while(0) @@ -424,20 +424,21 @@ do { \ #define BIT(REG,B) \ do { \ cpu->AF.b[LO]=CARRY|H_Z80; \ - if ((REG)&&(1<AF.b[LO]|=S_Z80; \ - if (B==5) cpu->AF.b[LO]|=B5_Z80; \ - if (B==3) cpu->AF.b[LO]|=B3_Z80; \ + cpu->AF.b[LO]|=Z_Z80; \ + cpu->AF.b[LO]|=P_Z80; \ } \ else \ { \ - cpu->AF.b[LO]|=Z_Z80; \ - cpu->AF.b[LO]|=P_Z80; \ + if (B==7) cpu->AF.b[LO]|=S_Z80; \ + if (B==5) cpu->AF.b[LO]|=B5_Z80; \ + if (B==3) cpu->AF.b[LO]|=B3_Z80; \ } \ } while(0) -#define RES CLR +#define BIT_SET(REG,B) (REG)|=(1<memctrl[(addr)/256]) \ + Z80Word ba=addr; \ + Z80Word bv=val; \ + if (cpu->memctrl[(ba)/256]) \ { \ - cpu->memory[addr]=val; \ + cpu->memory[ba]=bv; \ } \ } while (0) #define POKEW(addr,val) do \ { \ - Z80Word once=val; \ - Z80Word once_addr=addr; \ - POKE(once_addr,once); \ - POKE(once_addr+1,once>>8); \ + Z80Word wa=addr; \ + Z80Word wv=val; \ + POKE(wa,wv); \ + POKE(wa+1,wv>>8); \ } while(0) #define FETCH_BYTE (cpu->memory[cpu->PC++]) -- cgit v1.2.3