OSDN Git Service

[VM][FM7] keyboard.cpp : Add implementation ofd RTC, includes within keyboard.
[csp-qt/common_source_project-fm7.git] / source / src / vm / m6502.h
1 /*
2         Skelton for retropc emulator
3
4         Origin : MAME
5         Author : Takeda.Toshiya
6         Date   : 2010.08.10-
7
8         [ M6502 ]
9 */
10
11 #ifndef _M6502_H_ 
12 #define _M6502_H_
13
14 #include "vm.h"
15 #include "../emu.h"
16 #include "device.h"
17
18 #define SIG_M6502_OVERFLOW      0
19
20 class M6502 : public DEVICE
21 {
22 private:
23         DEVICE *d_mem, *d_pic;
24         
25         pair pc, sp, zp, ea;
26         uint16 prev_pc;
27         uint8 a, x, y, p;
28         bool pending_irq, after_cli;
29         bool nmi_state, irq_state, so_state;
30         int icount;
31         bool busreq;
32         
33         void run_one_opecode();
34         void OP(uint8 code);
35         void update_irq();
36         
37 public:
38         M6502(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
39         {
40                 busreq = false;
41         }
42         ~M6502() {}
43         
44         // common functions
45         void initialize();
46         void reset();
47         int run(int clock);
48         void write_signal(int id, uint32 data, uint32 mask);
49         void set_intr_line(bool line, bool pending, uint32 bit)
50         {
51                 write_signal(SIG_CPU_IRQ, line ? 1 : 0, 1);
52         }
53         uint32 get_pc()
54         {
55                 return prev_pc;
56         }
57         
58         void save_state(FILEIO* state_fio);
59         bool load_state(FILEIO* state_fio);
60         // unique functions
61         void set_context_mem(DEVICE* device)
62         {
63                 d_mem = device;
64         }
65         void set_context_intr(DEVICE* device)
66         {
67                 d_pic = device;
68         }
69 };
70
71 #endif
72