2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
17 #define SIG_I8253_CLOCK_0 0
18 #define SIG_I8253_CLOCK_1 1
19 #define SIG_I8253_CLOCK_2 2
20 #define SIG_I8253_GATE_0 3
21 #define SIG_I8253_GATE_1 4
22 #define SIG_I8253_GATE_2 5
24 class I8253 : public DEVICE
36 bool low_read, high_read;
37 bool low_write, high_write;
59 void input_clock(int ch, int clock);
60 void input_gate(int ch, bool signal);
61 void start_count(int ch);
62 void stop_count(int ch);
63 void latch_count(int ch);
64 void set_signal(int ch, bool signal);
65 int get_next_count(int ch);
68 I8253(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
70 for(int i = 0; i < 3; i++) {
71 initialize_output_signals(&counter[i].outputs);
75 set_device_name(_T("8253 PIT"));
82 void write_io8(uint32_t addr, uint32_t data);
83 uint32_t read_io8(uint32_t addr);
84 void event_callback(int event_id, int err);
85 void write_signal(int id, uint32_t data, uint32_t mask);
86 void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame)
88 cpu_clocks = new_clocks;
90 bool process_state(FILEIO* state_fio, bool loading);
93 void set_context_ch0(DEVICE* device, int id, uint32_t mask)
95 register_output_signal(&counter[0].outputs, device, id, mask);
97 void set_context_ch1(DEVICE* device, int id, uint32_t mask)
99 register_output_signal(&counter[1].outputs, device, id, mask);
101 void set_context_ch2(DEVICE* device, int id, uint32_t mask)
103 register_output_signal(&counter[2].outputs, device, id, mask);
105 void set_constant_clock(int ch, uint32_t hz)
107 counter[ch].freq = hz;