libsidplayfp  0.3.5
sid6510c.h
1 /***************************************************************************
2  sid6510c.h - Special MOS6510 to be fully
3  compatible with sidplay
4  -------------------
5  begin : Thu May 11 2000
6  copyright : (C) 2000 by Simon White
7  email : s_a_white@email.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 /***************************************************************************
19  * $Log: sid6510c.h,v $
20  * Revision 1.19 2003/01/23 19:52:42 s_a_white
21  * Redundent code removal.
22  *
23  * Revision 1.18 2003/01/20 18:37:08 s_a_white
24  * Stealing update. Apparently the cpu does a memory read from any non
25  * write cycle (whether it needs to or not) resulting in those cycles
26  * being stolen.
27  *
28  * Revision 1.17 2003/01/17 08:44:22 s_a_white
29  * Better handling the operation of IRQs during stolen cycles.
30  *
31  * Revision 1.16 2002/11/25 21:07:32 s_a_white
32  * Allow setting of program counter on reset.
33  *
34  * Revision 1.15 2002/11/21 19:52:48 s_a_white
35  * CPU upgraded to be like other components. Theres nolonger a clock call,
36  * instead events are registered to occur at a specific time.
37  *
38  * Revision 1.14 2002/11/19 22:56:25 s_a_white
39  * Sidplay1 modes modified to make them nolonger require the psid driver.
40  *
41  * Revision 1.13 2002/11/01 17:35:27 s_a_white
42  * Frame based support for old sidplay1 modes.
43  *
44  * Revision 1.12 2002/03/12 18:47:13 s_a_white
45  * Made IRQ in sidplay1 compatibility modes behaves like JSR. This fixes tunes
46  * that have kernel switched out.
47  *
48  * Revision 1.11 2002/02/07 18:02:10 s_a_white
49  * Real C64 compatibility fixes. Debug of BRK works again. Fixed illegal
50  * instructions to work like sidplay1.
51  *
52  * Revision 1.10 2002/02/04 23:53:23 s_a_white
53  * Improved compatibilty of older sidplay1 modes. Fixed BRK to work like sidplay1
54  * only when stack is 0xff in real mode for better compatibility with C64.
55  *
56  * Revision 1.9 2001/09/01 11:08:06 s_a_white
57  * Fixes for sidplay1 environment modes.
58  *
59  * Revision 1.8 2001/07/14 13:18:15 s_a_white
60  * Stack & PC invalid tests now only performed on a BRK.
61  *
62  * Revision 1.7 2001/03/24 18:09:17 s_a_white
63  * On entry to interrupt routine the first instruction in the handler is now always
64  * executed before pending interrupts are re-checked.
65  *
66  * Revision 1.6 2001/03/22 22:40:07 s_a_white
67  * Replaced tabs characters.
68  *
69  * Revision 1.5 2001/03/21 22:26:13 s_a_white
70  * Fake interrupts now been moved into here from player.cpp. At anytime it's
71  * now possible to ditch this compatibility class and use the real thing.
72  *
73  * Revision 1.4 2001/03/09 22:28:03 s_a_white
74  * Speed optimisation update.
75  *
76  * Revision 1.3 2001/02/13 21:02:25 s_a_white
77  * Small tidy up and possibly a small performace increase.
78  *
79  * Revision 1.2 2000/12/11 19:04:32 s_a_white
80  * AC99 Update.
81  *
82  ***************************************************************************/
83 
84 #ifndef _sid6510c_h_
85 #define _sid6510c_h_
86 
87 #include "mos6510c.h"
88 #include "sidplayfp/sid2types.h"
89 
90 class SID6510: public MOS6510
91 {
92 private:
93  // Sidplay Specials
94  event_clock_t m_stealingClk;
95  event_clock_t m_delayClk;
96  sid2_env_t m_mode;
97  bool m_framelock;
98  bool m_sleeping;
99 
100 private:
101  void hackTable();
102  void unhackTable();
103 
104 public:
105  SID6510 (EventContext *context);
106 
107  // Standard Functions
108  void reset (void);
109  void reset (uint_least16_t pc, uint8_t a, uint8_t x, uint8_t y);
110 
111  void environment (const sid2_env_t mode);
112  void triggerRST (void);
113  void triggerIRQ (void);
114  void sleep (void);
115 
116 protected:
117  void FetchOpcode (void);
118 
119 private:
120  struct ProcessorCycle delayCycle;
121 
122  inline void sid_illegal (void);
123  inline void sid_delay (void);
124  inline void sid_brk (void);
125  inline void sid_jmp (void);
126  inline void sid_rts (void);
127  inline void sid_cli (void);
128  inline void sid_rti (void);
129  inline void sid_irq (void);
130 };
131 
132 #endif // _sid6510c_h_