OSDN Git Service

[VM][STATE][WIP] Apply csp_state_utils:: to some VMs.This is WIP.
[csp-qt/common_source_project-fm7.git] / source / src / vm / am9511.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Origin : Xep128
6         Date   : 2017.05.09-
7
8         [ AM9511 ]
9 */
10
11 #ifndef _AM9511_H_
12 #define _AM9511_H_
13
14 //#include "vm.h"
15 //#include "../emu.h"
16 #include "device.h"
17
18 class AM9511 : public DEVICE
19 {
20 private:
21         uint8_t _apu_stack[16];
22         int _apu_tos;
23         uint8_t _apu_status;
24         int register_id;
25
26         double _APU_CLOCK;
27         
28         void apu_reset ( void );
29         uint8_t apu_read_status( void );
30         void _apu_move( int n);
31         uint8_t _apu_look8(int depth);
32         uint8_t _apu_pop8();
33         uint8_t apu_read_data();
34         void _apu_push8(uint8_t data);
35         void apu_write_data(uint8_t data);
36         int  _apu_pop_fix16(void);
37         void _apu_push_fix16(int data);
38         int64_t _apu_pop_fix32(void);
39         void _apu_push_fix32(int64_t data);
40         double _apu_pop_float();
41         void _apu_push_float(double data);
42         void  _apu_sz_fix16(void);
43         void _apu_sz_fix32(void);
44         void _apu_sz_float(void);
45         void _apu_xchg(int d1, int d2);
46         void _apu_copy(int from, int to);
47         void _apu_carry ( int64_t val, int64_t limit );
48         void apu_write_command ( uint8_t cmd );
49         
50 public:
51         AM9511(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
52         {
53                 _APU_CLOCK = 1.0e6;
54                 set_device_name(_T("AM9511"));
55         }
56         ~AM9511() {}
57         
58         // common functions
59         void initialize();
60         void reset();
61         void write_io8(uint32_t addr, uint32_t data);
62         uint32_t read_io8(uint32_t addr);
63         void event_callback(int event_id, int err);
64         void save_state(FILEIO* state_fio);
65         bool load_state(FILEIO* state_fio);
66 };
67
68 #endif
69