From b7e8b634595445325d10f8fcddcb7d6cdaa8a922 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 3 Aug 2021 20:26:23 +0000 Subject: First attempt at sound --- include/z80_private.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/z80_private.h') diff --git a/include/z80_private.h b/include/z80_private.h index 10cf97e..e0b3381 100644 --- a/include/z80_private.h +++ b/include/z80_private.h @@ -48,6 +48,8 @@ struct Z80Private { Z80Val cycle; + Z80Val timer[Z80_NO_TIMERS]; + int halt; Z80Byte shift; @@ -178,7 +180,13 @@ static inline Z80Word PEEKW(Z80Word addr) #define IS_IX_IY (PRIV->shift==0xdd || PRIV->shift==0xfd) #define OFFSET(off) off=(IS_IX_IY ? (Z80Relative)FETCH_BYTE:0) -#define TSTATE(n) PRIV->cycle+=n +#define TSTATE(n) do \ + { \ + PRIV->cycle+=n; \ + PRIV->timer[Z80_TIMER_1]+=n; \ + PRIV->timer[Z80_TIMER_2]+=n; \ + PRIV->timer[Z80_TIMER_3]+=n; \ + } while(0) #define ADD_R(v) cpu->R=((cpu->R&0x80)|((cpu->R+(v))&0x7f)) #define INC_R ADD_R(1) -- cgit v1.2.3