summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/cosmac/cosmac.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/cosmac/cosmac.h')
-rw-r--r--src/devices/cpu/cosmac/cosmac.h77
1 files changed, 52 insertions, 25 deletions
diff --git a/src/devices/cpu/cosmac/cosmac.h b/src/devices/cpu/cosmac/cosmac.h
index 891e7f837a6..d89d2622156 100644
--- a/src/devices/cpu/cosmac/cosmac.h
+++ b/src/devices/cpu/cosmac/cosmac.h
@@ -171,15 +171,15 @@ public:
// public interfaces
offs_t get_memory_address();
- DECLARE_WRITE_LINE_MEMBER( wait_w ) { set_input_line(COSMAC_INPUT_LINE_WAIT, state); }
- DECLARE_WRITE_LINE_MEMBER( clear_w ) { set_input_line(COSMAC_INPUT_LINE_CLEAR, state); }
- DECLARE_WRITE_LINE_MEMBER( int_w ) { set_input_line(COSMAC_INPUT_LINE_INT, state); }
- DECLARE_WRITE_LINE_MEMBER( dma_in_w ) { set_input_line(COSMAC_INPUT_LINE_DMAIN, state); }
- DECLARE_WRITE_LINE_MEMBER( dma_out_w ) { set_input_line(COSMAC_INPUT_LINE_DMAOUT, state); }
- DECLARE_WRITE_LINE_MEMBER( ef1_w ) { set_input_line(COSMAC_INPUT_LINE_EF1, state); }
- DECLARE_WRITE_LINE_MEMBER( ef2_w ) { set_input_line(COSMAC_INPUT_LINE_EF2, state); }
- DECLARE_WRITE_LINE_MEMBER( ef3_w ) { set_input_line(COSMAC_INPUT_LINE_EF3, state); }
- DECLARE_WRITE_LINE_MEMBER( ef4_w ) { set_input_line(COSMAC_INPUT_LINE_EF4, state); }
+ void wait_w(int state) { set_input_line(COSMAC_INPUT_LINE_WAIT, state); }
+ void clear_w(int state) { set_input_line(COSMAC_INPUT_LINE_CLEAR, state); }
+ void int_w(int state) { set_input_line(COSMAC_INPUT_LINE_INT, state); }
+ void dma_in_w(int state) { set_input_line(COSMAC_INPUT_LINE_DMAIN, state); }
+ void dma_out_w(int state) { set_input_line(COSMAC_INPUT_LINE_DMAOUT, state); }
+ void ef1_w(int state) { set_input_line(COSMAC_INPUT_LINE_EF1, state); }
+ void ef2_w(int state) { set_input_line(COSMAC_INPUT_LINE_EF2, state); }
+ void ef3_w(int state) { set_input_line(COSMAC_INPUT_LINE_EF3, state); }
+ void ef4_w(int state) { set_input_line(COSMAC_INPUT_LINE_EF4, state); }
protected:
// construction/destruction
@@ -218,13 +218,14 @@ protected:
// execution logic
inline void run_state();
inline void debug();
- inline void reset_state();
+ virtual void reset_state();
inline void initialize();
inline void fetch_instruction();
inline void execute_instruction();
inline void dma_input();
inline void dma_output();
inline void interrupt();
+ virtual bool check_irq() { return m_ie && m_irq; }
inline void sample_wait_clear();
inline void sample_ef_lines();
virtual void output_state_code();
@@ -348,6 +349,18 @@ protected:
void ldc();
void gec();
+ void stpc();
+ void stm();
+ void scm1();
+ void scm2();
+ void spm1();
+ void spm2();
+
+ void xie();
+ void xid();
+ void cie();
+ void cid();
+
const address_space_config m_program_config;
const address_space_config m_io_config;
@@ -384,9 +397,9 @@ protected:
};
// internal state
- uint16_t m_pc; // fake program counter
- uint16_t m_op; // current opcode
- uint8_t m_flagsio; // flags storage for state saving
+ uint16_t m_pc; // fake program counter
+ uint16_t m_op; // current opcode
+ uint8_t m_flagsio; // flags storage for state saving
cosmac_state m_state; // state
cosmac_mode m_mode; // control mode
cosmac_mode m_pmode; // previous control mode
@@ -399,25 +412,37 @@ protected:
int m_ef_line[4]; // external flags
// registers
- uint8_t m_d; // data register (accumulator)
- uint8_t m_b; // auxiliary holding register
- uint16_t m_r[16]; // scratchpad registers
- uint8_t m_p; // designates which register is Program Counter
- uint8_t m_x; // designates which register is Data Pointer
- uint8_t m_n; // low-order instruction digit
- uint8_t m_i; // high-order instruction digit
- uint8_t m_t; // temporary register
+ uint8_t m_d; // data register (accumulator)
+ uint8_t m_b; // auxiliary holding register
+ uint16_t m_r[16]; // scratchpad registers
+ uint8_t m_p; // designates which register is Program Counter
+ uint8_t m_x; // designates which register is Data Pointer
+ uint8_t m_n; // low-order instruction digit
+ uint8_t m_i; // high-order instruction digit
+ uint8_t m_t; // temporary register
// flags
int m_df; // data flag (ALU carry)
- int m_ie; // interrupt enable
+ int m_ie; // master interrupt enable
+ int m_cie; // counter interrupt enable
+ int m_xie; // external interrupt enable
+ int m_cil; // counter interrupt latch
int m_q; // output flip-flop
+ uint8_t m_cnt_mode; // counter mode
+ uint8_t m_cnt_load; // counter reload value
+ uint8_t m_cnt_count; // active counter value
+ emu_timer *m_cnt_timer; // counter mode 1 timer handler
+
+ TIMER_CALLBACK_MEMBER(cnt_timerout);
+ uint8_t get_count();
+ void stop_count();
+
// internal stuff
int m_icount;
- address_space * m_program;
- address_space * m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 3, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
// opcode/condition tables
typedef void (cosmac_device::*ophandler)();
@@ -481,6 +506,8 @@ protected:
virtual cosmac_device::ophandler get_ophandler(uint16_t opcode) const override;
virtual bool has_extended_opcodes() override { return true; }
+ virtual bool check_irq() override { return m_ie && ((m_irq && m_xie) || (m_cil && m_cie)); }
+ virtual void reset_state() override;
private:
static const ophandler s_opcodetable_ex[256];