summaryrefslogtreecommitdiff
path: root/z80_private.h
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-09-03 01:15:46 +0000
committerIan C <ianc@noddybox.co.uk>2006-09-03 01:15:46 +0000
commit81295d66b59af1ca7cbd91f63c897d6f60b015b6 (patch)
treecd74a6e04e86f21a4966d884a7cd0cb779189fad /z80_private.h
parent37141ac197eaefeae9dada0bcc1c429ff584df44 (diff)
Fixed bugs on BIT,RES and SET opcode macros. Fixed serious bug in POKE
macro. Changes to GEMMA.
Diffstat (limited to 'z80_private.h')
-rw-r--r--z80_private.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/z80_private.h b/z80_private.h
index c10b15f..58b9584 100644
--- a/z80_private.h
+++ b/z80_private.h
@@ -146,17 +146,19 @@ struct Z80
#define POKE(addr,val) do \
{ \
- if (cpu->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++])