summaryrefslogtreecommitdiff
path: root/src/z80_private.h
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2026-06-29 09:41:42 +0900
committerIan C <ianc@noddybox.co.uk>2026-06-29 09:41:42 +0900
commitc527acfc79f3bda8cfe13a7b51b0b16a32683960 (patch)
treee5bbd119a070848301a03b52f1232a797b35c119 /src/z80_private.h
parentc31b779c20638ce25f11489c445a53798a663b13 (diff)
First partial working attempt at sound. Producing output, but very distorted
Diffstat (limited to 'src/z80_private.h')
-rw-r--r--src/z80_private.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/z80_private.h b/src/z80_private.h
index 628e23d..b015d6f 100644
--- a/src/z80_private.h
+++ b/src/z80_private.h
@@ -96,6 +96,8 @@ struct Z80
Z80Callback callback[eZ80_NO_CALLBACK][MAX_PER_CALLBACK];
int last_cb;
+
+ Z80Val timer[3];
};
@@ -159,7 +161,13 @@ struct Z80
#define IS_IX_IY (cpu->shift==0xdd || cpu->shift==0xfd)
#define OFFSET(off) off=(IS_IX_IY ? (Z80Relative)FETCH_BYTE:0)
-#define TSTATE(n) cpu->cycle+=n
+#define TSTATE(n) do \
+ { \
+ cpu->cycle+=n; \
+ cpu->timer[eZ80_Timer_1]+=n; \
+ cpu->timer[eZ80_Timer_2]+=n; \
+ cpu->timer[eZ80_Timer_3]+=n; \
+ } while(0)
#define ADD_R(v) cpu->R=((cpu->R&0x80)|((cpu->R+(v))&0x7f))
#define INC_R ADD_R(1)