OSDN Git Service

[VM][FMTOWNS][MEMORY] Fix setup around memory banks by I/O 0404h and 0480h.
[csp-qt/common_source_project-fm7.git] / source / src / vm / nand.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2008.06.10-
6
7         [ nand gate ]
8 */
9
10 #ifndef _NAND_H_
11 #define _NAND_H_
12
13 //#include "vm.h"
14 //#include "../emu.h"
15 #include "device.h"
16
17 #define SIG_NAND_BIT_0  0x01
18 #define SIG_NAND_BIT_1  0x02
19 #define SIG_NAND_BIT_2  0x04
20 #define SIG_NAND_BIT_3  0x08
21 #define SIG_NAND_BIT_4  0x10
22 #define SIG_NAND_BIT_5  0x20
23 #define SIG_NAND_BIT_6  0x40
24 #define SIG_NAND_BIT_7  0x80
25
26 class  DLL_PREFIX NAND : public DEVICE
27 {
28 private:
29         outputs_t outputs;
30         uint32_t bits_mask, bits_in;
31         bool prev, first;
32         
33 public:
34         NAND(VM_TEMPLATE* parent_vm, EMU_TEMPLATE* parent_emu) : DEVICE(parent_vm, parent_emu)
35         {
36                 initialize_output_signals(&outputs);
37                 bits_mask = bits_in = 0;
38                 prev = first = true;
39                 set_device_name(_T("NAND GATE"));
40         }
41         ~NAND() {}
42         
43         // common functions
44         void __FASTCALL write_signal(int id, uint32_t data, uint32_t mask);
45         bool process_state(FILEIO* state_fio, bool loading);
46         
47         // unique functions
48         void set_context_out(DEVICE* device, int id, uint32_t mask)
49         {
50                 register_output_signal(&outputs, device, id, mask);
51         }
52         void set_mask(uint32_t mask)
53         {
54                 bits_mask |= mask;
55         }
56 };
57
58 #endif
59