1 /***************************************************************************** 2 3 h6280.h Portable Hu6280 emulator interface 4 5 Copyright Bryan McPhail, mish@tendril.co.uk 6 7 This source code is based (with permission!) on the 6502 emulator by 8 Juergen Buchmueller. It is released as part of the Mame emulator project. 9 Let me know if you intend to use this code in any other project. 10 11 ******************************************************************************/ 12 13 #pragma once 14 15 #ifndef __H6280_H__ 16 #define __H6280_H__ 17 18 19 #define LAZY_FLAGS 0 20 21 /**************************************************************************** 22 * The 6280 registers. 23 ****************************************************************************/ 24 typedef struct 25 { 26 PAIR ppc; /* previous program counter */ 27 PAIR pc; /* program counter */ 28 PAIR sp; /* stack pointer (always 100 - 1FF) */ 29 PAIR zp; /* zero page address */ 30 PAIR ea; /* effective address */ 31 UINT8 a; /* Accumulator */ 32 UINT8 x; /* X index register */ 33 UINT8 y; /* Y index register */ 34 UINT8 p; /* Processor status */ 35 UINT8 mmr[8]; /* Hu6280 memory mapper registers */ 36 UINT8 irq_mask; /* interrupt enable/disable */ 37 UINT8 timer_status; /* timer status */ 38 UINT8 timer_ack; /* timer acknowledge */ 39 UINT8 clocks_per_cycle; /* 4 = low speed mode, 1 = high speed mode */ 40 INT32 timer_value; /* timer interrupt */ 41 INT32 timer_load; /* reload value */ 42 UINT8 nmi_state; 43 UINT8 irq_state[3]; 44 UINT8 irq_pending; 45 INT32 irq_hold; 46 47 UINT32 h6280_iCycles; 48 UINT32 h6280_totalcycles; 49 50 #if LAZY_FLAGS 51 INT32 NZ; /* last value (lazy N and Z flag) */ 52 #endif 53 UINT8 io_buffer; /* last value written to the PSG, timer, and interrupt pages */ 54 55 int (*irq_callback)(int irqline); 56 } h6280_Regs; 57 58 void h6280_set_context(void *ptr); 59 void h6280_get_context(void *ptr); 60 61 enum 62 { 63 H6280_PC=1, H6280_S, H6280_P, H6280_A, H6280_X, H6280_Y, 64 H6280_IRQ_MASK, H6280_TIMER_STATE, 65 H6280_NMI_STATE, H6280_IRQ1_STATE, H6280_IRQ2_STATE, H6280_IRQT_STATE, 66 H6280_M1, H6280_M2, H6280_M3, H6280_M4, 67 H6280_M5, H6280_M6, H6280_M7, H6280_M8 68 }; 69 70 #define H6280_RESET_VEC 0xfffe 71 #define H6280_NMI_VEC 0xfffc 72 #define H6280_TIMER_VEC 0xfffa 73 #define H6280_IRQ1_VEC 0xfff8 74 #define H6280_IRQ2_VEC 0xfff6 /* Aka BRK vector */ 75 76 //void h6280_get_info(UINT32 state, cpuinfo *info); 77 78 #if 0 79 READ8_HANDLER( h6280_irq_status_r ); 80 WRITE8_HANDLER( h6280_irq_status_w ); 81 82 READ8_HANDLER( h6280_timer_r ); 83 WRITE8_HANDLER( h6280_timer_w ); 84 85 /* functions for use by the PSG and joypad port only! */ 86 UINT8 h6280io_get_buffer(void); 87 void h6280io_set_buffer(UINT8); 88 #endif 89 90 //offs_t h6280_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram); 91 92 #endif /* __H6280_H__ */ 93