Previous 199869 Revisions Next

r24795 Wednesday 7th August, 2013 at 17:19:22 UTC by Wilbert Pol
m6800.c: Modernized cpu core (nw)
[src/emu/cpu/m6800]6800ops.c 6800tbl.c m6800.c m6800.h
[src/mame/audio]midway.h
[src/mame/drivers]baraduke.c namcos1.c namcos86.c pacland.c skykid.c tceptor.c
[src/mess/drivers]adam.c atarist.c hx20.c mc10.c psion.c
[src/mess/includes]psion.h
[src/mess/machine]adam_ddp.c adam_fdc.c adam_kb.c adam_prn.c adam_spi.c pf10.c

trunk/src/mame/audio/midway.h
r24794r24795
295295
296296private:
297297   // devices
298   required_device<m6802_device> m_cpu;
298   required_device<m6802_cpu_device> m_cpu;
299299   required_device<pia6821_device> m_pia0;
300300   required_device<pia6821_device> m_pia1;
301301   optional_device<tms5200_device> m_tms5200;
trunk/src/mame/drivers/tceptor.c
r24794r24795
206206
207207
208208static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, tceptor_state )
209   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
209   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r, m6801_io_w)
210210   AM_RANGE(0x0080, 0x00ff) AM_RAM
211211   AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w)
212212   AM_RANGE(0x1400, 0x154d) AM_RAM
trunk/src/mame/drivers/namcos1.c
r24794r24795
477477
478478
479479static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, namcos1_state )
480   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
480   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r, m6801_io_w)
481481   AM_RANGE(0x0080, 0x00ff) AM_RAM /* built in RAM */
482482   AM_RANGE(0x1000, 0x1003) AM_READ(dsw_r)
483483   AM_RANGE(0x1400, 0x1400) AM_READ_PORT("CONTROL0")
trunk/src/mame/drivers/namcos86.c
r24794r24795
387387
388388#define MCU_MEMORY(NAME,ADDR_LOWROM,ADDR_INPUT,ADDR_UNK1,ADDR_UNK2)         \
389389static ADDRESS_MAP_START( NAME##_mcu_map, AS_PROGRAM, 8, namcos86_state )   \
390   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r,m6801_io_w) \
390   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r,m6801_io_w) \
391391   AM_RANGE(0x0080, 0x00ff) AM_RAM                                                     \
392392   AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */ \
393393   AM_RANGE(0x1400, 0x1fff) AM_RAM                                                     \
trunk/src/mame/drivers/skykid.c
r24794r24795
115115ADDRESS_MAP_END
116116
117117static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, skykid_state )
118   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
118   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r, m6801_io_w)
119119   AM_RANGE(0x0080, 0x00ff) AM_RAM
120120   AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
121121   AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w)     /* watchdog? */
trunk/src/mame/drivers/pacland.c
r24794r24795
251251ADDRESS_MAP_END
252252
253253static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, pacland_state )
254   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
254   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r, m6801_io_w)
255255   AM_RANGE(0x0080, 0x00ff) AM_RAM
256256   AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w)      /* PSG device, shared RAM */
257257   AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w)     /* watchdog? */
trunk/src/mame/drivers/baraduke.c
r24794r24795
177177}
178178
179179static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, baraduke_state )
180   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r,m6801_io_w)/* internal registers */
180   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("mcu", hd63701_cpu_device, m6801_io_r,m6801_io_w)/* internal registers */
181181   AM_RANGE(0x0080, 0x00ff) AM_RAM                             /* built in RAM */
182182   AM_RANGE(0x1105, 0x1105) AM_READ(soundkludge_r)             /* cures speech */
183183   AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
trunk/src/emu/cpu/m6800/m6800.c
r24794r24795
105105};
106106#endif
107107
108/* 6800 Registers */
109struct m6800_state
110{
111//  int     subtype;        /* CPU subtype */
112   PAIR    ppc;            /* Previous program counter */
113   PAIR    pc;             /* Program counter */
114   PAIR    s;              /* Stack pointer */
115   PAIR    x;              /* Index register */
116   PAIR    d;              /* Accumulators */
117   UINT8   cc;             /* Condition codes */
118   UINT8   wai_state;      /* WAI opcode state ,(or sleep opcode state) */
119   UINT8   nmi_state;      /* NMI line state */
120   UINT8   nmi_pending;    /* NMI pending */
121   UINT8   irq_state[3];   /* IRQ line state [IRQ1,TIN,SC1] */
122   UINT8   ic_eddge;       /* InputCapture eddge , b.0=fall,b.1=raise */
123   int     sc1_state;
124108
125   device_irq_acknowledge_callback irq_callback;
126   legacy_cpu_device *device;
127
128   /* Memory spaces */
129   address_space *program;
130   direct_read_data *direct;
131   address_space *data;
132   address_space *io;
133
134   void    (* const * insn)(m6800_state *);    /* instruction table */
135   const UINT8 *cycles;            /* clock cycle of instruction table */
136   /* internal registers */
137   UINT8   port1_ddr;
138   UINT8   port2_ddr;
139   UINT8   port3_ddr;
140   UINT8   port4_ddr;
141   UINT8   port1_data;
142   UINT8   port2_data;
143   UINT8   port3_data;
144   UINT8   port4_data;
145   UINT8   p3csr;          // Port 3 Control/Status Register
146   UINT8   tcsr;           /* Timer Control and Status Register */
147   UINT8   pending_tcsr;   /* pending IRQ flag for clear IRQflag process */
148   UINT8   irq2;           /* IRQ2 flags */
149   UINT8   ram_ctrl;
150   PAIR    counter;        /* free running counter */
151   PAIR    output_compare; /* output compare       */
152   UINT16  input_capture;  /* input capture        */
153   int     p3csr_is3_flag_read;
154   int     port3_latched;
155
156   int     clock;
157   UINT8   trcsr, rmcr, rdr, tdr, rsr, tsr;
158   int     rxbits, txbits, txstate, trcsr_read_tdre, trcsr_read_orfe, trcsr_read_rdrf, tx;
159   int     port2_written;
160
161   int     icount;
162   int     latch09;
163
164   PAIR    timer_over;
165   emu_timer *sci_timer;
166   PAIR ea;        /* effective address */
167
168   devcb_resolved_write_line   out_sc2_func;
169};
170
171INLINE m6800_state *get_safe_token(device_t *device)
172{
173   assert(device != NULL);
174   assert(device->type() == M6800 ||
175         device->type() == M6801 ||
176         device->type() == M6802 ||
177         device->type() == M6803 ||
178         device->type() == M6808 ||
179         device->type() == HD6301 ||
180         device->type() == HD63701 ||
181         device->type() == NSC8105 ||
182         device->type() == HD6303R ||
183         device->type() == HD6303Y);
184   return (m6800_state *)downcast<legacy_cpu_device *>(device)->token();
185}
186
187109#if 0
188static void hd63701_trap_pc(m6800_state *cpustate);
110static void hd63701_trap_pc();
189111#endif
190112
191#define pPPC    cpustate->ppc
192#define pPC     cpustate->pc
193#define pS      cpustate->s
194#define pX      cpustate->x
195#define pD      cpustate->d
113#define pPPC    m_ppc
114#define pPC     m_pc
115#define pS      m_s
116#define pX      m_x
117#define pD      m_d
196118
197#define PC      cpustate->pc.w.l
198#define PCD     cpustate->pc.d
199#define S       cpustate->s.w.l
200#define SD      cpustate->s.d
201#define X       cpustate->x.w.l
202#define D       cpustate->d.w.l
203#define A       cpustate->d.b.h
204#define B       cpustate->d.b.l
205#define CC      cpustate->cc
119#define PC      m_pc.w.l
120#define PCD     m_pc.d
121#define S       m_s.w.l
122#define SD      m_s.d
123#define X       m_x.w.l
124#define D       m_d.w.l
125#define A       m_d.b.h
126#define B       m_d.b.l
127#define CC      m_cc
206128
207#define CT      cpustate->counter.w.l
208#define CTH     cpustate->counter.w.h
209#define CTD     cpustate->counter.d
210#define OC      cpustate->output_compare.w.l
211#define OCH     cpustate->output_compare.w.h
212#define OCD     cpustate->output_compare.d
213#define TOH     cpustate->timer_over.w.l
214#define TOD     cpustate->timer_over.d
129#define CT      m_counter.w.l
130#define CTH     m_counter.w.h
131#define CTD     m_counter.d
132#define OC      m_output_compare.w.l
133#define OCH     m_output_compare.w.h
134#define OCD     m_output_compare.d
135#define TOH     m_timer_over.w.l
136#define TOD     m_timer_over.d
215137
216#define EAD     cpustate->ea.d
217#define EA      cpustate->ea.w.l
138#define EAD     m_ea.d
139#define EA      m_ea.w.l
218140
219141/* point of next timer event */
220142static UINT32 timer_next;
r24794r24795
224146/****************************************************************************/
225147/* Read a byte from given memory location                                   */
226148/****************************************************************************/
227#define RM(Addr) ((unsigned)cpustate->program->read_byte(Addr))
149#define RM(Addr) ((unsigned)m_program->read_byte(Addr))
228150
229151/****************************************************************************/
230152/* Write a byte to given memory location                                    */
231153/****************************************************************************/
232#define WM(Addr,Value) (cpustate->program->write_byte(Addr,Value))
154#define WM(Addr,Value) (m_program->write_byte(Addr,Value))
233155
234156/****************************************************************************/
235157/* M6800_RDOP() is identical to M6800_RDMEM() except it is used for reading */
236158/* opcodes. In case of system with memory mapped I/O, this function can be  */
237159/* used to greatly speed up emulation                                       */
238160/****************************************************************************/
239#define M_RDOP(Addr) ((unsigned)cpustate->direct->read_decrypted_byte(Addr))
161#define M_RDOP(Addr) ((unsigned)m_direct->read_decrypted_byte(Addr))
240162
241163/****************************************************************************/
242164/* M6800_RDOP_ARG() is identical to M6800_RDOP() but it's used for reading  */
243165/* opcode arguments. This difference can be used to support systems that    */
244166/* use different encoding mechanisms for opcodes and opcode arguments       */
245167/****************************************************************************/
246#define M_RDOP_ARG(Addr) ((unsigned)cpustate->direct->read_raw_byte(Addr))
168#define M_RDOP_ARG(Addr) ((unsigned)m_direct->read_raw_byte(Addr))
247169
248170/* macros to access memory */
249171#define IMMBYTE(b)  b = M_RDOP_ARG(PCD); PC++
r24794r24795
255177#define PULLWORD(w) S++; w.d = RM(SD)<<8; S++; w.d |= RM(SD)
256178
257179#define MODIFIED_tcsr { \
258   cpustate->irq2 = (cpustate->tcsr&(cpustate->tcsr<<3))&(TCSR_ICF|TCSR_OCF|TCSR_TOF); \
180   m_irq2 = (m_tcsr&(m_tcsr<<3))&(TCSR_ICF|TCSR_OCF|TCSR_TOF); \
259181}
260182
261183#define SET_TIMER_EVENT {                   \
r24794r24795
352274};
353275
354276/* take interrupt */
355#define TAKE_ICI enter_interrupt(cpustate, "M6800 '%s' take ICI\n",0xfff6)
356#define TAKE_OCI enter_interrupt(cpustate, "M6800 '%s' take OCI\n",0xfff4)
357#define TAKE_TOI enter_interrupt(cpustate, "M6800 '%s' take TOI\n",0xfff2)
358#define TAKE_SCI enter_interrupt(cpustate, "M6800 '%s' take SCI\n",0xfff0)
359#define TAKE_TRAP enter_interrupt(cpustate, "M6800 '%s' take TRAP\n",0xffee)
277#define TAKE_ICI enter_interrupt("M6800 '%s' take ICI\n",0xfff6)
278#define TAKE_OCI enter_interrupt("M6800 '%s' take OCI\n",0xfff4)
279#define TAKE_TOI enter_interrupt("M6800 '%s' take TOI\n",0xfff2)
280#define TAKE_SCI enter_interrupt("M6800 '%s' take SCI\n",0xfff0)
281#define TAKE_TRAP enter_interrupt("M6800 '%s' take TRAP\n",0xffee)
360282
361283/* operate one instruction for */
362284#define ONE_MORE_INSN() {       \
363285   UINT8 ireg;                             \
364286   pPPC = pPC;                             \
365   debugger_instruction_hook(cpustate->device, PCD);                       \
287   debugger_instruction_hook(this, PCD);                       \
366288   ireg=M_RDOP(PCD);                       \
367289   PC++;                                   \
368   (*cpustate->insn[ireg])(cpustate);                  \
369   increment_counter(cpustate, cpustate->cycles[ireg]);    \
290   (this->*m_insn[ireg])();               \
291   increment_counter(m_cycles[ireg]);    \
370292}
371293
372294/* CC masks                       HI NZVC
r24794r24795
392314#define SET_V8(a,b,r)   CC|=((((a)^(b)^(r)^((r)>>1))&0x80)>>6)
393315#define SET_V16(a,b,r)  CC|=((((a)^(b)^(r)^((r)>>1))&0x8000)>>14)
394316
395static const UINT8 flags8i[256]=     /* increment */
317const UINT8 m6800_cpu_device::flags8i[256]=     /* increment */
396318{
3973190x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
3983200x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
r24794r24795
4113330x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
4123340x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08
413335};
414static const UINT8 flags8d[256]= /* decrement */
336
337
338const UINT8 m6800_cpu_device::flags8d[256]= /* decrement */
415339{
4163400x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
4173410x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
r24794r24795
4303540x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
4313550x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08
432356};
357
433358#define SET_FLAGS8I(a)      {CC|=flags8i[(a)&0xff];}
434359#define SET_FLAGS8D(a)      {CC|=flags8d[(a)&0xff];}
435360
r24794r24795
446371#define DIRECT IMMBYTE(EAD)
447372#define IMM8 EA=PC++
448373#define IMM16 {EA=PC;PC+=2;}
449#define EXTENDED IMMWORD(cpustate->ea)
374#define EXTENDED IMMWORD(m_ea)
450375#define INDEXED {EA=X+(UINT8)M_RDOP_ARG(PCD);PC++;}
451376
452377/* macros to set status flags */
r24794r24795
478403
479404/* macros for convenience */
480405#define DIRBYTE(b) {DIRECT;b=RM(EAD);}
481#define DIRWORD(w) {DIRECT;w.d=RM16(cpustate, EAD);}
406#define DIRWORD(w) {DIRECT;w.d=RM16(EAD);}
482407#define EXTBYTE(b) {EXTENDED;b=RM(EAD);}
483#define EXTWORD(w) {EXTENDED;w.d=RM16(cpustate, EAD);}
408#define EXTWORD(w) {EXTENDED;w.d=RM16(EAD);}
484409
485410#define IDXBYTE(b) {INDEXED;b=RM(EAD);}
486#define IDXWORD(w) {INDEXED;w.d=RM16(cpustate, EAD);}
411#define IDXWORD(w) {INDEXED;w.d=RM16(EAD);}
487412
488413/* Macros for branch instructions */
489414#define BRANCH(f) {IMMBYTE(t);if(f){PC+=SIGNED(t);}}
r24794r24795
495420/* Note: don't use 0 cycles here for invalid opcodes so that we don't */
496421/* hang in an infinite loop if we hit one */
497422#define XX 5 // invalid opcode unknown cc
498static const UINT8 cycles_6800[] =
423const UINT8 m6800_cpu_device::cycles_6800[256] =
499424{
500425      /* 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F */
501426   /*0*/ XX, 2,XX,XX,XX,XX, 2, 2, 4, 4, 2, 2, 2, 2, 2, 2,
r24794r24795
516441   /*F*/  4, 4, 4,XX, 4, 4, 4, 5, 4, 4, 4, 4,XX,XX, 5, 6
517442};
518443
519static const UINT8 cycles_6803[] =
444const UINT8 m6800_cpu_device::cycles_6803[256] =
520445{
521446      /* 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F */
522447   /*0*/ XX, 2,XX,XX, 3, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2,
r24794r24795
537462   /*F*/  4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5
538463};
539464
540static const UINT8 cycles_63701[] =
465const UINT8 m6800_cpu_device::cycles_63701[256] =
541466{
542467      /* 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F */
543468   /*0*/ XX, 1,XX,XX, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
r24794r24795
558483   /*F*/  4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5
559484};
560485
561static const UINT8 cycles_nsc8105[] =
486const UINT8 m6800_cpu_device::cycles_nsc8105[256] =
562487{
563488      /* 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F */
564489   /*0*/ XX,XX, 2,XX,XX, 2,XX, 2, 4, 2, 4, 2, 2, 2, 2, 2,
r24794r24795
585510   int cycles_to_eat;                                              \
586511                                                   \
587512   cycles_to_eat = timer_next - CTD;                               \
588   if( cycles_to_eat > cpustate->icount) cycles_to_eat = cpustate->icount; \
513   if( cycles_to_eat > m_icount) cycles_to_eat = m_icount; \
589514   if (cycles_to_eat > 0)                                          \
590515   {                                                               \
591      increment_counter(cpustate, cycles_to_eat);                         \
516      increment_counter(cycles_to_eat);                         \
592517   }                                                               \
593518}
594519
595INLINE UINT32 RM16(m6800_state *cpustate, UINT32 Addr )
520
521const device_type M6800 = &device_creator<m6800_cpu_device>;
522const device_type M6801 = &device_creator<m6801_cpu_device>;
523const device_type M6802 = &device_creator<m6802_cpu_device>;
524const device_type M6803 = &device_creator<m6803_cpu_device>;
525const device_type M6808 = &device_creator<m6808_cpu_device>;
526const device_type HD6301 = &device_creator<hd6301_cpu_device>;
527const device_type HD63701 = &device_creator<hd63701_cpu_device>;
528const device_type NSC8105 = &device_creator<nsc8105_cpu_device>;
529const device_type HD6303R = &device_creator<hd6303r_cpu_device>;
530const device_type HD6303Y = &device_creator<hd6303y_cpu_device>;
531
532
533m6800_cpu_device::m6800_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
534   : cpu_device(mconfig, M6800, "M6800", tag, owner, clock, "m6800", __FILE__)
535   , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0)
536   , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0)
537   , m_has_io(false)
538   , m_out_sc2_func(*this)
539   , m_insn(m6800_insn)
540   , m_cycles(cycles_6800)
596541{
542   m_clock_divider = 1;
543}
544
545m6800_cpu_device::m6800_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, bool has_io, int clock_divider, const op_func *insn, const UINT8 *cycles, address_map_constructor internal)
546   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
547   , m_program_config("program", ENDIANNESS_BIG, 8, 16, 0, internal)
548   , m_io_config("io", ENDIANNESS_BIG, 8, 9, 0)
549   , m_has_io(has_io)
550   , m_out_sc2_func(*this)
551   , m_insn(insn)
552   , m_cycles(cycles)
553{
554   m_clock_divider = clock_divider;
555}
556
557m6801_cpu_device::m6801_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
558   : m6800_cpu_device(mconfig, M6801, "M6801", tag, owner, clock, "m6801", __FILE__, true, 4, m6803_insn, cycles_6803)
559{
560}
561
562m6801_cpu_device::m6801_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, const op_func *insn, const UINT8 *cycles, address_map_constructor internal)
563   : m6800_cpu_device(mconfig, type, name, tag, owner, clock, shortname, source, true, 4, insn, cycles, internal)
564{
565}
566
567m6802_cpu_device::m6802_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
568   : m6800_cpu_device(mconfig, M6802, "M6802", tag, owner, clock, "m6802", __FILE__, false, 4, m6800_insn, cycles_6800)
569{
570}
571
572m6802_cpu_device::m6802_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, const op_func *insn, const UINT8 *cycles)
573   : m6800_cpu_device(mconfig, type, name, tag, owner, clock, shortname, source, false, 4, insn, cycles)
574{
575}
576
577static ADDRESS_MAP_START(m6803_mem, AS_PROGRAM, 8, m6800_cpu_device)
578   AM_RANGE(0x0000, 0x001f) AM_READWRITE(m6801_io_r, m6801_io_w)
579   AM_RANGE(0x0020, 0x007f) AM_NOP        /* unused */
580   AM_RANGE(0x0080, 0x00ff) AM_RAM        /* 6803 internal RAM */
581ADDRESS_MAP_END
582
583
584m6803_cpu_device::m6803_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
585   : m6801_cpu_device(mconfig, M6803, "M6803", tag, owner, clock, "m6803", __FILE__, m6803_insn, cycles_6803, ADDRESS_MAP_NAME(m6803_mem))
586{
587}
588
589m6808_cpu_device::m6808_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
590   : m6802_cpu_device(mconfig, M6808, "M6808", tag, owner, clock, "m6808", __FILE__, m6800_insn, cycles_6800)
591{
592}
593
594hd6301_cpu_device::hd6301_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
595   : m6801_cpu_device(mconfig, HD6301, "HD6301", tag, owner, clock, "hd6301", __FILE__, hd63701_insn, cycles_63701)
596{
597}
598
599hd6301_cpu_device::hd6301_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
600   : m6801_cpu_device(mconfig, type, name, tag, owner, clock, shortname, source, hd63701_insn, cycles_63701)
601{
602}
603
604hd63701_cpu_device::hd63701_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
605   : m6801_cpu_device(mconfig, HD63701, "HD63701", tag, owner, clock, "hd63701", __FILE__, hd63701_insn, cycles_63701)
606{
607}
608
609nsc8105_cpu_device::nsc8105_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
610   : m6802_cpu_device(mconfig, NSC8105, "NSC8105", tag, owner, clock, "nsc8105", __FILE__, nsc8105_insn, cycles_nsc8105)
611{
612}
613
614hd6303r_cpu_device::hd6303r_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
615   : hd6301_cpu_device(mconfig, HD6303R, "HD6303R", tag, owner, clock, "hd6303r", __FILE__)
616{
617}
618
619hd6303y_cpu_device::hd6303y_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
620   : hd6301_cpu_device(mconfig, HD6303Y, "HD6303Y", tag, owner, clock, "hd6303y", __FILE__)
621{
622}
623
624
625UINT32 m6800_cpu_device::RM16(UINT32 Addr )
626{
597627   UINT32 result = RM(Addr) << 8;
598628   return result | RM((Addr+1)&0xffff);
599629}
600630
601INLINE void WM16(m6800_state *cpustate, UINT32 Addr, PAIR *p )
631void m6800_cpu_device::WM16(UINT32 Addr, PAIR *p )
602632{
603633   WM( Addr, p->b.h );
604634   WM( (Addr+1)&0xffff, p->b.l );
605635}
606636
607637/* IRQ enter */
608static void enter_interrupt(m6800_state *cpustate, const char *message,UINT16 irq_vector)
638void m6800_cpu_device::enter_interrupt(const char *message,UINT16 irq_vector)
609639{
610   LOG((message, cpustate->device->tag()));
611   if( cpustate->wai_state & (M6800_WAI|M6800_SLP) )
640   LOG((message, tag()));
641   if( m_wai_state & (M6800_WAI|M6800_SLP) )
612642   {
613      if( cpustate->wai_state & M6800_WAI )
614         cpustate->icount -= 4;
615      cpustate->wai_state &= ~(M6800_WAI|M6800_SLP);
643      if( m_wai_state & M6800_WAI )
644         m_icount -= 4;
645      m_wai_state &= ~(M6800_WAI|M6800_SLP);
616646   }
617647   else
618648   {
r24794r24795
621651      PUSHBYTE(A);
622652      PUSHBYTE(B);
623653      PUSHBYTE(CC);
624      cpustate->icount -= 12;
654      m_icount -= 12;
625655   }
626656   SEI;
627   PCD = RM16(cpustate, irq_vector );
657   PCD = RM16( irq_vector );
628658}
629659
630660
631661
632static void m6800_check_irq2(m6800_state *cpustate)
662void m6800_cpu_device::m6800_check_irq2()
633663{
634   if ((cpustate->tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF))
664   if ((m_tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF))
635665   {
636666      TAKE_ICI;
637      if( cpustate->irq_callback )
638         (void)(*cpustate->irq_callback)(cpustate->device, M6801_TIN_LINE);
667      standard_irq_callback(M6801_TIN_LINE);
639668   }
640   else if ((cpustate->tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF))
669   else if ((m_tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF))
641670   {
642671      TAKE_OCI;
643672   }
644   else if ((cpustate->tcsr & (TCSR_ETOI|TCSR_TOF)) == (TCSR_ETOI|TCSR_TOF))
673   else if ((m_tcsr & (TCSR_ETOI|TCSR_TOF)) == (TCSR_ETOI|TCSR_TOF))
645674   {
646675      TAKE_TOI;
647676   }
648   else if (((cpustate->trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) == (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) ||
649            ((cpustate->trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) == (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) ||
650            ((cpustate->trcsr & (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)) == (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)))
677   else if (((m_trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) == (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) ||
678            ((m_trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) == (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) ||
679            ((m_trcsr & (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)) == (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)))
651680   {
652      //logerror("M6800 '%s' SCI interrupt\n", cpustate->device->tag());
681      //logerror("M6800 '%s' SCI interrupt\n", tag());
653682      TAKE_SCI;
654683   }
655684}
656685
657686
658687/* check the IRQ lines for pending interrupts */
659INLINE void CHECK_IRQ_LINES(m6800_state *cpustate)
688void m6800_cpu_device::CHECK_IRQ_LINES()
660689{
661690   // TODO: IS3 interrupt
662691
663   if (cpustate->nmi_pending)
692   if (m_nmi_pending)
664693   {
665      if(cpustate->wai_state & M6800_SLP)
666         cpustate->wai_state &= ~M6800_SLP;
694      if(m_wai_state & M6800_SLP)
695         m_wai_state &= ~M6800_SLP;
667696
668      cpustate->nmi_pending = FALSE;
669      enter_interrupt(cpustate, "M6800 '%s' take NMI\n",0xfffc);
697      m_nmi_pending = FALSE;
698      enter_interrupt("M6800 '%s' take NMI\n",0xfffc);
670699   }
671700   else
672701   {
673      if( cpustate->irq_state[M6800_IRQ_LINE] != CLEAR_LINE )
702      if( m_irq_state[M6800_IRQ_LINE] != CLEAR_LINE )
674703      {   /* standard IRQ */
675         if(cpustate->wai_state & M6800_SLP)
676            cpustate->wai_state &= ~M6800_SLP;
704         if(m_wai_state & M6800_SLP)
705            m_wai_state &= ~M6800_SLP;
677706
678707         if( !(CC & 0x10) )
679708         {
680            enter_interrupt(cpustate, "M6800 '%s' take IRQ1\n",0xfff8);
681            if( cpustate->irq_callback )
682               (void)(*cpustate->irq_callback)(cpustate->device, M6800_IRQ_LINE);
709            enter_interrupt("M6800 '%s' take IRQ1\n",0xfff8);
710            standard_irq_callback(M6800_IRQ_LINE);
683711         }
684712      }
685713      else
686714         if( !(CC & 0x10) )
687            m6800_check_irq2(cpustate);
715            m6800_check_irq2();
688716   }
689717}
690718
691719/* check OCI or TOI */
692static void check_timer_event(m6800_state *cpustate)
720void m6800_cpu_device::check_timer_event()
693721{
694722   /* OCI */
695723   if( CTD >= OCD)
696724   {
697725      OCH++;  // next IRQ point
698      cpustate->tcsr |= TCSR_OCF;
699      cpustate->pending_tcsr |= TCSR_OCF;
726      m_tcsr |= TCSR_OCF;
727      m_pending_tcsr |= TCSR_OCF;
700728      MODIFIED_tcsr;
701      if((cpustate->tcsr & TCSR_EOCI) && cpustate->wai_state & M6800_SLP)
702         cpustate->wai_state &= ~M6800_SLP;
703      if ( !(CC & 0x10) && (cpustate->tcsr & TCSR_EOCI))
729      if((m_tcsr & TCSR_EOCI) && m_wai_state & M6800_SLP)
730         m_wai_state &= ~M6800_SLP;
731      if ( !(CC & 0x10) && (m_tcsr & TCSR_EOCI))
704732         TAKE_OCI;
705733   }
706734   /* TOI */
r24794r24795
710738#if 0
711739      CLEANUP_COUNTERS();
712740#endif
713      cpustate->tcsr |= TCSR_TOF;
714      cpustate->pending_tcsr |= TCSR_TOF;
741      m_tcsr |= TCSR_TOF;
742      m_pending_tcsr |= TCSR_TOF;
715743      MODIFIED_tcsr;
716      if((cpustate->tcsr & TCSR_ETOI) && cpustate->wai_state & M6800_SLP)
717         cpustate->wai_state &= ~M6800_SLP;
718      if ( !(CC & 0x10) && (cpustate->tcsr & TCSR_ETOI))
744      if((m_tcsr & TCSR_ETOI) && m_wai_state & M6800_SLP)
745         m_wai_state &= ~M6800_SLP;
746      if ( !(CC & 0x10) && (m_tcsr & TCSR_ETOI))
719747         TAKE_TOI;
720748   }
721749   /* set next event */
722750   SET_TIMER_EVENT;
723751}
724752
725INLINE void increment_counter(m6800_state *cpustate, int amount)
753void m6800_cpu_device::increment_counter(int amount)
726754{
727   cpustate->icount -= amount;
755   m_icount -= amount;
728756   CTD += amount;
729757   if( CTD >= timer_next)
730      check_timer_event(cpustate);
758      check_timer_event();
731759}
732760
733INLINE void set_rmcr(m6800_state *cpustate, UINT8 data)
761void m6800_cpu_device::set_rmcr(UINT8 data)
734762{
735   if (cpustate->rmcr == data) return;
763   if (m_rmcr == data) return;
736764
737   cpustate->rmcr = data;
765   m_rmcr = data;
738766
739   switch ((cpustate->rmcr & M6800_RMCR_CC_MASK) >> 2)
767   switch ((m_rmcr & M6800_RMCR_CC_MASK) >> 2)
740768   {
741769   case 0:
742770   case 3: // not implemented
743      cpustate->sci_timer->enable(false);
771      m_sci_timer->enable(false);
744772      break;
745773
746774   case 1:
747775   case 2:
748776      {
749         int divisor = M6800_RMCR_SS[cpustate->rmcr & M6800_RMCR_SS_MASK];
777         int divisor = M6800_RMCR_SS[m_rmcr & M6800_RMCR_SS_MASK];
778         int clock = m_clock / m_clock_divider;
750779
751         cpustate->sci_timer->adjust(attotime::from_hz(cpustate->clock / divisor), 0, attotime::from_hz(cpustate->clock / divisor));
780         m_sci_timer->adjust(attotime::from_hz(clock / divisor), 0, attotime::from_hz(clock / divisor));
752781      }
753782      break;
754783   }
755784}
756785
757INLINE void write_port2(m6800_state *cpustate)
786void m6800_cpu_device::write_port2()
758787{
759   if (!cpustate->port2_written) return;
788   if (!m_port2_written) return;
760789
761   UINT8 data = cpustate->port2_data;
762   UINT8 ddr = cpustate->port2_ddr & 0x1f;
790   UINT8 data = m_port2_data;
791   UINT8 ddr = m_port2_ddr & 0x1f;
763792
764793   if ((ddr != 0x1f) && ddr)
765794   {
766      data = (cpustate->port2_data & ddr) | (ddr ^ 0xff);
795      data = (m_port2_data & ddr) | (ddr ^ 0xff);
767796   }
768797
769   if (cpustate->trcsr & M6800_TRCSR_TE)
798   if (m_trcsr & M6800_TRCSR_TE)
770799   {
771      data = (data & 0xef) | (cpustate->tx << 4);
800      data = (data & 0xef) | (m_tx << 4);
772801   }
773802
774803   data &= 0x1f;
775804
776   cpustate->io->write_byte(M6801_PORT2, data);
805   m_io->write_byte(M6801_PORT2, data);
777806}
778807
779808/* include the opcode prototypes and function pointer tables */
r24794r24795
782811/* include the opcode functions */
783812#include "6800ops.c"
784813
785static int m6800_rx(m6800_state *cpustate)
814int m6800_cpu_device::m6800_rx()
786815{
787   return (cpustate->io->read_byte(M6801_PORT2) & M6800_PORT2_IO3) >> 3;
816   return (m_io->read_byte(M6801_PORT2) & M6800_PORT2_IO3) >> 3;
788817}
789818
790static void serial_transmit(m6800_state *cpustate)
819void m6800_cpu_device::serial_transmit()
791820{
792   //logerror("M6800 '%s' Tx Tick\n", cpustate->device->tag());
821   //logerror("M6800 '%s' Tx Tick\n", tag());
793822
794   if (cpustate->trcsr & M6800_TRCSR_TE)
823   if (m_trcsr & M6800_TRCSR_TE)
795824   {
796825      // force Port 2 bit 4 as output
797      cpustate->port2_ddr |= M6800_PORT2_IO4;
826      m_port2_ddr |= M6800_PORT2_IO4;
798827
799      switch (cpustate->txstate)
828      switch (m_txstate)
800829      {
801830      case M6800_TX_STATE_INIT:
802         cpustate->tx = 1;
803         cpustate->txbits++;
831         m_tx = 1;
832         m_txbits++;
804833
805         if (cpustate->txbits == 10)
834         if (m_txbits == 10)
806835         {
807            cpustate->txstate = M6800_TX_STATE_READY;
808            cpustate->txbits = M6800_SERIAL_START;
836            m_txstate = M6800_TX_STATE_READY;
837            m_txbits = M6800_SERIAL_START;
809838         }
810839         break;
811840
812841      case M6800_TX_STATE_READY:
813         switch (cpustate->txbits)
842         switch (m_txbits)
814843         {
815844         case M6800_SERIAL_START:
816            if (cpustate->trcsr & M6800_TRCSR_TDRE)
845            if (m_trcsr & M6800_TRCSR_TDRE)
817846            {
818847               // transmit buffer is empty, send consecutive '1's
819               cpustate->tx = 1;
848               m_tx = 1;
820849            }
821850            else
822851            {
823852               // transmit buffer is full, send data
824853
825854               // load TDR to shift register
826               cpustate->tsr = cpustate->tdr;
855               m_tsr = m_tdr;
827856
828857               // transmit buffer is empty, set TDRE flag
829               cpustate->trcsr |= M6800_TRCSR_TDRE;
858               m_trcsr |= M6800_TRCSR_TDRE;
830859
831860               // send start bit '0'
832               cpustate->tx = 0;
861               m_tx = 0;
833862
834               cpustate->txbits++;
863               m_txbits++;
835864
836               //logerror("M6800 '%s' Transmit START Data %02x\n", cpustate->device->tag(), cpustate->tsr);
865               //logerror("M6800 '%s' Transmit START Data %02x\n", tag(), m_tsr);
837866            }
838867            break;
839868
840869         case M6800_SERIAL_STOP:
841870            // send stop bit '1'
842            cpustate->tx = 1;
871            m_tx = 1;
843872
844            CHECK_IRQ_LINES(cpustate);
873            CHECK_IRQ_LINES();
845874
846            cpustate->txbits = M6800_SERIAL_START;
875            m_txbits = M6800_SERIAL_START;
847876
848            //logerror("M6800 '%s' Transmit STOP\n", cpustate->device->tag());
877            //logerror("M6800 '%s' Transmit STOP\n", tag());
849878            break;
850879
851880         default:
852881            // send data bit '0' or '1'
853            cpustate->tx = cpustate->tsr & 0x01;
882            m_tx = m_tsr & 0x01;
854883
855884            // shift transmit register
856            cpustate->tsr >>= 1;
885            m_tsr >>= 1;
857886
858            //logerror("M6800 '%s' Transmit Bit %u: %u\n", cpustate->device->tag(), cpustate->txbits, cpustate->tx);
887            //logerror("M6800 '%s' Transmit Bit %u: %u\n", tag(), m_txbits, m_tx);
859888
860            cpustate->txbits++;
889            m_txbits++;
861890            break;
862891         }
863892         break;
864893      }
865894
866      cpustate->port2_written = 1;
867      write_port2(cpustate);
895      m_port2_written = 1;
896      write_port2();
868897   }
869898}
870899
871static void serial_receive(m6800_state *cpustate)
900void m6800_cpu_device::serial_receive()
872901{
873   //logerror("M6800 '%s' Rx Tick TRCSR %02x bits %u check %02x\n", cpustate->device->tag(), cpustate->trcsr, cpustate->rxbits, cpustate->trcsr & M6800_TRCSR_RE);
902   //logerror("M6800 '%s' Rx Tick TRCSR %02x bits %u check %02x\n", tag(), m_trcsr, m_rxbits, m_trcsr & M6800_TRCSR_RE);
874903
875   if (cpustate->trcsr & M6800_TRCSR_RE)
904   if (m_trcsr & M6800_TRCSR_RE)
876905   {
877      if (cpustate->trcsr & M6800_TRCSR_WU)
906      if (m_trcsr & M6800_TRCSR_WU)
878907      {
879908         // wait for 10 bits of '1'
880         if (m6800_rx(cpustate) == 1)
909         if (m6800_rx() == 1)
881910         {
882            cpustate->rxbits++;
911            m_rxbits++;
883912
884            //logerror("M6800 '%s' Received WAKE UP bit %u\n", cpustate->device->tag(), cpustate->rxbits);
913            //logerror("M6800 '%s' Received WAKE UP bit %u\n", tag(), m_rxbits);
885914
886            if (cpustate->rxbits == 10)
915            if (m_rxbits == 10)
887916            {
888               //logerror("M6800 '%s' Receiver Wake Up\n", cpustate->device->tag());
917               //logerror("M6800 '%s' Receiver Wake Up\n", tag());
889918
890               cpustate->trcsr &= ~M6800_TRCSR_WU;
891               cpustate->rxbits = M6800_SERIAL_START;
919               m_trcsr &= ~M6800_TRCSR_WU;
920               m_rxbits = M6800_SERIAL_START;
892921            }
893922         }
894923         else
895924         {
896            //logerror("M6800 '%s' Receiver Wake Up interrupted\n", cpustate->device->tag());
925            //logerror("M6800 '%s' Receiver Wake Up interrupted\n", tag());
897926
898            cpustate->rxbits = M6800_SERIAL_START;
927            m_rxbits = M6800_SERIAL_START;
899928         }
900929      }
901930      else
902931      {
903932         // receive data
904         switch (cpustate->rxbits)
933         switch (m_rxbits)
905934         {
906935         case M6800_SERIAL_START:
907            if (m6800_rx(cpustate) == 0)
936            if (m6800_rx() == 0)
908937            {
909938               // start bit found
910               cpustate->rxbits++;
939               m_rxbits++;
911940
912               //logerror("M6800 '%s' Received START bit\n", cpustate->device->tag());
941               //logerror("M6800 '%s' Received START bit\n", tag());
913942            }
914943            break;
915944
916945         case M6800_SERIAL_STOP:
917            if (m6800_rx(cpustate) == 1)
946            if (m6800_rx() == 1)
918947            {
919               //logerror("M6800 '%s' Received STOP bit\n", cpustate->device->tag());
948               //logerror("M6800 '%s' Received STOP bit\n", tag());
920949
921               if (cpustate->trcsr & M6800_TRCSR_RDRF)
950               if (m_trcsr & M6800_TRCSR_RDRF)
922951               {
923952                  // overrun error
924                  cpustate->trcsr |= M6800_TRCSR_ORFE;
953                  m_trcsr |= M6800_TRCSR_ORFE;
925954
926                  //logerror("M6800 '%s' Receive Overrun Error\n", cpustate->device->tag());
955                  //logerror("M6800 '%s' Receive Overrun Error\n", tag());
927956
928                  CHECK_IRQ_LINES(cpustate);
957                  CHECK_IRQ_LINES();
929958               }
930959               else
931960               {
932                  if (!(cpustate->trcsr & M6800_TRCSR_ORFE))
961                  if (!(m_trcsr & M6800_TRCSR_ORFE))
933962                  {
934963                     // transfer data into receive register
935                     cpustate->rdr = cpustate->rsr;
964                     m_rdr = m_rsr;
936965
937                     //logerror("M6800 '%s' Receive Data Register: %02x\n", cpustate->device->tag(), cpustate->rdr);
966                     //logerror("M6800 '%s' Receive Data Register: %02x\n", tag(), m_rdr);
938967
939968                     // set RDRF flag
940                     cpustate->trcsr |= M6800_TRCSR_RDRF;
969                     m_trcsr |= M6800_TRCSR_RDRF;
941970
942                     CHECK_IRQ_LINES(cpustate);
971                     CHECK_IRQ_LINES();
943972                  }
944973               }
945974            }
946975            else
947976            {
948977               // framing error
949               if (!(cpustate->trcsr & M6800_TRCSR_ORFE))
978               if (!(m_trcsr & M6800_TRCSR_ORFE))
950979               {
951980                  // transfer unframed data into receive register
952                  cpustate->rdr = cpustate->rsr;
981                  m_rdr = m_rsr;
953982               }
954983
955               cpustate->trcsr |= M6800_TRCSR_ORFE;
956               cpustate->trcsr &= ~M6800_TRCSR_RDRF;
984               m_trcsr |= M6800_TRCSR_ORFE;
985               m_trcsr &= ~M6800_TRCSR_RDRF;
957986
958               //logerror("M6800 '%s' Receive Framing Error\n", cpustate->device->tag());
987               //logerror("M6800 '%s' Receive Framing Error\n", tag());
959988
960               CHECK_IRQ_LINES(cpustate);
989               CHECK_IRQ_LINES();
961990            }
962991
963            cpustate->rxbits = M6800_SERIAL_START;
992            m_rxbits = M6800_SERIAL_START;
964993            break;
965994
966995         default:
967996            // shift receive register
968            cpustate->rsr >>= 1;
997            m_rsr >>= 1;
969998
970999            // receive bit into register
971            cpustate->rsr |= (m6800_rx(cpustate) << 7);
1000            m_rsr |= (m6800_rx() << 7);
9721001
973            //logerror("M6800 '%s' Received DATA bit %u: %u\n", cpustate->device->tag(), cpustate->rxbits, BIT(cpustate->rsr, 7));
1002            //logerror("M6800 '%s' Received DATA bit %u: %u\n", tag(), m_rxbits, BIT(m_rsr, 7));
9741003
975            cpustate->rxbits++;
1004            m_rxbits++;
9761005            break;
9771006         }
9781007      }
9791008   }
9801009}
9811010
982static TIMER_CALLBACK( sci_tick )
1011TIMER_CALLBACK_MEMBER( m6800_cpu_device::sci_tick )
9831012{
984   m6800_state *cpustate = (m6800_state *)ptr;
985
986   serial_transmit(cpustate);
987   serial_receive(cpustate);
1013   serial_transmit();
1014   serial_receive();
9881015}
9891016
990/****************************************************************************
991 * Reset registers to their initial values
992 ****************************************************************************/
993static void state_register(m6800_state *cpustate, const char *type)
1017
1018void m6800_cpu_device::device_start()
9941019{
995   cpustate->device->save_item(NAME(cpustate->ppc.w.l));
996   cpustate->device->save_item(NAME(cpustate->pc.w.l));
997   cpustate->device->save_item(NAME(cpustate->s.w.l));
998   cpustate->device->save_item(NAME(cpustate->x.w.l));
999   cpustate->device->save_item(NAME(cpustate->d.w.l));
1000   cpustate->device->save_item(NAME(cpustate->cc));
1001   cpustate->device->save_item(NAME(cpustate->wai_state));
1002   cpustate->device->save_item(NAME(cpustate->nmi_state));
1003   cpustate->device->save_item(NAME(cpustate->nmi_pending));
1004   cpustate->device->save_item(NAME(cpustate->irq_state));
1005   cpustate->device->save_item(NAME(cpustate->ic_eddge));
1020   m_program = &space(AS_PROGRAM);
1021   m_direct = &m_program->direct();
1022   if ( m_has_io )
1023      m_io = &space(AS_IO);
10061024
1007   cpustate->device->save_item(NAME(cpustate->port1_ddr));
1008   cpustate->device->save_item(NAME(cpustate->port2_ddr));
1009   cpustate->device->save_item(NAME(cpustate->port3_ddr));
1010   cpustate->device->save_item(NAME(cpustate->port4_ddr));
1011   cpustate->device->save_item(NAME(cpustate->port1_data));
1012   cpustate->device->save_item(NAME(cpustate->port2_data));
1013   cpustate->device->save_item(NAME(cpustate->port3_data));
1014   cpustate->device->save_item(NAME(cpustate->port4_data));
1015   cpustate->device->save_item(NAME(cpustate->port2_written));
1016   cpustate->device->save_item(NAME(cpustate->port3_latched));
1017   cpustate->device->save_item(NAME(cpustate->p3csr));
1018   cpustate->device->save_item(NAME(cpustate->p3csr_is3_flag_read));
1019   cpustate->device->save_item(NAME(cpustate->tcsr));
1020   cpustate->device->save_item(NAME(cpustate->pending_tcsr));
1021   cpustate->device->save_item(NAME(cpustate->irq2));
1022   cpustate->device->save_item(NAME(cpustate->ram_ctrl));
1025   m_out_sc2_func.resolve_safe();
1026   m_sci_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m6800_cpu_device::sci_tick),this));
10231027
1024   cpustate->device->save_item(NAME(cpustate->counter.d));
1025   cpustate->device->save_item(NAME(cpustate->output_compare.d));
1026   cpustate->device->save_item(NAME(cpustate->input_capture));
1027   cpustate->device->save_item(NAME(cpustate->timer_over.d));
1028   save_item(NAME(m_ppc.w.l));
1029   save_item(NAME(m_pc.w.l));
1030   save_item(NAME(m_s.w.l));
1031   save_item(NAME(m_x.w.l));
1032   save_item(NAME(m_d.w.l));
1033   save_item(NAME(m_cc));
1034   save_item(NAME(m_wai_state));
1035   save_item(NAME(m_nmi_state));
1036   save_item(NAME(m_nmi_pending));
1037   save_item(NAME(m_irq_state));
1038   save_item(NAME(m_ic_eddge));
10281039
1029   cpustate->device->save_item(NAME(cpustate->clock));
1030   cpustate->device->save_item(NAME(cpustate->trcsr));
1031   cpustate->device->save_item(NAME(cpustate->rmcr));
1032   cpustate->device->save_item(NAME(cpustate->rdr));
1033   cpustate->device->save_item(NAME(cpustate->tdr));
1034   cpustate->device->save_item(NAME(cpustate->rsr));
1035   cpustate->device->save_item(NAME(cpustate->tsr));
1036   cpustate->device->save_item(NAME(cpustate->rxbits));
1037   cpustate->device->save_item(NAME(cpustate->txbits));
1038   cpustate->device->save_item(NAME(cpustate->txstate));
1039   cpustate->device->save_item(NAME(cpustate->trcsr_read_tdre));
1040   cpustate->device->save_item(NAME(cpustate->trcsr_read_orfe));
1041   cpustate->device->save_item(NAME(cpustate->trcsr_read_rdrf));
1042   cpustate->device->save_item(NAME(cpustate->tx));
1043}
1040   save_item(NAME(m_port1_ddr));
1041   save_item(NAME(m_port2_ddr));
1042   save_item(NAME(m_port3_ddr));
1043   save_item(NAME(m_port4_ddr));
1044   save_item(NAME(m_port1_data));
1045   save_item(NAME(m_port2_data));
1046   save_item(NAME(m_port3_data));
1047   save_item(NAME(m_port4_data));
1048   save_item(NAME(m_port2_written));
1049   save_item(NAME(m_port3_latched));
1050   save_item(NAME(m_p3csr));
1051   save_item(NAME(m_p3csr_is3_flag_read));
1052   save_item(NAME(m_tcsr));
1053   save_item(NAME(m_pending_tcsr));
1054   save_item(NAME(m_irq2));
1055   save_item(NAME(m_ram_ctrl));
10441056
1045static CPU_INIT( m6800 )
1046{
1047   m6800_state *cpustate = get_safe_token(device);
1057   save_item(NAME(m_counter.d));
1058   save_item(NAME(m_output_compare.d));
1059   save_item(NAME(m_input_capture));
1060   save_item(NAME(m_timer_over.d));
10481061
1049   cpustate->program = &device->space(AS_PROGRAM);
1050   cpustate->direct = &cpustate->program->direct();
1051   //cpustate->data = &device->space(AS_DATA);
1052   //cpustate->io = &device->space(AS_IO);
1062   save_item(NAME(m_clock_divider));
1063   save_item(NAME(m_trcsr));
1064   save_item(NAME(m_rmcr));
1065   save_item(NAME(m_rdr));
1066   save_item(NAME(m_tdr));
1067   save_item(NAME(m_rsr));
1068   save_item(NAME(m_tsr));
1069   save_item(NAME(m_rxbits));
1070   save_item(NAME(m_txbits));
1071   save_item(NAME(m_txstate));
1072   save_item(NAME(m_trcsr_read_tdre));
1073   save_item(NAME(m_trcsr_read_orfe));
1074   save_item(NAME(m_trcsr_read_rdrf));
1075   save_item(NAME(m_tx));
10531076
1054   //  cpustate->subtype   = SUBTYPE_M6800;
1055   cpustate->insn = m6800_insn;
1056   cpustate->cycles = cycles_6800;
1057   cpustate->irq_callback = irqcallback;
1058   cpustate->device = device;
1059   state_register(cpustate, "m6800");
1077   state_add( M6800_A,         "A", m_d.b.h).formatstr("%02X");
1078   state_add( M6800_B,         "B", m_d.b.l).formatstr("%02X");
1079   state_add( M6800_PC,        "PC", m_pc.w.l).formatstr("%04X");
1080   state_add( M6800_S,         "S", m_s.w.l).formatstr("%04X");
1081   state_add( M6800_X,         "X", m_x.w.l).formatstr("%04X");
1082   state_add( M6800_CC,        "CC", m_cc).formatstr("%02X");
1083   state_add( M6800_WAI_STATE, "WAI", m_wai_state).formatstr("%01X");
1084
1085   state_add( STATE_GENPC, "GENPC", m_pc.w.l).noshow();
1086   state_add( STATE_GENFLAGS, "GENFLAGS", m_cc).formatstr("%8s").noshow();
1087
1088   m_icountptr = &m_icount;
10601089}
10611090
1062static CPU_RESET( m6800 )
1091void m6800_cpu_device::state_string_export(const device_state_entry &entry, astring &string)
10631092{
1064   m6800_state *cpustate = get_safe_token(device);
1093   switch (entry.index())
1094   {
1095      case STATE_GENFLAGS:
1096         string.printf( "%c%c%c%c%c%c%c%c",
1097            m_cc & 0x80 ? '?':'.',
1098            m_cc & 0x40 ? '?':'.',
1099            m_cc & 0x20 ? 'H':'.',
1100            m_cc & 0x10 ? 'I':'.',
1101            m_cc & 0x08 ? 'N':'.',
1102            m_cc & 0x04 ? 'Z':'.',
1103            m_cc & 0x02 ? 'V':'.',
1104            m_cc & 0x01 ? 'C':'.');
1105         break;
1106   }
1107}
10651108
1066   cpustate->cc = 0xc0;
1109void m6800_cpu_device::device_reset()
1110{
1111   m_cc = 0xc0;
10671112   SEI;                /* IRQ disabled */
1068   PCD = RM16(cpustate, 0xfffe );
1113   PCD = RM16( 0xfffe );
10691114
1070   cpustate->wai_state = 0;
1071   cpustate->nmi_state = 0;
1072   cpustate->nmi_pending = 0;
1073   cpustate->sc1_state = 0;
1074   cpustate->irq_state[M6800_IRQ_LINE] = 0;
1075   cpustate->irq_state[M6801_TIN_LINE] = 0;
1076   cpustate->ic_eddge = 0;
1115   m_wai_state = 0;
1116   m_nmi_state = 0;
1117   m_nmi_pending = 0;
1118   m_sc1_state = 0;
1119   m_irq_state[M6800_IRQ_LINE] = 0;
1120   m_irq_state[M6801_TIN_LINE] = 0;
1121   m_ic_eddge = 0;
10771122
1078   cpustate->port1_ddr = 0x00;
1079   cpustate->port2_ddr = 0x00;
1080   cpustate->port3_ddr = 0x00;
1081   cpustate->p3csr = 0x00;
1082   cpustate->p3csr_is3_flag_read = 0;
1083   cpustate->port2_written = 0;
1084   cpustate->port3_latched = 0;
1123   m_port1_ddr = 0x00;
1124   m_port2_ddr = 0x00;
1125   m_port3_ddr = 0x00;
1126   m_p3csr = 0x00;
1127   m_p3csr_is3_flag_read = 0;
1128   m_port2_written = 0;
1129   m_port3_latched = 0;
10851130   /* TODO: on reset port 2 should be read to determine the operating mode (bits 0-2) */
1086   cpustate->tcsr = 0x00;
1087   cpustate->pending_tcsr = 0x00;
1088   cpustate->irq2 = 0;
1131   m_tcsr = 0x00;
1132   m_pending_tcsr = 0x00;
1133   m_irq2 = 0;
10891134   CTD = 0x0000;
10901135   OCD = 0xffff;
10911136   TOD = 0xffff;
1092   cpustate->ram_ctrl |= 0x40;
1137   m_ram_ctrl |= 0x40;
10931138
1094   cpustate->trcsr = M6800_TRCSR_TDRE;
1139   m_trcsr = M6800_TRCSR_TDRE;
10951140
1096   cpustate->txstate = M6800_TX_STATE_INIT;
1097   cpustate->txbits = cpustate->rxbits = 0;
1098   cpustate->tx = 1;
1099   cpustate->trcsr_read_tdre = 0;
1100   cpustate->trcsr_read_orfe = 0;
1101   cpustate->trcsr_read_rdrf = 0;
1141   m_txstate = M6800_TX_STATE_INIT;
1142   m_txbits = m_rxbits = 0;
1143   m_tx = 1;
1144   m_trcsr_read_tdre = 0;
1145   m_trcsr_read_orfe = 0;
1146   m_trcsr_read_rdrf = 0;
11021147
1103   set_rmcr(cpustate, 0);
1148   set_rmcr(0);
11041149}
11051150
1106/****************************************************************************
1107 * Shut down CPU emulation
1108 ****************************************************************************/
1109static CPU_EXIT( m6800 )
1110{
1111   /* nothing to do */
1112}
11131151
1114
1115static void set_irq_line(m6800_state *cpustate, int irqline, int state)
1152void m6800_cpu_device::execute_set_input(int irqline, int state)
11161153{
11171154   switch (irqline)
11181155   {
11191156   case INPUT_LINE_NMI:
1120      if (!cpustate->nmi_state && state != CLEAR_LINE)
1121         cpustate->nmi_pending = TRUE;
1122      cpustate->nmi_state = state;
1157      if (!m_nmi_state && state != CLEAR_LINE)
1158         m_nmi_pending = TRUE;
1159      m_nmi_state = state;
11231160      break;
11241161
11251162   case M6801_SC1_LINE:
1126      if (!cpustate->port3_latched && (cpustate->p3csr & M6801_P3CSR_LE))
1163      if (!m_port3_latched && (m_p3csr & M6801_P3CSR_LE))
11271164      {
1128         if (!cpustate->sc1_state && state)
1165         if (!m_sc1_state && state)
11291166         {
11301167            // latch input data to port 3
1131            cpustate->port3_data = (cpustate->io->read_byte(M6801_PORT3) & (cpustate->port3_ddr ^ 0xff)) | (cpustate->port3_data & cpustate->port3_ddr);
1132            cpustate->port3_latched = 1;
1133            //logerror("M6801 '%s' Latched Port 3 Data: %02x\n", cpustate->device->tag(), cpustate->port3_data);
1168            m_port3_data = (m_io->read_byte(M6801_PORT3) & (m_port3_ddr ^ 0xff)) | (m_port3_data & m_port3_ddr);
1169            m_port3_latched = 1;
1170            //logerror("M6801 '%s' Latched Port 3 Data: %02x\n", tag(), m_port3_data);
11341171
11351172            // set IS3 flag bit
1136            cpustate->p3csr |= M6801_P3CSR_IS3_FLAG;
1173            m_p3csr |= M6801_P3CSR_IS3_FLAG;
11371174         }
11381175      }
1139      cpustate->sc1_state = state;
1176      m_sc1_state = state;
11401177      break;
11411178
11421179   default:
1143      LOG(("M6800 '%s' set_irq_line %d,%d\n", cpustate->device->tag(), irqline, state));
1144      cpustate->irq_state[irqline] = state;
1180      LOG(("M6800 '%s' set_irq_line %d,%d\n", tag(), irqline, state));
1181      m_irq_state[irqline] = state;
11451182
1146      if (irqline == M6801_TIN_LINE && state != cpustate->irq_state[irqline])
1183      if (irqline == M6801_TIN_LINE && state != m_irq_state[irqline])
11471184      {
11481185         //eddge = (state == CLEAR_LINE ) ? 2 : 0;
1149         if( ((cpustate->tcsr&TCSR_IEDG) ^ (state==CLEAR_LINE ? TCSR_IEDG : 0))==0 )
1186         if( ((m_tcsr&TCSR_IEDG) ^ (state==CLEAR_LINE ? TCSR_IEDG : 0))==0 )
11501187            return;
11511188         /* active edge in */
1152         cpustate->tcsr |= TCSR_ICF;
1153         cpustate->pending_tcsr |= TCSR_ICF;
1154         cpustate->input_capture = CT;
1189         m_tcsr |= TCSR_ICF;
1190         m_pending_tcsr |= TCSR_ICF;
1191         m_input_capture = CT;
11551192         MODIFIED_tcsr;
11561193      }
11571194   }
r24794r24795
11601197/****************************************************************************
11611198 * Execute cycles CPU cycles. Return number of cycles really executed
11621199 ****************************************************************************/
1163static CPU_EXECUTE( m6800 )
1200void m6800_cpu_device::execute_run()
11641201{
1165   m6800_state *cpustate = get_safe_token(device);
11661202   UINT8 ireg;
11671203
1168   CHECK_IRQ_LINES(cpustate); /* HJB 990417 */
1204   CHECK_IRQ_LINES(); /* HJB 990417 */
11691205
11701206   CLEANUP_COUNTERS();
11711207
11721208   do
11731209   {
1174      if( cpustate->wai_state & (M6800_WAI|M6800_SLP) )
1210      if( m_wai_state & (M6800_WAI|M6800_SLP) )
11751211      {
11761212         EAT_CYCLES;
11771213      }
11781214      else
11791215      {
11801216         pPPC = pPC;
1181         debugger_instruction_hook(device, PCD);
1217         debugger_instruction_hook(this, PCD);
11821218         ireg=M_RDOP(PCD);
11831219         PC++;
1184         (*cpustate->insn[ireg])(cpustate);
1185         increment_counter(cpustate, cpustate->cycles[ireg]);
1220         (this->*m_insn[ireg])();
1221         increment_counter(m_cycles[ireg]);
11861222      }
1187   } while( cpustate->icount>0 );
1223   } while( m_icount>0 );
11881224}
11891225
1190/****************************************************************************
1191 * M6801 almost (fully?) equal to the M6803
1192 ****************************************************************************/
1193static CPU_INIT( m6801 )
1194{
1195   m6800_state *cpustate = get_safe_token(device);
1196//  cpustate->subtype = SUBTYPE_M6801;
1197   cpustate->insn = m6803_insn;
1198   cpustate->cycles = cycles_6803;
1199   cpustate->irq_callback = irqcallback;
1200   cpustate->device = device;
12011226
1202   cpustate->program = &device->space(AS_PROGRAM);
1203   cpustate->direct = &cpustate->program->direct();
1204   //cpustate->data = &device->space(AS_DATA);
1205   cpustate->io = &device->space(AS_IO);
1206
1207   cpustate->clock = device->clock() / 4;
1208   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
1209
1210   state_register(cpustate, "m6801");
1211
1212   if (device->static_config() != NULL)
1213   {
1214      m6801_interface *intf = (m6801_interface *) device->static_config();
1215
1216      cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
1217   }
1218   else
1219   {
1220      devcb_write_line nullcb = DEVCB_NULL;
1221      cpustate->out_sc2_func.resolve(nullcb, *device);
1222   }
1223}
1224
1225/****************************************************************************
1226 * M6802 almost (fully?) equal to the M6800
1227 ****************************************************************************/
1228static CPU_INIT( m6802 )
1229{
1230   m6800_state *cpustate = get_safe_token(device);
1231   //  cpustate->subtype   = SUBTYPE_M6802;
1232   cpustate->insn = m6800_insn;
1233   cpustate->cycles = cycles_6800;
1234   cpustate->irq_callback = irqcallback;
1235   cpustate->device = device;
1236
1237   cpustate->program = &device->space(AS_PROGRAM);
1238   cpustate->direct = &cpustate->program->direct();
1239   //cpustate->data = &device->space(AS_DATA);
1240   //cpustate->io = &device->space(AS_IO);
1241
1242   state_register(cpustate, "m6802");
1243}
1244
1245/****************************************************************************
1246 * M6803 almost (fully?) equal to the M6801
1247 ****************************************************************************/
1248static CPU_INIT( m6803 )
1249{
1250   m6800_state *cpustate = get_safe_token(device);
1251   //  cpustate->subtype = SUBTYPE_M6803;
1252   cpustate->insn = m6803_insn;
1253   cpustate->cycles = cycles_6803;
1254   cpustate->irq_callback = irqcallback;
1255   cpustate->device = device;
1256
1257   cpustate->program = &device->space(AS_PROGRAM);
1258   cpustate->direct = &cpustate->program->direct();
1259   //cpustate->data = &device->space(AS_DATA);
1260   cpustate->io = &device->space(AS_IO);
1261
1262   cpustate->clock = device->clock() / 4;
1263   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
1264
1265   state_register(cpustate, "m6803");
1266
1267   if (device->static_config() != NULL)
1268   {
1269      m6801_interface *intf = (m6801_interface *) device->static_config();
1270
1271      cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
1272   }
1273   else
1274   {
1275      devcb_write_line nullcb = DEVCB_NULL;
1276      cpustate->out_sc2_func.resolve(nullcb, *device);
1277   }
1278}
1279
1280static ADDRESS_MAP_START(m6803_mem, AS_PROGRAM, 8, legacy_cpu_device)
1281   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
1282   AM_RANGE(0x0020, 0x007f) AM_NOP        /* unused */
1283   AM_RANGE(0x0080, 0x00ff) AM_RAM        /* 6803 internal RAM */
1284ADDRESS_MAP_END
1285
1286
1287/****************************************************************************
1288 * M6808 almost (fully?) equal to the M6800
1289 ****************************************************************************/
1290static CPU_INIT( m6808 )
1291{
1292   m6800_state *cpustate = get_safe_token(device);
1293   //  cpustate->subtype = SUBTYPE_M6808;
1294   cpustate->insn = m6800_insn;
1295   cpustate->cycles = cycles_6800;
1296   cpustate->irq_callback = irqcallback;
1297   cpustate->device = device;
1298
1299   cpustate->program = &device->space(AS_PROGRAM);
1300   cpustate->direct = &cpustate->program->direct();
1301   //cpustate->data = &device->space(AS_DATA);
1302   //cpustate->io = &device->space(AS_IO);
1303
1304   state_register(cpustate, "m6808");
1305
1306   if (device->static_config() != NULL)
1307   {
1308      m6801_interface *intf = (m6801_interface *) device->static_config();
1309
1310      cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
1311   }
1312   else
1313   {
1314      devcb_write_line nullcb = DEVCB_NULL;
1315      cpustate->out_sc2_func.resolve(nullcb, *device);
1316   }
1317}
1318
1319/****************************************************************************
1320 * HD6301 similiar to the M6800
1321 ****************************************************************************/
1322
1323static CPU_INIT( hd6301 )
1324{
1325   m6800_state *cpustate = get_safe_token(device);
1326   //  cpustate->subtype = SUBTYPE_HD6301;
1327   cpustate->insn = hd63701_insn;
1328   cpustate->cycles = cycles_63701;
1329   cpustate->irq_callback = irqcallback;
1330   cpustate->device = device;
1331
1332   cpustate->program = &device->space(AS_PROGRAM);
1333   cpustate->direct = &cpustate->program->direct();
1334   //cpustate->data = &device->space(AS_DATA);
1335   cpustate->io = &device->space(AS_IO);
1336
1337   cpustate->clock = device->clock() / 4;
1338   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
1339
1340   state_register(cpustate, "hd6301");
1341
1342   if (device->static_config() != NULL)
1343   {
1344      m6801_interface *intf = (m6801_interface *) device->static_config();
1345
1346      cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
1347   }
1348   else
1349   {
1350      devcb_write_line nullcb = DEVCB_NULL;
1351      cpustate->out_sc2_func.resolve(nullcb, *device);
1352   }
1353}
1354
1355
1356/****************************************************************************
1357 * HD63701 similiar to the HD6301
1358 ****************************************************************************/
1359
1360static CPU_INIT( hd63701 )
1361{
1362   m6800_state *cpustate = get_safe_token(device);
1363   //  cpustate->subtype = SUBTYPE_HD63701;
1364   cpustate->insn = hd63701_insn;
1365   cpustate->cycles = cycles_63701;
1366   cpustate->irq_callback = irqcallback;
1367   cpustate->device = device;
1368
1369   cpustate->program = &device->space(AS_PROGRAM);
1370   cpustate->direct = &cpustate->program->direct();
1371   //cpustate->data = &device->space(AS_DATA);
1372   cpustate->io = &device->space(AS_IO);
1373
1374   cpustate->clock = device->clock() / 4;
1375   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
1376
1377   state_register(cpustate, "hd63701");
1378
1379   if (device->static_config() != NULL)
1380   {
1381      m6801_interface *intf = (m6801_interface *) device->static_config();
1382
1383      cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
1384   }
1385   else
1386   {
1387      devcb_write_line nullcb = DEVCB_NULL;
1388      cpustate->out_sc2_func.resolve(nullcb, *device);
1389   }
1390}
1391
13921227/*
1393    if change_pc(cpustate) direccted these areas ,Call hd63701_trap_pc(cpustate).
1228    if change_pc() direccted these areas ,Call hd63701_trap_pc().
13941229    'mode' is selected by the sense of p2.0,p2.1,and p2.3 at reset timming.
13951230    mode 0,1,2,4,6 : $0000-$001f
13961231    mode 5         : $0000-$001f,$0200-$efff
13971232    mode 7         : $0000-$001f,$0100-$efff
13981233*/
13991234#if 0
1400static void hd63701_trap_pc(m6800_state *cpustate)
1235void m6800_cpu_device::hd63701_trap_pc()
14011236{
14021237   TAKE_TRAP;
14031238}
14041239#endif
14051240
1406/****************************************************************************
1407 * NSC-8105 similiar to the M6800, but the opcodes are scrambled and there
1408 * is at least one new opcode ($fc)
1409 ****************************************************************************/
1410static CPU_INIT( nsc8105 )
1241void m6800_cpu_device::set_os3(int state)
14111242{
1412   m6800_state *cpustate = get_safe_token(device);
1413   //  cpustate->subtype = SUBTYPE_NSC8105;
1414   cpustate->device = device;
1243   //logerror("M6801 '%s' OS3: %u\n", tag(), state);
14151244
1416   cpustate->program = &device->space(AS_PROGRAM);
1417   cpustate->direct = &cpustate->program->direct();
1418   //cpustate->data = &device->space(AS_DATA);
1419   //cpustate->io = &device->space(AS_IO);
1420
1421   cpustate->insn = nsc8105_insn;
1422   cpustate->cycles = cycles_nsc8105;
1423   state_register(cpustate, "nsc8105");
1245   m_out_sc2_func(state);
14241246}
14251247
1426INLINE void set_os3(m6800_state *cpustate, int state)
1248READ8_MEMBER( m6800_cpu_device::m6801_io_r )
14271249{
1428   //logerror("M6801 '%s' OS3: %u\n", cpustate->device->tag(), state);
1429
1430   cpustate->out_sc2_func(state);
1431}
1432
1433READ8_HANDLER( m6801_io_r )
1434{
1435   m6800_state *cpustate = get_safe_token(&space.device());
1436
14371250   UINT8 data = 0;
14381251
14391252   switch (offset)
14401253   {
14411254   case IO_P1DDR:
1442      data = cpustate->port1_ddr;
1255      data = m_port1_ddr;
14431256      break;
14441257
14451258   case IO_P2DDR:
1446      data = cpustate->port2_ddr;
1259      data = m_port2_ddr;
14471260      break;
14481261
14491262   case IO_P1DATA:
1450      if(cpustate->port1_ddr == 0xff)
1451         data = cpustate->port1_data;
1263      if(m_port1_ddr == 0xff)
1264         data = m_port1_data;
14521265      else
1453         data = (cpustate->io->read_byte(M6801_PORT1) & (cpustate->port1_ddr ^ 0xff))
1454            | (cpustate->port1_data & cpustate->port1_ddr);
1266         data = (m_io->read_byte(M6801_PORT1) & (m_port1_ddr ^ 0xff))
1267            | (m_port1_data & m_port1_ddr);
14551268      break;
14561269
14571270   case IO_P2DATA:
1458      if(cpustate->port2_ddr == 0xff)
1459         data = cpustate->port2_data;
1271      if(m_port2_ddr == 0xff)
1272         data = m_port2_data;
14601273      else
1461         data = (cpustate->io->read_byte(M6801_PORT2) & (cpustate->port2_ddr ^ 0xff))
1462            | (cpustate->port2_data & cpustate->port2_ddr);
1274         data = (m_io->read_byte(M6801_PORT2) & (m_port2_ddr ^ 0xff))
1275            | (m_port2_data & m_port2_ddr);
14631276      break;
14641277
14651278   case IO_P3DDR:
r24794r24795
14671280      break;
14681281
14691282   case IO_P4DDR:
1470      data = cpustate->port4_ddr;
1283      data = m_port4_ddr;
14711284      break;
14721285
14731286   case IO_P3DATA:
14741287      if (!space.debugger_access())
14751288      {
1476         if (cpustate->p3csr_is3_flag_read)
1289         if (m_p3csr_is3_flag_read)
14771290         {
14781291            //logerror("M6801 '%s' Cleared IS3\n", space.device().tag());
1479            cpustate->p3csr &= ~M6801_P3CSR_IS3_FLAG;
1480            cpustate->p3csr_is3_flag_read = 0;
1292            m_p3csr &= ~M6801_P3CSR_IS3_FLAG;
1293            m_p3csr_is3_flag_read = 0;
14811294         }
14821295
1483         if (!(cpustate->p3csr & M6801_P3CSR_OSS))
1296         if (!(m_p3csr & M6801_P3CSR_OSS))
14841297         {
1485            set_os3(cpustate, ASSERT_LINE);
1298            set_os3(ASSERT_LINE);
14861299         }
14871300      }
14881301
1489      if ((cpustate->p3csr & M6801_P3CSR_LE) || (cpustate->port3_ddr == 0xff))
1490         data = cpustate->port3_data;
1302      if ((m_p3csr & M6801_P3CSR_LE) || (m_port3_ddr == 0xff))
1303         data = m_port3_data;
14911304      else
1492         data = (cpustate->io->read_byte(M6801_PORT3) & (cpustate->port3_ddr ^ 0xff))
1493            | (cpustate->port3_data & cpustate->port3_ddr);
1305         data = (m_io->read_byte(M6801_PORT3) & (m_port3_ddr ^ 0xff))
1306            | (m_port3_data & m_port3_ddr);
14941307
14951308      if (!space.debugger_access())
14961309      {
1497         cpustate->port3_latched = 0;
1310         m_port3_latched = 0;
14981311
1499         if (!(cpustate->p3csr & M6801_P3CSR_OSS))
1312         if (!(m_p3csr & M6801_P3CSR_OSS))
15001313         {
1501            set_os3(cpustate, CLEAR_LINE);
1314            set_os3(CLEAR_LINE);
15021315         }
15031316      }
15041317      break;
15051318
15061319   case IO_P4DATA:
1507      if(cpustate->port4_ddr == 0xff)
1508         data = cpustate->port4_data;
1320      if(m_port4_ddr == 0xff)
1321         data = m_port4_data;
15091322      else
1510         data = (cpustate->io->read_byte(M6801_PORT4) & (cpustate->port4_ddr ^ 0xff))
1511            | (cpustate->port4_data & cpustate->port4_ddr);
1323         data = (m_io->read_byte(M6801_PORT4) & (m_port4_ddr ^ 0xff))
1324            | (m_port4_data & m_port4_ddr);
15121325      break;
15131326
15141327   case IO_TCSR:
1515      cpustate->pending_tcsr = 0;
1516      data = cpustate->tcsr;
1328      m_pending_tcsr = 0;
1329      data = m_tcsr;
15171330      break;
15181331
15191332   case IO_CH:
1520      if(!(cpustate->pending_tcsr&TCSR_TOF) && !space.debugger_access())
1333      if(!(m_pending_tcsr&TCSR_TOF) && !space.debugger_access())
15211334      {
1522         cpustate->tcsr &= ~TCSR_TOF;
1335         m_tcsr &= ~TCSR_TOF;
15231336         MODIFIED_tcsr;
15241337      }
1525      data = cpustate->counter.b.h;
1338      data = m_counter.b.h;
15261339      break;
15271340
15281341   case IO_CL:
1529      data = cpustate->counter.b.l;
1342      data = m_counter.b.l;
15301343      // HACK there should be a break here, but Coleco Adam won't boot with it present, proper fix required to the free-running counter
15311344
15321345   case IO_OCRH:
1533      if(!(cpustate->pending_tcsr&TCSR_OCF) && !space.debugger_access())
1346      if(!(m_pending_tcsr&TCSR_OCF) && !space.debugger_access())
15341347      {
1535         cpustate->tcsr &= ~TCSR_OCF;
1348         m_tcsr &= ~TCSR_OCF;
15361349         MODIFIED_tcsr;
15371350      }
1538      data = cpustate->output_compare.b.h;
1351      data = m_output_compare.b.h;
15391352      break;
15401353
15411354   case IO_OCRL:
1542      if(!(cpustate->pending_tcsr&TCSR_OCF) && !space.debugger_access())
1355      if(!(m_pending_tcsr&TCSR_OCF) && !space.debugger_access())
15431356      {
1544         cpustate->tcsr &= ~TCSR_OCF;
1357         m_tcsr &= ~TCSR_OCF;
15451358         MODIFIED_tcsr;
15461359      }
1547      data = cpustate->output_compare.b.l;
1360      data = m_output_compare.b.l;
15481361      break;
15491362
15501363   case IO_ICRH:
1551      if(!(cpustate->pending_tcsr&TCSR_ICF) && !space.debugger_access())
1364      if(!(m_pending_tcsr&TCSR_ICF) && !space.debugger_access())
15521365      {
1553         cpustate->tcsr &= ~TCSR_ICF;
1366         m_tcsr &= ~TCSR_ICF;
15541367         MODIFIED_tcsr;
15551368      }
1556      data = (cpustate->input_capture >> 0) & 0xff;
1369      data = (m_input_capture >> 0) & 0xff;
15571370      break;
15581371
15591372   case IO_ICRL:
1560      data = (cpustate->input_capture >> 8) & 0xff;
1373      data = (m_input_capture >> 8) & 0xff;
15611374      break;
15621375
15631376   case IO_P3CSR:
1564      if ((cpustate->p3csr & M6801_P3CSR_IS3_FLAG) && !space.debugger_access())
1377      if ((m_p3csr & M6801_P3CSR_IS3_FLAG) && !space.debugger_access())
15651378      {
1566         cpustate->p3csr_is3_flag_read = 1;
1379         m_p3csr_is3_flag_read = 1;
15671380      }
15681381
1569      data = cpustate->p3csr;
1382      data = m_p3csr;
15701383      break;
15711384
15721385   case IO_RMCR:
1573      data = cpustate->rmcr;
1386      data = m_rmcr;
15741387      break;
15751388
15761389   case IO_TRCSR:
15771390      if (!space.debugger_access())
15781391      {
1579         if (cpustate->trcsr & M6800_TRCSR_TDRE)
1392         if (m_trcsr & M6800_TRCSR_TDRE)
15801393         {
1581            cpustate->trcsr_read_tdre = 1;
1394            m_trcsr_read_tdre = 1;
15821395         }
15831396
1584         if (cpustate->trcsr & M6800_TRCSR_ORFE)
1397         if (m_trcsr & M6800_TRCSR_ORFE)
15851398         {
1586            cpustate->trcsr_read_orfe = 1;
1399            m_trcsr_read_orfe = 1;
15871400         }
15881401
1589         if (cpustate->trcsr & M6800_TRCSR_RDRF)
1402         if (m_trcsr & M6800_TRCSR_RDRF)
15901403         {
1591            cpustate->trcsr_read_rdrf = 1;
1404            m_trcsr_read_rdrf = 1;
15921405         }
15931406      }
15941407
1595      data = cpustate->trcsr;
1408      data = m_trcsr;
15961409      break;
15971410
15981411   case IO_RDR:
15991412      if (!space.debugger_access())
16001413      {
1601         if (cpustate->trcsr_read_orfe)
1414         if (m_trcsr_read_orfe)
16021415         {
16031416            //logerror("M6801 '%s' Cleared ORFE\n", space.device().tag());
1604            cpustate->trcsr_read_orfe = 0;
1605            cpustate->trcsr &= ~M6800_TRCSR_ORFE;
1417            m_trcsr_read_orfe = 0;
1418            m_trcsr &= ~M6800_TRCSR_ORFE;
16061419         }
16071420
1608         if (cpustate->trcsr_read_rdrf)
1421         if (m_trcsr_read_rdrf)
16091422         {
16101423            //logerror("M6801 '%s' Cleared RDRF\n", space.device().tag());
1611            cpustate->trcsr_read_rdrf = 0;
1612            cpustate->trcsr &= ~M6800_TRCSR_RDRF;
1424            m_trcsr_read_rdrf = 0;
1425            m_trcsr &= ~M6800_TRCSR_RDRF;
16131426         }
16141427      }
16151428
1616      data = cpustate->rdr;
1429      data = m_rdr;
16171430      break;
16181431
16191432   case IO_TDR:
1620      data = cpustate->tdr;
1433      data = m_tdr;
16211434      break;
16221435
16231436   case IO_RCR:
1624      data = cpustate->ram_ctrl;
1437      data = m_ram_ctrl;
16251438      break;
16261439
16271440   case IO_CAAH:
r24794r24795
16421455   return data;
16431456}
16441457
1645WRITE8_HANDLER( m6801_io_w )
1458WRITE8_MEMBER( m6800_cpu_device::m6801_io_w )
16461459{
1647   m6800_state *cpustate = get_safe_token(&space.device());
1648
16491460   switch (offset)
16501461   {
16511462   case IO_P1DDR:
16521463      //logerror("M6801 '%s' Port 1 Data Direction Register: %02x\n", space.device().tag(), data);
16531464
1654      if (cpustate->port1_ddr != data)
1465      if (m_port1_ddr != data)
16551466      {
1656         cpustate->port1_ddr = data;
1657         if(cpustate->port1_ddr == 0xff)
1658            cpustate->io->write_byte(M6801_PORT1,cpustate->port1_data);
1467         m_port1_ddr = data;
1468         if(m_port1_ddr == 0xff)
1469            m_io->write_byte(M6801_PORT1,m_port1_data);
16591470         else
1660            cpustate->io->write_byte(M6801_PORT1,(cpustate->port1_data & cpustate->port1_ddr) | (cpustate->port1_ddr ^ 0xff));
1471            m_io->write_byte(M6801_PORT1,(m_port1_data & m_port1_ddr) | (m_port1_ddr ^ 0xff));
16611472      }
16621473      break;
16631474
16641475   case IO_P2DDR:
16651476      //logerror("M6801 '%s' Port 2 Data Direction Register: %02x\n", space.device().tag(), data);
16661477
1667      if (cpustate->port2_ddr != data)
1478      if (m_port2_ddr != data)
16681479      {
1669         cpustate->port2_ddr = data;
1670         write_port2(cpustate);
1480         m_port2_ddr = data;
1481         write_port2();
16711482
1672         if (cpustate->port2_ddr & 2)
1483         if (m_port2_ddr & 2)
16731484            logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space.device().tag(),space.device().safe_pc());
16741485      }
16751486      break;
r24794r24795
16771488   case IO_P1DATA:
16781489      //logerror("M6801 '%s' Port 1 Data Register: %02x\n", space.device().tag(), data);
16791490
1680      cpustate->port1_data = data;
1681      if(cpustate->port1_ddr == 0xff)
1682         cpustate->io->write_byte(M6801_PORT1,cpustate->port1_data);
1491      m_port1_data = data;
1492      if(m_port1_ddr == 0xff)
1493         m_io->write_byte(M6801_PORT1,m_port1_data);
16831494      else
1684         cpustate->io->write_byte(M6801_PORT1,(cpustate->port1_data & cpustate->port1_ddr) | (cpustate->port1_ddr ^ 0xff));
1495         m_io->write_byte(M6801_PORT1,(m_port1_data & m_port1_ddr) | (m_port1_ddr ^ 0xff));
16851496      break;
16861497
16871498   case IO_P2DATA:
16881499      //logerror("M6801 '%s' Port 2 Data Register: %02x\n", space.device().tag(), data);
16891500
1690      cpustate->port2_data = data;
1691      cpustate->port2_written = 1;
1692      write_port2(cpustate);
1501      m_port2_data = data;
1502      m_port2_written = 1;
1503      write_port2();
16931504      break;
16941505
16951506   case IO_P3DDR:
16961507      //logerror("M6801 '%s' Port 3 Data Direction Register: %02x\n", space.device().tag(), data);
16971508
1698      if (cpustate->port3_ddr != data)
1509      if (m_port3_ddr != data)
16991510      {
1700         cpustate->port3_ddr = data;
1701         if(cpustate->port3_ddr == 0xff)
1702            cpustate->io->write_byte(M6801_PORT3,cpustate->port3_data);
1511         m_port3_ddr = data;
1512         if(m_port3_ddr == 0xff)
1513            m_io->write_byte(M6801_PORT3,m_port3_data);
17031514         else
1704            cpustate->io->write_byte(M6801_PORT3,(cpustate->port3_data & cpustate->port3_ddr) | (cpustate->port3_ddr ^ 0xff));
1515            m_io->write_byte(M6801_PORT3,(m_port3_data & m_port3_ddr) | (m_port3_ddr ^ 0xff));
17051516      }
17061517      break;
17071518
17081519   case IO_P4DDR:
17091520      //logerror("M6801 '%s' Port 4 Data Direction Register: %02x\n", space.device().tag(), data);
17101521
1711      if (cpustate->port4_ddr != data)
1522      if (m_port4_ddr != data)
17121523      {
1713         cpustate->port4_ddr = data;
1714         if(cpustate->port4_ddr == 0xff)
1715            cpustate->io->write_byte(M6801_PORT4,cpustate->port4_data);
1524         m_port4_ddr = data;
1525         if(m_port4_ddr == 0xff)
1526            m_io->write_byte(M6801_PORT4,m_port4_data);
17161527         else
1717            cpustate->io->write_byte(M6801_PORT4,(cpustate->port4_data & cpustate->port4_ddr) | (cpustate->port4_ddr ^ 0xff));
1528            m_io->write_byte(M6801_PORT4,(m_port4_data & m_port4_ddr) | (m_port4_ddr ^ 0xff));
17181529      }
17191530      break;
17201531
17211532   case IO_P3DATA:
17221533      //logerror("M6801 '%s' Port 3 Data Register: %02x\n", space.device().tag(), data);
17231534
1724      if (cpustate->p3csr_is3_flag_read)
1535      if (m_p3csr_is3_flag_read)
17251536      {
17261537         //logerror("M6801 '%s' Cleared IS3\n", space.device().tag());
1727         cpustate->p3csr &= ~M6801_P3CSR_IS3_FLAG;
1728         cpustate->p3csr_is3_flag_read = 0;
1538         m_p3csr &= ~M6801_P3CSR_IS3_FLAG;
1539         m_p3csr_is3_flag_read = 0;
17291540      }
17301541
1731      if (cpustate->p3csr & M6801_P3CSR_OSS)
1542      if (m_p3csr & M6801_P3CSR_OSS)
17321543      {
1733         set_os3(cpustate, ASSERT_LINE);
1544         set_os3(ASSERT_LINE);
17341545      }
17351546
1736      cpustate->port3_data = data;
1737      if(cpustate->port3_ddr == 0xff)
1738         cpustate->io->write_byte(M6801_PORT3,cpustate->port3_data);
1547      m_port3_data = data;
1548      if(m_port3_ddr == 0xff)
1549         m_io->write_byte(M6801_PORT3,m_port3_data);
17391550      else
1740         cpustate->io->write_byte(M6801_PORT3,(cpustate->port3_data & cpustate->port3_ddr) | (cpustate->port3_ddr ^ 0xff));
1551         m_io->write_byte(M6801_PORT3,(m_port3_data & m_port3_ddr) | (m_port3_ddr ^ 0xff));
17411552
1742      if (cpustate->p3csr & M6801_P3CSR_OSS)
1553      if (m_p3csr & M6801_P3CSR_OSS)
17431554      {
1744         set_os3(cpustate, CLEAR_LINE);
1555         set_os3(CLEAR_LINE);
17451556      }
17461557      break;
17471558
17481559   case IO_P4DATA:
17491560      //logerror("M6801 '%s' Port 4 Data Register: %02x\n", space.device().tag(), data);
17501561
1751      cpustate->port4_data = data;
1752      if(cpustate->port4_ddr == 0xff)
1753         cpustate->io->write_byte(M6801_PORT4,cpustate->port4_data);
1562      m_port4_data = data;
1563      if(m_port4_ddr == 0xff)
1564         m_io->write_byte(M6801_PORT4,m_port4_data);
17541565      else
1755         cpustate->io->write_byte(M6801_PORT4,(cpustate->port4_data & cpustate->port4_ddr) | (cpustate->port4_ddr ^ 0xff));
1566         m_io->write_byte(M6801_PORT4,(m_port4_data & m_port4_ddr) | (m_port4_ddr ^ 0xff));
17561567      break;
17571568
17581569   case IO_TCSR:
17591570      //logerror("M6801 '%s' Timer Control and Status Register: %02x\n", space.device().tag(), data);
17601571
1761      cpustate->tcsr = data;
1762      cpustate->pending_tcsr &= cpustate->tcsr;
1572      m_tcsr = data;
1573      m_pending_tcsr &= m_tcsr;
17631574      MODIFIED_tcsr;
17641575      if( !(CC & 0x10) )
1765         m6800_check_irq2(cpustate);
1576         m6800_check_irq2();
17661577      break;
17671578
17681579   case IO_CH:
17691580      //logerror("M6801 '%s' Counter High Register: %02x\n", space.device().tag(), data);
17701581
1771      cpustate->latch09 = data & 0xff;    /* 6301 only */
1582      m_latch09 = data & 0xff;    /* 6301 only */
17721583      CT  = 0xfff8;
17731584      TOH = CTH;
17741585      MODIFIED_counters;
r24794r24795
17771588   case IO_CL: /* 6301 only */
17781589      //logerror("M6801 '%s' Counter Low Register: %02x\n", space.device().tag(), data);
17791590
1780      CT = (cpustate->latch09 << 8) | (data & 0xff);
1591      CT = (m_latch09 << 8) | (data & 0xff);
17811592      TOH = CTH;
17821593      MODIFIED_counters;
17831594      break;
r24794r24795
17851596   case IO_OCRH:
17861597      //logerror("M6801 '%s' Output Compare High Register: %02x\n", space.device().tag(), data);
17871598
1788      if( cpustate->output_compare.b.h != data)
1599      if( m_output_compare.b.h != data)
17891600      {
1790         cpustate->output_compare.b.h = data;
1601         m_output_compare.b.h = data;
17911602         MODIFIED_counters;
17921603      }
17931604      break;
r24794r24795
17951606   case IO_OCRL:
17961607      //logerror("M6801 '%s' Output Compare Low Register: %02x\n", space.device().tag(), data);
17971608
1798      if( cpustate->output_compare.b.l != data)
1609      if( m_output_compare.b.l != data)
17991610      {
1800         cpustate->output_compare.b.l = data;
1611         m_output_compare.b.l = data;
18011612         MODIFIED_counters;
18021613      }
18031614      break;
r24794r24795
18111622   case IO_P3CSR:
18121623      //logerror("M6801 '%s' Port 3 Control and Status Register: %02x\n", space.device().tag(), data);
18131624
1814      cpustate->p3csr = data;
1625      m_p3csr = data;
18151626      break;
18161627
18171628   case IO_RMCR:
18181629      //logerror("M6801 '%s' Rate and Mode Control Register: %02x\n", space.device().tag(), data);
18191630
1820      set_rmcr(cpustate, data);
1631      set_rmcr(data);
18211632      break;
18221633
18231634   case IO_TRCSR:
18241635      //logerror("M6801 '%s' Transmit/Receive Control and Status Register: %02x\n", space.device().tag(), data);
18251636
1826      if ((data & M6800_TRCSR_TE) && !(cpustate->trcsr & M6800_TRCSR_TE))
1637      if ((data & M6800_TRCSR_TE) && !(m_trcsr & M6800_TRCSR_TE))
18271638      {
1828         cpustate->txstate = M6800_TX_STATE_INIT;
1829         cpustate->txbits = 0;
1830         cpustate->tx = 1;
1639         m_txstate = M6800_TX_STATE_INIT;
1640         m_txbits = 0;
1641         m_tx = 1;
18311642      }
18321643
1833      if ((data & M6800_TRCSR_RE) && !(cpustate->trcsr & M6800_TRCSR_RE))
1644      if ((data & M6800_TRCSR_RE) && !(m_trcsr & M6800_TRCSR_RE))
18341645      {
1835         cpustate->rxbits = 0;
1646         m_rxbits = 0;
18361647      }
18371648
1838      cpustate->trcsr = (cpustate->trcsr & 0xe0) | (data & 0x1f);
1649      m_trcsr = (m_trcsr & 0xe0) | (data & 0x1f);
18391650      break;
18401651
18411652   case IO_TDR:
18421653      //logerror("M6800 '%s' Transmit Data Register: %02x\n", space.device().tag(), data);
18431654
1844      if (cpustate->trcsr_read_tdre)
1655      if (m_trcsr_read_tdre)
18451656      {
1846         cpustate->trcsr_read_tdre = 0;
1847         cpustate->trcsr &= ~M6800_TRCSR_TDRE;
1657         m_trcsr_read_tdre = 0;
1658         m_trcsr &= ~M6800_TRCSR_TDRE;
18481659      }
1849      cpustate->tdr = data;
1660      m_tdr = data;
18501661      break;
18511662
18521663   case IO_RCR:
18531664      //logerror("M6801 '%s' RAM Control Register: %02x\n", space.device().tag(), data);
18541665
1855      cpustate->ram_ctrl = data;
1666      m_ram_ctrl = data;
18561667      break;
18571668
18581669   case IO_CAAH:
r24794r24795
18731684}
18741685
18751686
1876/**************************************************************************
1877 * Generic set_info
1878 **************************************************************************/
1879
1880static CPU_SET_INFO( m6800 )
1687offs_t m6800_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
18811688{
1882   m6800_state *cpustate = get_safe_token(device);
1883
1884   switch (state)
1885   {
1886      /* --- the following bits of info are set as 64-bit signed integers --- */
1887      case CPUINFO_INT_INPUT_STATE + M6800_IRQ_LINE:  set_irq_line(cpustate, M6800_IRQ_LINE, info->i);    break;
1888      case CPUINFO_INT_INPUT_STATE + M6801_TIN_LINE:  set_irq_line(cpustate, M6801_TIN_LINE, info->i);    break;
1889      case CPUINFO_INT_INPUT_STATE + M6801_SC1_LINE:  set_irq_line(cpustate, M6801_SC1_LINE, info->i);    break;
1890      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:  set_irq_line(cpustate, INPUT_LINE_NMI, info->i);    break;
1891
1892      case CPUINFO_INT_PC:                            PC = info->i;                               break;
1893      case CPUINFO_INT_REGISTER + M6800_PC:           cpustate->pc.w.l = info->i;                 break;
1894      case CPUINFO_INT_SP:                            S = info->i;                            break;
1895      case CPUINFO_INT_REGISTER + M6800_S:            cpustate->s.w.l = info->i;                  break;
1896      case CPUINFO_INT_REGISTER + M6800_CC:           cpustate->cc = info->i;                     break;
1897      case CPUINFO_INT_REGISTER + M6800_A:            cpustate->d.b.h = info->i;                  break;
1898      case CPUINFO_INT_REGISTER + M6800_B:            cpustate->d.b.l = info->i;                  break;
1899      case CPUINFO_INT_REGISTER + M6800_X:            cpustate->x.w.l = info->i;                  break;
1900   }
1689   extern CPU_DISASSEMBLE( m6800 );
1690   return CPU_DISASSEMBLE_NAME(m6800)(this, buffer, pc, oprom, opram, options);
19011691}
19021692
19031693
1904
1905/**************************************************************************
1906 * Generic get_info
1907 **************************************************************************/
1908
1909CPU_GET_INFO( m6800 )
1694offs_t m6801_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
19101695{
1911   m6800_state *cpustate = (device != NULL && device->token() != NULL) ? get_safe_token(device) : NULL;
1912   switch (state)
1913   {
1914      /* --- the following bits of info are returned as 64-bit signed integers --- */
1915      case CPUINFO_INT_CONTEXT_SIZE:                  info->i = sizeof(m6800_state);          break;
1916      case CPUINFO_INT_INPUT_LINES:                   info->i = 2;                            break;
1917      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:            info->i = 0;                            break;
1918      case CPUINFO_INT_ENDIANNESS:                    info->i = ENDIANNESS_BIG;               break;
1919      case CPUINFO_INT_CLOCK_MULTIPLIER:              info->i = 1;                            break;
1920      case CPUINFO_INT_CLOCK_DIVIDER:                 info->i = 1;                            break;
1921      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 1;                            break;
1922      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 4;                            break;
1923      case CPUINFO_INT_MIN_CYCLES:                    info->i = 1;                            break;
1924      case CPUINFO_INT_MAX_CYCLES:                    info->i = 12;                           break;
1925
1926      case CPUINFO_INT_DATABUS_WIDTH + AS_PROGRAM:    info->i = 8;                    break;
1927      case CPUINFO_INT_ADDRBUS_WIDTH + AS_PROGRAM: info->i = 16;                  break;
1928      case CPUINFO_INT_ADDRBUS_SHIFT + AS_PROGRAM: info->i = 0;                   break;
1929      case CPUINFO_INT_DATABUS_WIDTH + AS_DATA:   info->i = 0;                    break;
1930      case CPUINFO_INT_ADDRBUS_WIDTH + AS_DATA:   info->i = 0;                    break;
1931      case CPUINFO_INT_ADDRBUS_SHIFT + AS_DATA:   info->i = 0;                    break;
1932      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 0;                    break;
1933      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 0;                    break;
1934      case CPUINFO_INT_ADDRBUS_SHIFT + AS_IO:     info->i = 0;                    break;
1935
1936      case CPUINFO_INT_INPUT_STATE + M6800_IRQ_LINE:  info->i = cpustate->irq_state[M6800_IRQ_LINE]; break;
1937      case CPUINFO_INT_INPUT_STATE + M6801_TIN_LINE:  info->i = cpustate->irq_state[M6801_TIN_LINE]; break;
1938      case CPUINFO_INT_INPUT_STATE + M6801_SC1_LINE:  info->i = cpustate->irq_state[M6801_SC1_LINE]; break;
1939      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:  info->i = cpustate->nmi_state;              break;
1940
1941      case CPUINFO_INT_PREVIOUSPC:                    info->i = cpustate->ppc.w.l;                break;
1942
1943      case CPUINFO_INT_PC:                            info->i = PC;                           break;
1944      case CPUINFO_INT_REGISTER + M6800_PC:           info->i = cpustate->pc.w.l;                 break;
1945      case CPUINFO_INT_SP:                            info->i = S;                            break;
1946      case CPUINFO_INT_REGISTER + M6800_S:            info->i = cpustate->s.w.l;                  break;
1947      case CPUINFO_INT_REGISTER + M6800_CC:           info->i = cpustate->cc;                     break;
1948      case CPUINFO_INT_REGISTER + M6800_A:            info->i = cpustate->d.b.h;                  break;
1949      case CPUINFO_INT_REGISTER + M6800_B:            info->i = cpustate->d.b.l;                  break;
1950      case CPUINFO_INT_REGISTER + M6800_X:            info->i = cpustate->x.w.l;                  break;
1951      case CPUINFO_INT_REGISTER + M6800_WAI_STATE:    info->i = cpustate->wai_state;              break;
1952
1953      /* --- the following bits of info are returned as pointers to data or functions --- */
1954      case CPUINFO_FCT_SET_INFO:                      info->setinfo = CPU_SET_INFO_NAME(m6800);           break;
1955      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(m6800);              break;
1956      case CPUINFO_FCT_RESET:                         info->reset = CPU_RESET_NAME(m6800);                break;
1957      case CPUINFO_FCT_EXIT:                          info->exit = CPU_EXIT_NAME(m6800);              break;
1958      case CPUINFO_FCT_EXECUTE:                       info->execute = CPU_EXECUTE_NAME(m6800);            break;
1959      case CPUINFO_FCT_BURN:                          info->burn = NULL;                      break;
1960      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(m6800);            break;
1961      case CPUINFO_PTR_INSTRUCTION_COUNTER:           info->icount = &cpustate->icount;           break;
1962
1963      /* --- the following bits of info are returned as NULL-terminated strings --- */
1964      case CPUINFO_STR_NAME:                          strcpy(info->s, "M6800");               break;
1965      case CPUINFO_STR_FAMILY:                    strcpy(info->s, "Motorola 6800");       break;
1966      case CPUINFO_STR_VERSION:                   strcpy(info->s, "1.1");                 break;
1967      case CPUINFO_STR_SOURCE_FILE:                       strcpy(info->s, __FILE__);              break;
1968      case CPUINFO_STR_CREDITS:                   strcpy(info->s, "The MAME team.");      break;
1969
1970      case CPUINFO_STR_FLAGS:
1971         sprintf(info->s, "%c%c%c%c%c%c%c%c",
1972            cpustate->cc & 0x80 ? '?':'.',
1973            cpustate->cc & 0x40 ? '?':'.',
1974            cpustate->cc & 0x20 ? 'H':'.',
1975            cpustate->cc & 0x10 ? 'I':'.',
1976            cpustate->cc & 0x08 ? 'N':'.',
1977            cpustate->cc & 0x04 ? 'Z':'.',
1978            cpustate->cc & 0x02 ? 'V':'.',
1979            cpustate->cc & 0x01 ? 'C':'.');
1980         break;
1981
1982      case CPUINFO_STR_REGISTER + M6800_A:            sprintf(info->s, "A:%02X", cpustate->d.b.h); break;
1983      case CPUINFO_STR_REGISTER + M6800_B:            sprintf(info->s, "B:%02X", cpustate->d.b.l); break;
1984      case CPUINFO_STR_REGISTER + M6800_PC:           sprintf(info->s, "PC:%04X", cpustate->pc.w.l); break;
1985      case CPUINFO_STR_REGISTER + M6800_S:            sprintf(info->s, "S:%04X", cpustate->s.w.l); break;
1986      case CPUINFO_STR_REGISTER + M6800_X:            sprintf(info->s, "X:%04X", cpustate->x.w.l); break;
1987      case CPUINFO_STR_REGISTER + M6800_CC:           sprintf(info->s, "CC:%02X", cpustate->cc); break;
1988      case CPUINFO_STR_REGISTER + M6800_WAI_STATE:    sprintf(info->s, "WAI:%X", cpustate->wai_state); break;
1989   }
1696   extern CPU_DISASSEMBLE( m6801 );
1697   return CPU_DISASSEMBLE_NAME(m6801)(this, buffer, pc, oprom, opram, options);
19901698}
19911699
19921700
1993/**************************************************************************
1994 * CPU-specific set_info
1995 **************************************************************************/
1996
1997CPU_GET_INFO( m6801 )
1701offs_t m6802_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
19981702{
1999   switch (state)
2000   {
2001      /* --- the following bits of info are returned as 64-bit signed integers --- */
2002      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2003      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2004      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2005
2006      /* --- the following bits of info are returned as pointers to data or functions --- */
2007      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(m6801);              break;
2008      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(m6801);            break;
2009
2010      /* --- the following bits of info are returned as NULL-terminated strings --- */
2011      case CPUINFO_STR_NAME:                          strcpy(info->s, "M6801");               break;
2012
2013      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2014   }
1703   extern CPU_DISASSEMBLE( m6802 );
1704   return CPU_DISASSEMBLE_NAME(m6802)(this, buffer, pc, oprom, opram, options);
20151705}
20161706
20171707
2018/**************************************************************************
2019 * CPU-specific set_info
2020 **************************************************************************/
2021
2022CPU_GET_INFO( m6802 )
1708offs_t m6803_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
20231709{
2024   switch (state)
2025   {
2026      /* --- the following bits of info are returned as 64-bit signed integers --- */
2027      case CPUINFO_INT_CLOCK_DIVIDER:                 info->i = 4;                            break;
2028
2029      /* --- the following bits of info are returned as pointers to data or functions --- */
2030      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(m6802);              break;
2031      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(m6802);            break;
2032
2033      /* --- the following bits of info are returned as NULL-terminated strings --- */
2034      case CPUINFO_STR_NAME:                          strcpy(info->s, "M6802");               break;
2035
2036      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2037   }
1710   extern CPU_DISASSEMBLE( m6803 );
1711   return CPU_DISASSEMBLE_NAME(m6803)(this, buffer, pc, oprom, opram, options);
20381712}
20391713
20401714
2041/**************************************************************************
2042 * CPU-specific set_info
2043 **************************************************************************/
2044
2045CPU_GET_INFO( m6803 )
1715offs_t m6808_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
20461716{
2047   switch (state)
2048   {
2049      /* --- the following bits of info are returned as 64-bit signed integers --- */
2050      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2051      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2052      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2053
2054      /* --- the following bits of info are returned as pointers to data or functions --- */
2055      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(m6803);              break;
2056      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(m6803);            break;
2057
2058      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + AS_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(m6803_mem); break;
2059
2060      /* --- the following bits of info are returned as NULL-terminated strings --- */
2061      case CPUINFO_STR_NAME:                          strcpy(info->s, "M6803");               break;
2062
2063      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2064   }
1717   extern CPU_DISASSEMBLE( m6808 );
1718   return CPU_DISASSEMBLE_NAME(m6808)(this, buffer, pc, oprom, opram, options);
20651719}
20661720
20671721
2068/**************************************************************************
2069 * CPU-specific set_info
2070 **************************************************************************/
2071
2072CPU_GET_INFO( m6808 )
1722offs_t hd6301_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
20731723{
2074   switch (state)
2075   {
2076      /* --- the following bits of info are returned as 64-bit signed integers --- */
2077      case CPUINFO_INT_CLOCK_DIVIDER:                 info->i = 4;                            break;
2078
2079      /* --- the following bits of info are returned as pointers to data or functions --- */
2080      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(m6808);              break;
2081      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(m6808);            break;
2082
2083      /* --- the following bits of info are returned as NULL-terminated strings --- */
2084      case CPUINFO_STR_NAME:                          strcpy(info->s, "M6808");               break;
2085
2086      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2087   }
1724   extern CPU_DISASSEMBLE( hd6301 );
1725   return CPU_DISASSEMBLE_NAME(hd6301)(this, buffer, pc, oprom, opram, options);
20881726}
20891727
20901728
2091/**************************************************************************
2092 * CPU-specific set_info
2093 **************************************************************************/
2094
2095CPU_GET_INFO( hd6301 )
1729offs_t hd63701_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
20961730{
2097   switch (state)
2098   {
2099      /* --- the following bits of info are returned as 64-bit signed integers --- */
2100      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2101      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2102      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2103
2104      /* --- the following bits of info are returned as pointers to data or functions --- */
2105      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(hd6301);             break;
2106      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(hd6301);       break;
2107
2108      /* --- the following bits of info are returned as NULL-terminated strings --- */
2109      case CPUINFO_STR_NAME:                          strcpy(info->s, "HD6301");              break;
2110
2111      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2112   }
1731   extern CPU_DISASSEMBLE( hd63701 );
1732   return CPU_DISASSEMBLE_NAME(hd63701)(this, buffer, pc, oprom, opram, options);
21131733}
21141734
2115/**************************************************************************
2116 * CPU-specific set_info
2117 **************************************************************************/
21181735
2119// has integrated peripherals, not yet emulated
2120CPU_GET_INFO( hd6303r )
1736offs_t nsc8105_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
21211737{
2122   switch (state)
2123   {
2124      /* --- the following bits of info are returned as 64-bit signed integers --- */
2125      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2126      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2127      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2128
2129      /* --- the following bits of info are returned as pointers to data or functions --- */
2130      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(hd6301);             break;
2131      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(hd6301);       break;
2132
2133      /* --- the following bits of info are returned as NULL-terminated strings --- */
2134      case CPUINFO_STR_NAME:                          strcpy(info->s, "HD6303R");             break;
2135
2136      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2137   }
1738   extern CPU_DISASSEMBLE( nsc8105 );
1739   return CPU_DISASSEMBLE_NAME(nsc8105)(this, buffer, pc, oprom, opram, options);
21381740}
21391741
21401742
2141/**************************************************************************
2142 * CPU-specific set_info
2143 **************************************************************************/
2144
2145// has integrated peripherals, not yet emulated
2146CPU_GET_INFO( hd6303y )
2147{
2148   switch (state)
2149   {
2150      /* --- the following bits of info are returned as 64-bit signed integers --- */
2151      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2152      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2153      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2154
2155      /* --- the following bits of info are returned as pointers to data or functions --- */
2156      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(hd6301);             break;
2157      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(hd6301);       break;
2158
2159      /* --- the following bits of info are returned as NULL-terminated strings --- */
2160      case CPUINFO_STR_NAME:                          strcpy(info->s, "HD6303Y");             break;
2161
2162      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2163   }
2164}
2165
2166/**************************************************************************
2167 * CPU-specific set_info
2168 **************************************************************************/
2169
2170CPU_GET_INFO( hd63701 )
2171{
2172   switch (state)
2173   {
2174      /* --- the following bits of info are returned as 64-bit signed integers --- */
2175      case CPUINFO_INT_CLOCK_DIVIDER:                         info->i = 4;                    break;
2176      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:     info->i = 8;                    break;
2177      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:     info->i = 9;                    break;
2178
2179      /* --- the following bits of info are returned as pointers to data or functions --- */
2180      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(hd63701);                break;
2181      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(hd63701);      break;
2182
2183      /* --- the following bits of info are returned as NULL-terminated strings --- */
2184      case CPUINFO_STR_NAME:                          strcpy(info->s, "HD63701");             break;
2185
2186      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2187   }
2188}
2189
2190
2191/**************************************************************************
2192 * CPU-specific set_info
2193 **************************************************************************/
2194
2195CPU_GET_INFO( nsc8105 )
2196{
2197   switch (state)
2198   {
2199      /* --- the following bits of info are returned as 64-bit signed integers --- */
2200      case CPUINFO_INT_CLOCK_DIVIDER:                 info->i = 4;                            break;
2201
2202      /* --- the following bits of info are returned as pointers to data or functions --- */
2203      case CPUINFO_FCT_INIT:                          info->init = CPU_INIT_NAME(nsc8105);                break;
2204      case CPUINFO_FCT_DISASSEMBLE:                   info->disassemble = CPU_DISASSEMBLE_NAME(nsc8105);      break;
2205
2206      /* --- the following bits of info are returned as NULL-terminated strings --- */
2207      case CPUINFO_STR_NAME:                          strcpy(info->s, "NSC8105");             break;
2208
2209      default:                                        CPU_GET_INFO_CALL(m6800);               break;
2210   }
2211}
2212
2213DEFINE_LEGACY_CPU_DEVICE(M6800, m6800);
2214DEFINE_LEGACY_CPU_DEVICE(M6801, m6801);
2215DEFINE_LEGACY_CPU_DEVICE(M6802, m6802);
2216DEFINE_LEGACY_CPU_DEVICE(M6803, m6803);
2217DEFINE_LEGACY_CPU_DEVICE(M6808, m6808);
2218DEFINE_LEGACY_CPU_DEVICE(HD6301, hd6301);
2219DEFINE_LEGACY_CPU_DEVICE(HD63701, hd63701);
2220DEFINE_LEGACY_CPU_DEVICE(NSC8105, nsc8105);
2221
2222// DP-40 package: HD6303RP,  HD63A03RP,  HD63B03RP,
2223// FP-54 package: HD6303RF,  HD63A03RF,  HD63B03RF,
2224// CG-40 package: HD6303RCG, HD63A03RCG, HD63B03RCG,
2225DEFINE_LEGACY_CPU_DEVICE(HD6303R, hd6303r);
2226
2227// DP-64S package: HD6303YP,  HD63A03YP,  HD63B03YP,  HD63C03YP
2228// FP-64  package: HD6303YF,  HD63A03YF,  HD63B03YF,  HD63C03YF
2229// FP-64A package: HD6303YH,  HD63A03YH,  HD63B03YH,  HD63C03YH
2230// CP-68  package: HD6303YCP, HD63A03YCP, HD63B03YCP, HD63C03YCP
2231DEFINE_LEGACY_CPU_DEVICE(HD6303Y, hd6303y);
trunk/src/emu/cpu/m6800/6800ops.c
r24794r24795
1313
1414*/
1515
16#define OP_HANDLER(_name) INLINE void _name (m6800_state *cpustate)
16#define OP_HANDLER(_name) void m6800_cpu_device::_name ()
1717
1818//OP_HANDLER( illegal )
1919OP_HANDLER( illegal )
r24794r24795
6363{
6464   CC=A;
6565   ONE_MORE_INSN();
66   CHECK_IRQ_LINES(cpustate); /* HJB 990417 */
66   CHECK_IRQ_LINES(); /* HJB 990417 */
6767}
6868
6969/* $07 TPA inherent ----- */
r24794r24795
115115{
116116   CLI;
117117   ONE_MORE_INSN();
118   CHECK_IRQ_LINES(cpustate); /* HJB 990417 */
118   CHECK_IRQ_LINES(); /* HJB 990417 */
119119}
120120
121121/* $0f SEI */
r24794r24795
123123{
124124   SEI;
125125   ONE_MORE_INSN();
126   CHECK_IRQ_LINES(cpustate); /* HJB 990417 */
126   CHECK_IRQ_LINES(); /* HJB 990417 */
127127}
128128
129129/* $10 SBA inherent -**** */
r24794r24795
203203OP_HANDLER( slp )
204204{
205205   /* wait for next IRQ (same as waiting of wai) */
206   cpustate->wai_state |= M6800_SLP;
206   m_wai_state |= M6800_SLP;
207207   EAT_CYCLES;
208208}
209209
r24794r24795
352352/* $32 PULA inherent ----- */
353353OP_HANDLER( pula )
354354{
355   PULLBYTE(cpustate->d.b.h);
355   PULLBYTE(m_d.b.h);
356356}
357357
358358/* $33 PULB inherent ----- */
359359OP_HANDLER( pulb )
360360{
361   PULLBYTE(cpustate->d.b.l);
361   PULLBYTE(m_d.b.l);
362362}
363363
364364/* $34 DES inherent ----- */
r24794r24795
376376/* $36 PSHA inherent ----- */
377377OP_HANDLER( psha )
378378{
379   PUSHBYTE(cpustate->d.b.h);
379   PUSHBYTE(m_d.b.h);
380380}
381381
382382/* $37 PSHB inherent ----- */
383383OP_HANDLER( pshb )
384384{
385   PUSHBYTE(cpustate->d.b.l);
385   PUSHBYTE(m_d.b.l);
386386}
387387
388388/* $38 PULX inherent ----- */
r24794r24795
411411   PULLBYTE(A);
412412   PULLWORD(pX);
413413   PULLWORD(pPC);
414   CHECK_IRQ_LINES(cpustate); /* HJB 990417 */
414   CHECK_IRQ_LINES(); /* HJB 990417 */
415415}
416416
417417/* $3c PSHX inherent ----- */
r24794r24795
437437    * WAI stacks the entire machine state on the
438438    * hardware stack, then waits for an interrupt.
439439    */
440   cpustate->wai_state |= M6800_WAI;
440   m_wai_state |= M6800_WAI;
441441   PUSHWORD(pPC);
442442   PUSHWORD(pX);
443443   PUSHBYTE(A);
444444   PUSHBYTE(B);
445445   PUSHBYTE(CC);
446   CHECK_IRQ_LINES(cpustate);
447   if (cpustate->wai_state & M6800_WAI) EAT_CYCLES;
446   CHECK_IRQ_LINES();
447   if (m_wai_state & M6800_WAI) EAT_CYCLES;
448448}
449449
450450/* $3f SWI absolute indirect ----- */
r24794r24795
456456   PUSHBYTE(B);
457457   PUSHBYTE(CC);
458458   SEI;
459   PCD = RM16(cpustate, 0xfffa);
459   PCD = RM16(0xfffa);
460460}
461461
462462/* $40 NEGA inherent ?**** */
r24794r24795
10861086/* $8e LDS immediate -**0- */
10871087OP_HANDLER( lds_im )
10881088{
1089   IMMWORD(cpustate->s);
1089   IMMWORD(m_s);
10901090   CLR_NZV;
10911091   SET_NZ16(S);
10921092}
r24794r24795
10971097   CLR_NZV;
10981098   SET_NZ16(S);
10991099   IMM16;
1100   WM16(cpustate, EAD,&cpustate->s);
1100   WM16(EAD,&m_s);
11011101}
11021102
11031103/* $90 SUBA direct ?**** */
r24794r24795
12521252/* $9e LDS direct -**0- */
12531253OP_HANDLER( lds_di )
12541254{
1255   DIRWORD(cpustate->s);
1255   DIRWORD(m_s);
12561256   CLR_NZV;
12571257   SET_NZ16(S);
12581258}
r24794r24795
12631263   CLR_NZV;
12641264   SET_NZ16(S);
12651265   DIRECT;
1266   WM16(cpustate, EAD,&cpustate->s);
1266   WM16(EAD,&m_s);
12671267}
12681268
12691269/* $a0 SUBA indexed ?**** */
r24794r24795
14261426/* $ae LDS indexed -**0- */
14271427OP_HANDLER( lds_ix )
14281428{
1429   IDXWORD(cpustate->s);
1429   IDXWORD(m_s);
14301430   CLR_NZV;
14311431   SET_NZ16(S);
14321432}
r24794r24795
14371437   CLR_NZV;
14381438   SET_NZ16(S);
14391439   INDEXED;
1440   WM16(cpustate, EAD,&cpustate->s);
1440   WM16(EAD,&m_s);
14411441}
14421442
14431443/* $b0 SUBA extended ?**** */
r24794r24795
16021602/* $be LDS extended -**0- */
16031603OP_HANDLER( lds_ex )
16041604{
1605   EXTWORD(cpustate->s);
1605   EXTWORD(m_s);
16061606   CLR_NZV;
16071607   SET_NZ16(S);
16081608}
r24794r24795
16131613   CLR_NZV;
16141614   SET_NZ16(S);
16151615   EXTENDED;
1616   WM16(cpustate, EAD,&cpustate->s);
1616   WM16(EAD,&m_s);
16171617}
16181618
16191619/* $c0 SUBB immediate ?**** */
r24794r24795
17461746/* $CC LDD immediate -**0- */
17471747OP_HANDLER( ldd_im )
17481748{
1749   IMMWORD(cpustate->d);
1749   IMMWORD(m_d);
17501750   CLR_NZV;
17511751   SET_NZ16(D);
17521752}
r24794r24795
17581758   IMM16;
17591759   CLR_NZV;
17601760   SET_NZ16(D);
1761   WM16(cpustate, EAD,&cpustate->d);
1761   WM16(EAD,&m_d);
17621762}
17631763
17641764/* $ce LDX immediate -**0- */
17651765OP_HANDLER( ldx_im )
17661766{
1767   IMMWORD(cpustate->x);
1767   IMMWORD(m_x);
17681768   CLR_NZV;
17691769   SET_NZ16(X);
17701770}
r24794r24795
17751775   CLR_NZV;
17761776   SET_NZ16(X);
17771777   IMM16;
1778   WM16(cpustate, EAD,&cpustate->x);
1778   WM16(EAD,&m_x);
17791779}
17801780
17811781/* $d0 SUBB direct ?**** */
r24794r24795
19071907/* $dc LDD direct -**0- */
19081908OP_HANDLER( ldd_di )
19091909{
1910   DIRWORD(cpustate->d);
1910   DIRWORD(m_d);
19111911   CLR_NZV;
19121912   SET_NZ16(D);
19131913}
r24794r24795
19181918   DIRECT;
19191919   CLR_NZV;
19201920   SET_NZ16(D);
1921   WM16(cpustate, EAD,&cpustate->d);
1921   WM16(EAD,&m_d);
19221922}
19231923
19241924/* $de LDX direct -**0- */
19251925OP_HANDLER( ldx_di )
19261926{
1927   DIRWORD(cpustate->x);
1927   DIRWORD(m_x);
19281928   CLR_NZV;
19291929   SET_NZ16(X);
19301930}
r24794r24795
19351935   CLR_NZV;
19361936   SET_NZ16(X);
19371937   DIRECT;
1938   WM16(cpustate, EAD,&cpustate->x);
1938   WM16(EAD,&m_x);
19391939}
19401940
19411941/* $e0 SUBB indexed ?**** */
r24794r24795
20672067/* $ec LDD indexed -**0- */
20682068OP_HANDLER( ldd_ix )
20692069{
2070   IDXWORD(cpustate->d);
2070   IDXWORD(m_d);
20712071   CLR_NZV;
20722072   SET_NZ16(D);
20732073}
r24794r24795
20902090   INDEXED;
20912091   CLR_NZV;
20922092   SET_NZ16(D);
2093   WM16(cpustate, EAD,&cpustate->d);
2093   WM16(EAD,&m_d);
20942094}
20952095
20962096/* $ee LDX indexed -**0- */
20972097OP_HANDLER( ldx_ix )
20982098{
2099   IDXWORD(cpustate->x);
2099   IDXWORD(m_x);
21002100   CLR_NZV;
21012101   SET_NZ16(X);
21022102}
r24794r24795
21072107   CLR_NZV;
21082108   SET_NZ16(X);
21092109   INDEXED;
2110   WM16(cpustate, EAD,&cpustate->x);
2110   WM16(EAD,&m_x);
21112111}
21122112
21132113/* $f0 SUBB extended ?**** */
r24794r24795
22392239/* $fc LDD extended -**0- */
22402240OP_HANDLER( ldd_ex )
22412241{
2242   EXTWORD(cpustate->d);
2242   EXTWORD(m_d);
22432243   CLR_NZV;
22442244   SET_NZ16(D);
22452245}
r24794r24795
22632263   EXTENDED;
22642264   CLR_NZV;
22652265   SET_NZ16(D);
2266   WM16(cpustate, EAD,&cpustate->d);
2266   WM16(EAD,&m_d);
22672267}
22682268
22692269/* $fe LDX extended -**0- */
22702270OP_HANDLER( ldx_ex )
22712271{
2272   EXTWORD(cpustate->x);
2272   EXTWORD(m_x);
22732273   CLR_NZV;
22742274   SET_NZ16(X);
22752275}
r24794r24795
22802280   CLR_NZV;
22812281   SET_NZ16(X);
22822282   EXTENDED;
2283   WM16(cpustate, EAD,&cpustate->x);
2283   WM16(EAD,&m_x);
22842284}
trunk/src/emu/cpu/m6800/6800tbl.c
r24794r24795
1INLINE void aba(m6800_state *cpustate);
2INLINE void abx(m6800_state *cpustate);
3INLINE void adca_di(m6800_state *cpustate);
4INLINE void adca_ex(m6800_state *cpustate);
5INLINE void adca_im(m6800_state *cpustate);
6INLINE void adca_ix(m6800_state *cpustate);
7INLINE void adcb_di(m6800_state *cpustate);
8INLINE void adcb_ex(m6800_state *cpustate);
9INLINE void adcb_im(m6800_state *cpustate);
10INLINE void adcb_ix(m6800_state *cpustate);
11INLINE void adcx_im(m6800_state *cpustate);
12INLINE void adda_di(m6800_state *cpustate);
13INLINE void adda_ex(m6800_state *cpustate);
14INLINE void adda_im(m6800_state *cpustate);
15INLINE void adda_ix(m6800_state *cpustate);
16INLINE void addb_di(m6800_state *cpustate);
17INLINE void addb_ex(m6800_state *cpustate);
18INLINE void addb_im(m6800_state *cpustate);
19INLINE void addb_ix(m6800_state *cpustate);
20INLINE void addd_di(m6800_state *cpustate);
21INLINE void addd_ex(m6800_state *cpustate);
22INLINE void addx_ex(m6800_state *cpustate);
23INLINE void addd_im(m6800_state *cpustate);
24INLINE void addd_ix(m6800_state *cpustate);
25INLINE void aim_di(m6800_state *cpustate);
26INLINE void aim_ix(m6800_state *cpustate);
27INLINE void anda_di(m6800_state *cpustate);
28INLINE void anda_ex(m6800_state *cpustate);
29INLINE void anda_im(m6800_state *cpustate);
30INLINE void anda_ix(m6800_state *cpustate);
31INLINE void andb_di(m6800_state *cpustate);
32INLINE void andb_ex(m6800_state *cpustate);
33INLINE void andb_im(m6800_state *cpustate);
34INLINE void andb_ix(m6800_state *cpustate);
35INLINE void asl_ex(m6800_state *cpustate);
36INLINE void asl_ix(m6800_state *cpustate);
37INLINE void asla(m6800_state *cpustate);
38INLINE void aslb(m6800_state *cpustate);
39INLINE void asld(m6800_state *cpustate);
40INLINE void asr_ex(m6800_state *cpustate);
41INLINE void asr_ix(m6800_state *cpustate);
42INLINE void asra(m6800_state *cpustate);
43INLINE void asrb(m6800_state *cpustate);
44INLINE void bcc(m6800_state *cpustate);
45INLINE void bcs(m6800_state *cpustate);
46INLINE void beq(m6800_state *cpustate);
47INLINE void bge(m6800_state *cpustate);
48INLINE void bgt(m6800_state *cpustate);
49INLINE void bhi(m6800_state *cpustate);
50INLINE void bita_di(m6800_state *cpustate);
51INLINE void bita_ex(m6800_state *cpustate);
52INLINE void bita_im(m6800_state *cpustate);
53INLINE void bita_ix(m6800_state *cpustate);
54INLINE void bitb_di(m6800_state *cpustate);
55INLINE void bitb_ex(m6800_state *cpustate);
56INLINE void bitb_im(m6800_state *cpustate);
57INLINE void bitb_ix(m6800_state *cpustate);
58INLINE void ble(m6800_state *cpustate);
59INLINE void bls(m6800_state *cpustate);
60INLINE void blt(m6800_state *cpustate);
61INLINE void bmi(m6800_state *cpustate);
62INLINE void bne(m6800_state *cpustate);
63INLINE void bpl(m6800_state *cpustate);
64INLINE void bra(m6800_state *cpustate);
65INLINE void brn(m6800_state *cpustate);
66INLINE void bsr(m6800_state *cpustate);
67INLINE void bvc(m6800_state *cpustate);
68INLINE void bvs(m6800_state *cpustate);
69INLINE void cba(m6800_state *cpustate);
70INLINE void clc(m6800_state *cpustate);
71INLINE void cli(m6800_state *cpustate);
72INLINE void clr_ex(m6800_state *cpustate);
73INLINE void clr_ix(m6800_state *cpustate);
74INLINE void clra(m6800_state *cpustate);
75INLINE void clrb(m6800_state *cpustate);
76INLINE void clv(m6800_state *cpustate);
77INLINE void cmpa_di(m6800_state *cpustate);
78INLINE void cmpa_ex(m6800_state *cpustate);
79INLINE void cmpa_im(m6800_state *cpustate);
80INLINE void cmpa_ix(m6800_state *cpustate);
81INLINE void cmpb_di(m6800_state *cpustate);
82INLINE void cmpb_ex(m6800_state *cpustate);
83INLINE void cmpb_im(m6800_state *cpustate);
84INLINE void cmpb_ix(m6800_state *cpustate);
85INLINE void cmpx_di(m6800_state *cpustate);
86INLINE void cmpx_ex(m6800_state *cpustate);
87INLINE void cmpx_im(m6800_state *cpustate);
88INLINE void cmpx_ix(m6800_state *cpustate);
89INLINE void com_ex(m6800_state *cpustate);
90INLINE void com_ix(m6800_state *cpustate);
91INLINE void coma(m6800_state *cpustate);
92INLINE void comb(m6800_state *cpustate);
93INLINE void daa(m6800_state *cpustate);
94INLINE void dec_ex(m6800_state *cpustate);
95INLINE void dec_ix(m6800_state *cpustate);
96INLINE void deca(m6800_state *cpustate);
97INLINE void decb(m6800_state *cpustate);
98INLINE void des(m6800_state *cpustate);
99INLINE void dex(m6800_state *cpustate);
100INLINE void eim_di(m6800_state *cpustate);
101INLINE void eim_ix(m6800_state *cpustate);
102INLINE void eora_di(m6800_state *cpustate);
103INLINE void eora_ex(m6800_state *cpustate);
104INLINE void eora_im(m6800_state *cpustate);
105INLINE void eora_ix(m6800_state *cpustate);
106INLINE void eorb_di(m6800_state *cpustate);
107INLINE void eorb_ex(m6800_state *cpustate);
108INLINE void eorb_im(m6800_state *cpustate);
109INLINE void eorb_ix(m6800_state *cpustate);
110INLINE void illegal(m6800_state *cpustate);
111INLINE void inc_ex(m6800_state *cpustate);
112INLINE void inc_ix(m6800_state *cpustate);
113INLINE void inca(m6800_state *cpustate);
114INLINE void incb(m6800_state *cpustate);
115INLINE void ins(m6800_state *cpustate);
116INLINE void inx(m6800_state *cpustate);
117INLINE void jmp_ex(m6800_state *cpustate);
118INLINE void jmp_ix(m6800_state *cpustate);
119INLINE void jsr_di(m6800_state *cpustate);
120INLINE void jsr_ex(m6800_state *cpustate);
121INLINE void jsr_ix(m6800_state *cpustate);
122INLINE void lda_di(m6800_state *cpustate);
123INLINE void lda_ex(m6800_state *cpustate);
124INLINE void lda_im(m6800_state *cpustate);
125INLINE void lda_ix(m6800_state *cpustate);
126INLINE void ldb_di(m6800_state *cpustate);
127INLINE void ldb_ex(m6800_state *cpustate);
128INLINE void ldb_im(m6800_state *cpustate);
129INLINE void ldb_ix(m6800_state *cpustate);
130INLINE void ldd_di(m6800_state *cpustate);
131INLINE void ldd_ex(m6800_state *cpustate);
132INLINE void ldd_im(m6800_state *cpustate);
133INLINE void ldd_ix(m6800_state *cpustate);
134INLINE void lds_di(m6800_state *cpustate);
135INLINE void lds_ex(m6800_state *cpustate);
136INLINE void lds_im(m6800_state *cpustate);
137INLINE void lds_ix(m6800_state *cpustate);
138INLINE void ldx_di(m6800_state *cpustate);
139INLINE void ldx_ex(m6800_state *cpustate);
140INLINE void ldx_im(m6800_state *cpustate);
141INLINE void ldx_ix(m6800_state *cpustate);
142INLINE void lsr_ex(m6800_state *cpustate);
143INLINE void lsr_ix(m6800_state *cpustate);
144INLINE void lsra(m6800_state *cpustate);
145INLINE void lsrb(m6800_state *cpustate);
146INLINE void lsrd(m6800_state *cpustate);
147INLINE void mul(m6800_state *cpustate);
148INLINE void neg_ex(m6800_state *cpustate);
149INLINE void neg_ix(m6800_state *cpustate);
150INLINE void nega(m6800_state *cpustate);
151INLINE void negb(m6800_state *cpustate);
152INLINE void nop(m6800_state *cpustate);
153INLINE void oim_di(m6800_state *cpustate);
154INLINE void oim_ix(m6800_state *cpustate);
155INLINE void ora_di(m6800_state *cpustate);
156INLINE void ora_ex(m6800_state *cpustate);
157INLINE void ora_im(m6800_state *cpustate);
158INLINE void ora_ix(m6800_state *cpustate);
159INLINE void orb_di(m6800_state *cpustate);
160INLINE void orb_ex(m6800_state *cpustate);
161INLINE void orb_im(m6800_state *cpustate);
162INLINE void orb_ix(m6800_state *cpustate);
163INLINE void psha(m6800_state *cpustate);
164INLINE void pshb(m6800_state *cpustate);
165INLINE void pshx(m6800_state *cpustate);
166INLINE void pula(m6800_state *cpustate);
167INLINE void pulb(m6800_state *cpustate);
168INLINE void pulx(m6800_state *cpustate);
169INLINE void rol_ex(m6800_state *cpustate);
170INLINE void rol_ix(m6800_state *cpustate);
171INLINE void rola(m6800_state *cpustate);
172INLINE void rolb(m6800_state *cpustate);
173INLINE void ror_ex(m6800_state *cpustate);
174INLINE void ror_ix(m6800_state *cpustate);
175INLINE void rora(m6800_state *cpustate);
176INLINE void rorb(m6800_state *cpustate);
177INLINE void rti(m6800_state *cpustate);
178INLINE void rts(m6800_state *cpustate);
179INLINE void sba(m6800_state *cpustate);
180INLINE void sbca_di(m6800_state *cpustate);
181INLINE void sbca_ex(m6800_state *cpustate);
182INLINE void sbca_im(m6800_state *cpustate);
183INLINE void sbca_ix(m6800_state *cpustate);
184INLINE void sbcb_di(m6800_state *cpustate);
185INLINE void sbcb_ex(m6800_state *cpustate);
186INLINE void sbcb_im(m6800_state *cpustate);
187INLINE void sbcb_ix(m6800_state *cpustate);
188INLINE void sec(m6800_state *cpustate);
189INLINE void sei(m6800_state *cpustate);
190INLINE void sev(m6800_state *cpustate);
191INLINE void slp(m6800_state *cpustate);
192INLINE void sta_di(m6800_state *cpustate);
193INLINE void sta_ex(m6800_state *cpustate);
194INLINE void sta_im(m6800_state *cpustate);
195INLINE void sta_ix(m6800_state *cpustate);
196INLINE void stb_di(m6800_state *cpustate);
197INLINE void stb_ex(m6800_state *cpustate);
198INLINE void stb_im(m6800_state *cpustate);
199INLINE void stb_ix(m6800_state *cpustate);
200INLINE void std_di(m6800_state *cpustate);
201INLINE void std_ex(m6800_state *cpustate);
202INLINE void std_im(m6800_state *cpustate);
203INLINE void std_ix(m6800_state *cpustate);
204INLINE void sts_di(m6800_state *cpustate);
205INLINE void sts_ex(m6800_state *cpustate);
206INLINE void sts_im(m6800_state *cpustate);
207INLINE void sts_ix(m6800_state *cpustate);
208INLINE void stx_di(m6800_state *cpustate);
209INLINE void stx_ex(m6800_state *cpustate);
210INLINE void stx_im(m6800_state *cpustate);
211INLINE void stx_ix(m6800_state *cpustate);
212INLINE void suba_di(m6800_state *cpustate);
213INLINE void suba_ex(m6800_state *cpustate);
214INLINE void suba_im(m6800_state *cpustate);
215INLINE void suba_ix(m6800_state *cpustate);
216INLINE void subb_di(m6800_state *cpustate);
217INLINE void subb_ex(m6800_state *cpustate);
218INLINE void subb_im(m6800_state *cpustate);
219INLINE void subb_ix(m6800_state *cpustate);
220INLINE void subd_di(m6800_state *cpustate);
221INLINE void subd_ex(m6800_state *cpustate);
222INLINE void subd_im(m6800_state *cpustate);
223INLINE void subd_ix(m6800_state *cpustate);
224INLINE void swi(m6800_state *cpustate);
225INLINE void tab(m6800_state *cpustate);
226INLINE void tap(m6800_state *cpustate);
227INLINE void tba(m6800_state *cpustate);
228INLINE void tim_di(m6800_state *cpustate);
229INLINE void tim_ix(m6800_state *cpustate);
230INLINE void tpa(m6800_state *cpustate);
231INLINE void tst_ex(m6800_state *cpustate);
232INLINE void tst_ix(m6800_state *cpustate);
233INLINE void tsta(m6800_state *cpustate);
234INLINE void tstb(m6800_state *cpustate);
235INLINE void tsx(m6800_state *cpustate);
236INLINE void txs(m6800_state *cpustate);
237INLINE void undoc1(m6800_state *cpustate);
238INLINE void undoc2(m6800_state *cpustate);
239INLINE void wai(m6800_state *cpustate);
240INLINE void xgdx(m6800_state *cpustate);
2411
242INLINE void cpx_di(m6800_state *cpustate);
243INLINE void cpx_ex(m6800_state *cpustate);
244INLINE void cpx_im(m6800_state *cpustate);
245INLINE void cpx_ix(m6800_state *cpustate);
246INLINE void trap(m6800_state *cpustate);
247
248static void (*const m6800_insn[0x100])(m6800_state *cpustate) = {
249illegal,nop,    illegal,illegal,illegal,illegal,tap,    tpa,
250inx,    dex,    clv,    sev,    clc,    sec,    cli,    sei,
251sba,    cba,    illegal,illegal,illegal,illegal,tab,    tba,
252illegal,daa,    illegal,aba,    illegal,illegal,illegal,illegal,
253bra,    brn,    bhi,    bls,    bcc,    bcs,    bne,    beq,
254bvc,    bvs,    bpl,    bmi,    bge,    blt,    bgt,    ble,
255tsx,    ins,    pula,   pulb,   des,    txs,    psha,   pshb,
256illegal,rts,    illegal,rti,    illegal,illegal,wai,    swi,
257nega,   illegal,illegal,coma,   lsra,   illegal,rora,   asra,
258asla,   rola,   deca,   illegal,inca,   tsta,   illegal,clra,
259negb,   illegal,illegal,comb,   lsrb,   illegal,rorb,   asrb,
260aslb,   rolb,   decb,   illegal,incb,   tstb,   illegal,clrb,
261neg_ix, illegal,illegal,com_ix, lsr_ix, illegal,ror_ix, asr_ix,
262asl_ix, rol_ix, dec_ix, illegal,inc_ix, tst_ix, jmp_ix, clr_ix,
263neg_ex, illegal,illegal,com_ex, lsr_ex, illegal,ror_ex, asr_ex,
264asl_ex, rol_ex, dec_ex, illegal,inc_ex, tst_ex, jmp_ex, clr_ex,
265suba_im,cmpa_im,sbca_im,illegal,anda_im,bita_im,lda_im, sta_im,
266eora_im,adca_im,ora_im, adda_im,cmpx_im,bsr,    lds_im, sts_im,
267suba_di,cmpa_di,sbca_di,illegal,anda_di,bita_di,lda_di, sta_di,
268eora_di,adca_di,ora_di, adda_di,cmpx_di,jsr_di, lds_di, sts_di,
269suba_ix,cmpa_ix,sbca_ix,illegal,anda_ix,bita_ix,lda_ix, sta_ix,
270eora_ix,adca_ix,ora_ix, adda_ix,cmpx_ix,jsr_ix, lds_ix, sts_ix,
271suba_ex,cmpa_ex,sbca_ex,illegal,anda_ex,bita_ex,lda_ex, sta_ex,
272eora_ex,adca_ex,ora_ex, adda_ex,cmpx_ex,jsr_ex, lds_ex, sts_ex,
273subb_im,cmpb_im,sbcb_im,illegal,andb_im,bitb_im,ldb_im, stb_im,
274eorb_im,adcb_im,orb_im, addb_im,illegal,illegal,ldx_im, stx_im,
275subb_di,cmpb_di,sbcb_di,illegal,andb_di,bitb_di,ldb_di, stb_di,
276eorb_di,adcb_di,orb_di, addb_di,illegal,illegal,ldx_di, stx_di,
277subb_ix,cmpb_ix,sbcb_ix,illegal,andb_ix,bitb_ix,ldb_ix, stb_ix,
278eorb_ix,adcb_ix,orb_ix, addb_ix,illegal,illegal,ldx_ix, stx_ix,
279subb_ex,cmpb_ex,sbcb_ex,illegal,andb_ex,bitb_ex,ldb_ex, stb_ex,
280eorb_ex,adcb_ex,orb_ex, addb_ex,illegal,illegal,ldx_ex, stx_ex
2const m6800_cpu_device::op_func m6800_cpu_device::m6800_insn[0x100] = {
3&m6800_cpu_device::illegal,&m6800_cpu_device::nop,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap,    &m6800_cpu_device::tpa,
4&m6800_cpu_device::inx,    &m6800_cpu_device::dex,    &m6800_cpu_device::clv,    &m6800_cpu_device::sev,    &m6800_cpu_device::clc,    &m6800_cpu_device::sec,    &m6800_cpu_device::cli,    &m6800_cpu_device::sei,
5&m6800_cpu_device::sba,    &m6800_cpu_device::cba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tab,    &m6800_cpu_device::tba,
6&m6800_cpu_device::illegal,&m6800_cpu_device::daa,    &m6800_cpu_device::illegal,&m6800_cpu_device::aba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,
7&m6800_cpu_device::bra,    &m6800_cpu_device::brn,    &m6800_cpu_device::bhi,    &m6800_cpu_device::bls,    &m6800_cpu_device::bcc,    &m6800_cpu_device::bcs,    &m6800_cpu_device::bne,    &m6800_cpu_device::beq,
8&m6800_cpu_device::bvc,    &m6800_cpu_device::bvs,    &m6800_cpu_device::bpl,    &m6800_cpu_device::bmi,    &m6800_cpu_device::bge,    &m6800_cpu_device::blt,    &m6800_cpu_device::bgt,    &m6800_cpu_device::ble,
9&m6800_cpu_device::tsx,    &m6800_cpu_device::ins,    &m6800_cpu_device::pula,   &m6800_cpu_device::pulb,   &m6800_cpu_device::des,    &m6800_cpu_device::txs,    &m6800_cpu_device::psha,   &m6800_cpu_device::pshb,
10&m6800_cpu_device::illegal,&m6800_cpu_device::rts,    &m6800_cpu_device::illegal,&m6800_cpu_device::rti,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::wai,    &m6800_cpu_device::swi,
11&m6800_cpu_device::nega,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::coma,   &m6800_cpu_device::lsra,   &m6800_cpu_device::illegal,&m6800_cpu_device::rora,   &m6800_cpu_device::asra,
12&m6800_cpu_device::asla,   &m6800_cpu_device::rola,   &m6800_cpu_device::deca,   &m6800_cpu_device::illegal,&m6800_cpu_device::inca,   &m6800_cpu_device::tsta,   &m6800_cpu_device::illegal,&m6800_cpu_device::clra,
13&m6800_cpu_device::negb,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::comb,   &m6800_cpu_device::lsrb,   &m6800_cpu_device::illegal,&m6800_cpu_device::rorb,   &m6800_cpu_device::asrb,
14&m6800_cpu_device::aslb,   &m6800_cpu_device::rolb,   &m6800_cpu_device::decb,   &m6800_cpu_device::illegal,&m6800_cpu_device::incb,   &m6800_cpu_device::tstb,   &m6800_cpu_device::illegal,&m6800_cpu_device::clrb,
15&m6800_cpu_device::neg_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ix, &m6800_cpu_device::lsr_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::ror_ix, &m6800_cpu_device::asr_ix,
16&m6800_cpu_device::asl_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::clr_ix,
17&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::ror_ex, &m6800_cpu_device::asr_ex,
18&m6800_cpu_device::asl_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::clr_ex,
19&m6800_cpu_device::suba_im,&m6800_cpu_device::cmpa_im,&m6800_cpu_device::sbca_im,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_im,&m6800_cpu_device::bita_im,&m6800_cpu_device::lda_im, &m6800_cpu_device::sta_im,
20&m6800_cpu_device::eora_im,&m6800_cpu_device::adca_im,&m6800_cpu_device::ora_im, &m6800_cpu_device::adda_im,&m6800_cpu_device::cmpx_im,&m6800_cpu_device::bsr,    &m6800_cpu_device::lds_im, &m6800_cpu_device::sts_im,
21&m6800_cpu_device::suba_di,&m6800_cpu_device::cmpa_di,&m6800_cpu_device::sbca_di,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_di,&m6800_cpu_device::bita_di,&m6800_cpu_device::lda_di, &m6800_cpu_device::sta_di,
22&m6800_cpu_device::eora_di,&m6800_cpu_device::adca_di,&m6800_cpu_device::ora_di, &m6800_cpu_device::adda_di,&m6800_cpu_device::cmpx_di,&m6800_cpu_device::jsr_di, &m6800_cpu_device::lds_di, &m6800_cpu_device::sts_di,
23&m6800_cpu_device::suba_ix,&m6800_cpu_device::cmpa_ix,&m6800_cpu_device::sbca_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ix,&m6800_cpu_device::bita_ix,&m6800_cpu_device::lda_ix, &m6800_cpu_device::sta_ix,
24&m6800_cpu_device::eora_ix,&m6800_cpu_device::adca_ix,&m6800_cpu_device::ora_ix, &m6800_cpu_device::adda_ix,&m6800_cpu_device::cmpx_ix,&m6800_cpu_device::jsr_ix, &m6800_cpu_device::lds_ix, &m6800_cpu_device::sts_ix,
25&m6800_cpu_device::suba_ex,&m6800_cpu_device::cmpa_ex,&m6800_cpu_device::sbca_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ex,&m6800_cpu_device::bita_ex,&m6800_cpu_device::lda_ex, &m6800_cpu_device::sta_ex,
26&m6800_cpu_device::eora_ex,&m6800_cpu_device::adca_ex,&m6800_cpu_device::ora_ex, &m6800_cpu_device::adda_ex,&m6800_cpu_device::cmpx_ex,&m6800_cpu_device::jsr_ex, &m6800_cpu_device::lds_ex, &m6800_cpu_device::sts_ex,
27&m6800_cpu_device::subb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_im,&m6800_cpu_device::bitb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::stb_im,
28&m6800_cpu_device::eorb_im,&m6800_cpu_device::adcb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::addb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_im, &m6800_cpu_device::stx_im,
29&m6800_cpu_device::subb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_di,&m6800_cpu_device::bitb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::stb_di,
30&m6800_cpu_device::eorb_di,&m6800_cpu_device::adcb_di,&m6800_cpu_device::orb_di, &m6800_cpu_device::addb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_di, &m6800_cpu_device::stx_di,
31&m6800_cpu_device::subb_ix,&m6800_cpu_device::cmpb_ix,&m6800_cpu_device::sbcb_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_ix,&m6800_cpu_device::bitb_ix,&m6800_cpu_device::ldb_ix, &m6800_cpu_device::stb_ix,
32&m6800_cpu_device::eorb_ix,&m6800_cpu_device::adcb_ix,&m6800_cpu_device::orb_ix, &m6800_cpu_device::addb_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_ix, &m6800_cpu_device::stx_ix,
33&m6800_cpu_device::subb_ex,&m6800_cpu_device::cmpb_ex,&m6800_cpu_device::sbcb_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_ex,&m6800_cpu_device::bitb_ex,&m6800_cpu_device::ldb_ex, &m6800_cpu_device::stb_ex,
34&m6800_cpu_device::eorb_ex,&m6800_cpu_device::adcb_ex,&m6800_cpu_device::orb_ex, &m6800_cpu_device::addb_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_ex, &m6800_cpu_device::stx_ex
28135};
28236
283static void (*const m6803_insn[0x100])(m6800_state *cpustate) = {
284illegal,nop,    illegal,illegal,lsrd,   asld,   tap,    tpa,
285inx,    dex,    clv,    sev,    clc,    sec,    cli,    sei,
286sba,    cba,    illegal,illegal,illegal,illegal,tab,    tba,
287illegal,daa,    illegal,aba,    illegal,illegal,illegal,illegal,
288bra,    brn,    bhi,    bls,    bcc,    bcs,    bne,    beq,
289bvc,    bvs,    bpl,    bmi,    bge,    blt,    bgt,    ble,
290tsx,    ins,    pula,   pulb,   des,    txs,    psha,   pshb,
291pulx,   rts,    abx,    rti,    pshx,   mul,    wai,    swi,
292nega,   illegal,illegal,coma,   lsra,   illegal,rora,   asra,
293asla,   rola,   deca,   illegal,inca,   tsta,   illegal,clra,
294negb,   illegal,illegal,comb,   lsrb,   illegal,rorb,   asrb,
295aslb,   rolb,   decb,   illegal,incb,   tstb,   illegal,clrb,
296neg_ix, illegal,illegal,com_ix, lsr_ix, illegal,ror_ix, asr_ix,
297asl_ix, rol_ix, dec_ix, illegal,inc_ix, tst_ix, jmp_ix, clr_ix,
298neg_ex, illegal,illegal,com_ex, lsr_ex, illegal,ror_ex, asr_ex,
299asl_ex, rol_ex, dec_ex, illegal,inc_ex, tst_ex, jmp_ex, clr_ex,
300suba_im,cmpa_im,sbca_im,subd_im,anda_im,bita_im,lda_im, sta_im,
301eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr,    lds_im, sts_im,
302suba_di,cmpa_di,sbca_di,subd_di,anda_di,bita_di,lda_di, sta_di,
303eora_di,adca_di,ora_di, adda_di,cpx_di ,jsr_di, lds_di, sts_di,
304suba_ix,cmpa_ix,sbca_ix,subd_ix,anda_ix,bita_ix,lda_ix, sta_ix,
305eora_ix,adca_ix,ora_ix, adda_ix,cpx_ix ,jsr_ix, lds_ix, sts_ix,
306suba_ex,cmpa_ex,sbca_ex,subd_ex,anda_ex,bita_ex,lda_ex, sta_ex,
307eora_ex,adca_ex,ora_ex, adda_ex,cpx_ex ,jsr_ex, lds_ex, sts_ex,
308subb_im,cmpb_im,sbcb_im,addd_im,andb_im,bitb_im,ldb_im, stb_im,
309eorb_im,adcb_im,orb_im, addb_im,ldd_im, std_im, ldx_im, stx_im,
310subb_di,cmpb_di,sbcb_di,addd_di,andb_di,bitb_di,ldb_di, stb_di,
311eorb_di,adcb_di,orb_di, addb_di,ldd_di, std_di, ldx_di, stx_di,
312subb_ix,cmpb_ix,sbcb_ix,addd_ix,andb_ix,bitb_ix,ldb_ix, stb_ix,
313eorb_ix,adcb_ix,orb_ix, addb_ix,ldd_ix, std_ix, ldx_ix, stx_ix,
314subb_ex,cmpb_ex,sbcb_ex,addd_ex,andb_ex,bitb_ex,ldb_ex, stb_ex,
315eorb_ex,adcb_ex,orb_ex, addb_ex,ldd_ex, std_ex, ldx_ex, stx_ex
37const m6800_cpu_device::op_func m6800_cpu_device::m6803_insn[0x100] = {
38&m6800_cpu_device::illegal,&m6800_cpu_device::nop,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::lsrd,   &m6800_cpu_device::asld,   &m6800_cpu_device::tap,    &m6800_cpu_device::tpa,
39&m6800_cpu_device::inx,    &m6800_cpu_device::dex,    &m6800_cpu_device::clv,    &m6800_cpu_device::sev,    &m6800_cpu_device::clc,    &m6800_cpu_device::sec,    &m6800_cpu_device::cli,    &m6800_cpu_device::sei,
40&m6800_cpu_device::sba,    &m6800_cpu_device::cba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tab,    &m6800_cpu_device::tba,
41&m6800_cpu_device::illegal,&m6800_cpu_device::daa,    &m6800_cpu_device::illegal,&m6800_cpu_device::aba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,
42&m6800_cpu_device::bra,    &m6800_cpu_device::brn,    &m6800_cpu_device::bhi,    &m6800_cpu_device::bls,    &m6800_cpu_device::bcc,    &m6800_cpu_device::bcs,    &m6800_cpu_device::bne,    &m6800_cpu_device::beq,
43&m6800_cpu_device::bvc,    &m6800_cpu_device::bvs,    &m6800_cpu_device::bpl,    &m6800_cpu_device::bmi,    &m6800_cpu_device::bge,    &m6800_cpu_device::blt,    &m6800_cpu_device::bgt,    &m6800_cpu_device::ble,
44&m6800_cpu_device::tsx,    &m6800_cpu_device::ins,    &m6800_cpu_device::pula,   &m6800_cpu_device::pulb,   &m6800_cpu_device::des,    &m6800_cpu_device::txs,    &m6800_cpu_device::psha,   &m6800_cpu_device::pshb,
45&m6800_cpu_device::pulx,   &m6800_cpu_device::rts,    &m6800_cpu_device::abx,    &m6800_cpu_device::rti,    &m6800_cpu_device::pshx,   &m6800_cpu_device::mul,    &m6800_cpu_device::wai,    &m6800_cpu_device::swi,
46&m6800_cpu_device::nega,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::coma,   &m6800_cpu_device::lsra,   &m6800_cpu_device::illegal,&m6800_cpu_device::rora,   &m6800_cpu_device::asra,
47&m6800_cpu_device::asla,   &m6800_cpu_device::rola,   &m6800_cpu_device::deca,   &m6800_cpu_device::illegal,&m6800_cpu_device::inca,   &m6800_cpu_device::tsta,   &m6800_cpu_device::illegal,&m6800_cpu_device::clra,
48&m6800_cpu_device::negb,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::comb,   &m6800_cpu_device::lsrb,   &m6800_cpu_device::illegal,&m6800_cpu_device::rorb,   &m6800_cpu_device::asrb,
49&m6800_cpu_device::aslb,   &m6800_cpu_device::rolb,   &m6800_cpu_device::decb,   &m6800_cpu_device::illegal,&m6800_cpu_device::incb,   &m6800_cpu_device::tstb,   &m6800_cpu_device::illegal,&m6800_cpu_device::clrb,
50&m6800_cpu_device::neg_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ix, &m6800_cpu_device::lsr_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::ror_ix, &m6800_cpu_device::asr_ix,
51&m6800_cpu_device::asl_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::clr_ix,
52&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::ror_ex, &m6800_cpu_device::asr_ex,
53&m6800_cpu_device::asl_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::clr_ex,
54&m6800_cpu_device::suba_im,&m6800_cpu_device::cmpa_im,&m6800_cpu_device::sbca_im,&m6800_cpu_device::subd_im,&m6800_cpu_device::anda_im,&m6800_cpu_device::bita_im,&m6800_cpu_device::lda_im, &m6800_cpu_device::sta_im,
55&m6800_cpu_device::eora_im,&m6800_cpu_device::adca_im,&m6800_cpu_device::ora_im, &m6800_cpu_device::adda_im,&m6800_cpu_device::cpx_im ,&m6800_cpu_device::bsr,    &m6800_cpu_device::lds_im, &m6800_cpu_device::sts_im,
56&m6800_cpu_device::suba_di,&m6800_cpu_device::cmpa_di,&m6800_cpu_device::sbca_di,&m6800_cpu_device::subd_di,&m6800_cpu_device::anda_di,&m6800_cpu_device::bita_di,&m6800_cpu_device::lda_di, &m6800_cpu_device::sta_di,
57&m6800_cpu_device::eora_di,&m6800_cpu_device::adca_di,&m6800_cpu_device::ora_di, &m6800_cpu_device::adda_di,&m6800_cpu_device::cpx_di ,&m6800_cpu_device::jsr_di, &m6800_cpu_device::lds_di, &m6800_cpu_device::sts_di,
58&m6800_cpu_device::suba_ix,&m6800_cpu_device::cmpa_ix,&m6800_cpu_device::sbca_ix,&m6800_cpu_device::subd_ix,&m6800_cpu_device::anda_ix,&m6800_cpu_device::bita_ix,&m6800_cpu_device::lda_ix, &m6800_cpu_device::sta_ix,
59&m6800_cpu_device::eora_ix,&m6800_cpu_device::adca_ix,&m6800_cpu_device::ora_ix, &m6800_cpu_device::adda_ix,&m6800_cpu_device::cpx_ix ,&m6800_cpu_device::jsr_ix, &m6800_cpu_device::lds_ix, &m6800_cpu_device::sts_ix,
60&m6800_cpu_device::suba_ex,&m6800_cpu_device::cmpa_ex,&m6800_cpu_device::sbca_ex,&m6800_cpu_device::subd_ex,&m6800_cpu_device::anda_ex,&m6800_cpu_device::bita_ex,&m6800_cpu_device::lda_ex, &m6800_cpu_device::sta_ex,
61&m6800_cpu_device::eora_ex,&m6800_cpu_device::adca_ex,&m6800_cpu_device::ora_ex, &m6800_cpu_device::adda_ex,&m6800_cpu_device::cpx_ex ,&m6800_cpu_device::jsr_ex, &m6800_cpu_device::lds_ex, &m6800_cpu_device::sts_ex,
62&m6800_cpu_device::subb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::addd_im,&m6800_cpu_device::andb_im,&m6800_cpu_device::bitb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::stb_im,
63&m6800_cpu_device::eorb_im,&m6800_cpu_device::adcb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::addb_im,&m6800_cpu_device::ldd_im, &m6800_cpu_device::std_im, &m6800_cpu_device::ldx_im, &m6800_cpu_device::stx_im,
64&m6800_cpu_device::subb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::addd_di,&m6800_cpu_device::andb_di,&m6800_cpu_device::bitb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::stb_di,
65&m6800_cpu_device::eorb_di,&m6800_cpu_device::adcb_di,&m6800_cpu_device::orb_di, &m6800_cpu_device::addb_di,&m6800_cpu_device::ldd_di, &m6800_cpu_device::std_di, &m6800_cpu_device::ldx_di, &m6800_cpu_device::stx_di,
66&m6800_cpu_device::subb_ix,&m6800_cpu_device::cmpb_ix,&m6800_cpu_device::sbcb_ix,&m6800_cpu_device::addd_ix,&m6800_cpu_device::andb_ix,&m6800_cpu_device::bitb_ix,&m6800_cpu_device::ldb_ix, &m6800_cpu_device::stb_ix,
67&m6800_cpu_device::eorb_ix,&m6800_cpu_device::adcb_ix,&m6800_cpu_device::orb_ix, &m6800_cpu_device::addb_ix,&m6800_cpu_device::ldd_ix, &m6800_cpu_device::std_ix, &m6800_cpu_device::ldx_ix, &m6800_cpu_device::stx_ix,
68&m6800_cpu_device::subb_ex,&m6800_cpu_device::cmpb_ex,&m6800_cpu_device::sbcb_ex,&m6800_cpu_device::addd_ex,&m6800_cpu_device::andb_ex,&m6800_cpu_device::bitb_ex,&m6800_cpu_device::ldb_ex, &m6800_cpu_device::stb_ex,
69&m6800_cpu_device::eorb_ex,&m6800_cpu_device::adcb_ex,&m6800_cpu_device::orb_ex, &m6800_cpu_device::addb_ex,&m6800_cpu_device::ldd_ex, &m6800_cpu_device::std_ex, &m6800_cpu_device::ldx_ex, &m6800_cpu_device::stx_ex
31670};
31771
318static void (*const hd63701_insn[0x100])(m6800_state *cpustate) = {
319trap,   nop,    trap,   trap,   lsrd,   asld,   tap,    tpa,
320inx,    dex,    clv,    sev,    clc,    sec,    cli,    sei,
321sba,    cba,    undoc1, undoc2, trap,   trap,   tab,    tba,
322xgdx,   daa,    slp,    aba,    trap,   trap,   trap,   trap,
323bra,    brn,    bhi,    bls,    bcc,    bcs,    bne,    beq,
324bvc,    bvs,    bpl,    bmi,    bge,    blt,    bgt,    ble,
325tsx,    ins,    pula,   pulb,   des,    txs,    psha,   pshb,
326pulx,   rts,    abx,    rti,    pshx,   mul,    wai,    swi,
327nega,   trap,   trap,   coma,   lsra,   trap,   rora,   asra,
328asla,   rola,   deca,   trap,   inca,   tsta,   trap,   clra,
329negb,   trap,   trap,   comb,   lsrb,   trap,   rorb,   asrb,
330aslb,   rolb,   decb,   trap,   incb,   tstb,   trap,   clrb,
331neg_ix, aim_ix, oim_ix, com_ix, lsr_ix, eim_ix, ror_ix, asr_ix,
332asl_ix, rol_ix, dec_ix, tim_ix, inc_ix, tst_ix, jmp_ix, clr_ix,
333neg_ex, aim_di, oim_di, com_ex, lsr_ex, eim_di, ror_ex, asr_ex,
334asl_ex, rol_ex, dec_ex, tim_di, inc_ex, tst_ex, jmp_ex, clr_ex,
335suba_im,cmpa_im,sbca_im,subd_im,anda_im,bita_im,lda_im, sta_im,
336eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr,    lds_im, sts_im,
337suba_di,cmpa_di,sbca_di,subd_di,anda_di,bita_di,lda_di, sta_di,
338eora_di,adca_di,ora_di, adda_di,cpx_di ,jsr_di, lds_di, sts_di,
339suba_ix,cmpa_ix,sbca_ix,subd_ix,anda_ix,bita_ix,lda_ix, sta_ix,
340eora_ix,adca_ix,ora_ix, adda_ix,cpx_ix ,jsr_ix, lds_ix, sts_ix,
341suba_ex,cmpa_ex,sbca_ex,subd_ex,anda_ex,bita_ex,lda_ex, sta_ex,
342eora_ex,adca_ex,ora_ex, adda_ex,cpx_ex ,jsr_ex, lds_ex, sts_ex,
343subb_im,cmpb_im,sbcb_im,addd_im,andb_im,bitb_im,ldb_im, stb_im,
344eorb_im,adcb_im,orb_im, addb_im,ldd_im, std_im, ldx_im, stx_im,
345subb_di,cmpb_di,sbcb_di,addd_di,andb_di,bitb_di,ldb_di, stb_di,
346eorb_di,adcb_di,orb_di, addb_di,ldd_di, std_di, ldx_di, stx_di,
347subb_ix,cmpb_ix,sbcb_ix,addd_ix,andb_ix,bitb_ix,ldb_ix, stb_ix,
348eorb_ix,adcb_ix,orb_ix, addb_ix,ldd_ix, std_ix, ldx_ix, stx_ix,
349subb_ex,cmpb_ex,sbcb_ex,addd_ex,andb_ex,bitb_ex,ldb_ex, stb_ex,
350eorb_ex,adcb_ex,orb_ex, addb_ex,ldd_ex, std_ex, ldx_ex, stx_ex
72const m6800_cpu_device::op_func m6800_cpu_device::hd63701_insn[0x100] = {
73&m6800_cpu_device::trap,   &m6800_cpu_device::nop,    &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::lsrd,   &m6800_cpu_device::asld,   &m6800_cpu_device::tap,    &m6800_cpu_device::tpa,
74&m6800_cpu_device::inx,    &m6800_cpu_device::dex,    &m6800_cpu_device::clv,    &m6800_cpu_device::sev,    &m6800_cpu_device::clc,    &m6800_cpu_device::sec,    &m6800_cpu_device::cli,    &m6800_cpu_device::sei,
75&m6800_cpu_device::sba,    &m6800_cpu_device::cba,    &m6800_cpu_device::undoc1, &m6800_cpu_device::undoc2, &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::tab,    &m6800_cpu_device::tba,
76&m6800_cpu_device::xgdx,   &m6800_cpu_device::daa,    &m6800_cpu_device::slp,    &m6800_cpu_device::aba,    &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::trap,
77&m6800_cpu_device::bra,    &m6800_cpu_device::brn,    &m6800_cpu_device::bhi,    &m6800_cpu_device::bls,    &m6800_cpu_device::bcc,    &m6800_cpu_device::bcs,    &m6800_cpu_device::bne,    &m6800_cpu_device::beq,
78&m6800_cpu_device::bvc,    &m6800_cpu_device::bvs,    &m6800_cpu_device::bpl,    &m6800_cpu_device::bmi,    &m6800_cpu_device::bge,    &m6800_cpu_device::blt,    &m6800_cpu_device::bgt,    &m6800_cpu_device::ble,
79&m6800_cpu_device::tsx,    &m6800_cpu_device::ins,    &m6800_cpu_device::pula,   &m6800_cpu_device::pulb,   &m6800_cpu_device::des,    &m6800_cpu_device::txs,    &m6800_cpu_device::psha,   &m6800_cpu_device::pshb,
80&m6800_cpu_device::pulx,   &m6800_cpu_device::rts,    &m6800_cpu_device::abx,    &m6800_cpu_device::rti,    &m6800_cpu_device::pshx,   &m6800_cpu_device::mul,    &m6800_cpu_device::wai,    &m6800_cpu_device::swi,
81&m6800_cpu_device::nega,   &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::coma,   &m6800_cpu_device::lsra,   &m6800_cpu_device::trap,   &m6800_cpu_device::rora,   &m6800_cpu_device::asra,
82&m6800_cpu_device::asla,   &m6800_cpu_device::rola,   &m6800_cpu_device::deca,   &m6800_cpu_device::trap,   &m6800_cpu_device::inca,   &m6800_cpu_device::tsta,   &m6800_cpu_device::trap,   &m6800_cpu_device::clra,
83&m6800_cpu_device::negb,   &m6800_cpu_device::trap,   &m6800_cpu_device::trap,   &m6800_cpu_device::comb,   &m6800_cpu_device::lsrb,   &m6800_cpu_device::trap,   &m6800_cpu_device::rorb,   &m6800_cpu_device::asrb,
84&m6800_cpu_device::aslb,   &m6800_cpu_device::rolb,   &m6800_cpu_device::decb,   &m6800_cpu_device::trap,   &m6800_cpu_device::incb,   &m6800_cpu_device::tstb,   &m6800_cpu_device::trap,   &m6800_cpu_device::clrb,
85&m6800_cpu_device::neg_ix, &m6800_cpu_device::aim_ix, &m6800_cpu_device::oim_ix, &m6800_cpu_device::com_ix, &m6800_cpu_device::lsr_ix, &m6800_cpu_device::eim_ix, &m6800_cpu_device::ror_ix, &m6800_cpu_device::asr_ix,
86&m6800_cpu_device::asl_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::tim_ix, &m6800_cpu_device::inc_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::clr_ix,
87&m6800_cpu_device::neg_ex, &m6800_cpu_device::aim_di, &m6800_cpu_device::oim_di, &m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::eim_di, &m6800_cpu_device::ror_ex, &m6800_cpu_device::asr_ex,
88&m6800_cpu_device::asl_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::tim_di, &m6800_cpu_device::inc_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::clr_ex,
89&m6800_cpu_device::suba_im,&m6800_cpu_device::cmpa_im,&m6800_cpu_device::sbca_im,&m6800_cpu_device::subd_im,&m6800_cpu_device::anda_im,&m6800_cpu_device::bita_im,&m6800_cpu_device::lda_im, &m6800_cpu_device::sta_im,
90&m6800_cpu_device::eora_im,&m6800_cpu_device::adca_im,&m6800_cpu_device::ora_im, &m6800_cpu_device::adda_im,&m6800_cpu_device::cpx_im ,&m6800_cpu_device::bsr,    &m6800_cpu_device::lds_im, &m6800_cpu_device::sts_im,
91&m6800_cpu_device::suba_di,&m6800_cpu_device::cmpa_di,&m6800_cpu_device::sbca_di,&m6800_cpu_device::subd_di,&m6800_cpu_device::anda_di,&m6800_cpu_device::bita_di,&m6800_cpu_device::lda_di, &m6800_cpu_device::sta_di,
92&m6800_cpu_device::eora_di,&m6800_cpu_device::adca_di,&m6800_cpu_device::ora_di, &m6800_cpu_device::adda_di,&m6800_cpu_device::cpx_di ,&m6800_cpu_device::jsr_di, &m6800_cpu_device::lds_di, &m6800_cpu_device::sts_di,
93&m6800_cpu_device::suba_ix,&m6800_cpu_device::cmpa_ix,&m6800_cpu_device::sbca_ix,&m6800_cpu_device::subd_ix,&m6800_cpu_device::anda_ix,&m6800_cpu_device::bita_ix,&m6800_cpu_device::lda_ix, &m6800_cpu_device::sta_ix,
94&m6800_cpu_device::eora_ix,&m6800_cpu_device::adca_ix,&m6800_cpu_device::ora_ix, &m6800_cpu_device::adda_ix,&m6800_cpu_device::cpx_ix ,&m6800_cpu_device::jsr_ix, &m6800_cpu_device::lds_ix, &m6800_cpu_device::sts_ix,
95&m6800_cpu_device::suba_ex,&m6800_cpu_device::cmpa_ex,&m6800_cpu_device::sbca_ex,&m6800_cpu_device::subd_ex,&m6800_cpu_device::anda_ex,&m6800_cpu_device::bita_ex,&m6800_cpu_device::lda_ex, &m6800_cpu_device::sta_ex,
96&m6800_cpu_device::eora_ex,&m6800_cpu_device::adca_ex,&m6800_cpu_device::ora_ex, &m6800_cpu_device::adda_ex,&m6800_cpu_device::cpx_ex ,&m6800_cpu_device::jsr_ex, &m6800_cpu_device::lds_ex, &m6800_cpu_device::sts_ex,
97&m6800_cpu_device::subb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::addd_im,&m6800_cpu_device::andb_im,&m6800_cpu_device::bitb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::stb_im,
98&m6800_cpu_device::eorb_im,&m6800_cpu_device::adcb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::addb_im,&m6800_cpu_device::ldd_im, &m6800_cpu_device::std_im, &m6800_cpu_device::ldx_im, &m6800_cpu_device::stx_im,
99&m6800_cpu_device::subb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::addd_di,&m6800_cpu_device::andb_di,&m6800_cpu_device::bitb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::stb_di,
100&m6800_cpu_device::eorb_di,&m6800_cpu_device::adcb_di,&m6800_cpu_device::orb_di, &m6800_cpu_device::addb_di,&m6800_cpu_device::ldd_di, &m6800_cpu_device::std_di, &m6800_cpu_device::ldx_di, &m6800_cpu_device::stx_di,
101&m6800_cpu_device::subb_ix,&m6800_cpu_device::cmpb_ix,&m6800_cpu_device::sbcb_ix,&m6800_cpu_device::addd_ix,&m6800_cpu_device::andb_ix,&m6800_cpu_device::bitb_ix,&m6800_cpu_device::ldb_ix, &m6800_cpu_device::stb_ix,
102&m6800_cpu_device::eorb_ix,&m6800_cpu_device::adcb_ix,&m6800_cpu_device::orb_ix, &m6800_cpu_device::addb_ix,&m6800_cpu_device::ldd_ix, &m6800_cpu_device::std_ix, &m6800_cpu_device::ldx_ix, &m6800_cpu_device::stx_ix,
103&m6800_cpu_device::subb_ex,&m6800_cpu_device::cmpb_ex,&m6800_cpu_device::sbcb_ex,&m6800_cpu_device::addd_ex,&m6800_cpu_device::andb_ex,&m6800_cpu_device::bitb_ex,&m6800_cpu_device::ldb_ex, &m6800_cpu_device::stb_ex,
104&m6800_cpu_device::eorb_ex,&m6800_cpu_device::adcb_ex,&m6800_cpu_device::orb_ex, &m6800_cpu_device::addb_ex,&m6800_cpu_device::ldd_ex, &m6800_cpu_device::std_ex, &m6800_cpu_device::ldx_ex, &m6800_cpu_device::stx_ex
351105};
352106
353static void (*const nsc8105_insn[0x100])(m6800_state *cpustate) = {
354illegal,illegal,nop,    illegal,illegal,tap,    illegal,tpa,
355inx,    clv,    dex,    sev,    clc,    cli,    sec,    sei,
356sba,    illegal,cba,    illegal,illegal,tab,    illegal,tba,
357illegal,illegal,daa,    aba,    illegal,illegal,illegal,illegal,
358bra,    bhi,    brn,    bls,    bcc,    bne,    bcs,    beq,
359bvc,    bpl,    bvs,    bmi,    bge,    bgt,    blt,    ble,
360tsx,    pula,   ins,    pulb,   des,    psha,   txs,    pshb,
361illegal,illegal,rts,    rti,    illegal,wai,    illegal,swi,
362suba_im,sbca_im,cmpa_im,illegal,anda_im,lda_im, bita_im,sta_im,
363eora_im,ora_im, adca_im,adda_im,cmpx_im,lds_im, bsr,    sts_im,
364suba_di,sbca_di,cmpa_di,illegal,anda_di,lda_di, bita_di,sta_di,
365eora_di,ora_di, adca_di,adda_di,cmpx_di,lds_di, jsr_di, sts_di,
366suba_ix,sbca_ix,cmpa_ix,illegal,anda_ix,lda_ix, bita_ix,sta_ix,
367eora_ix,ora_ix, adca_ix,adda_ix,cmpx_ix,lds_ix, jsr_ix, sts_ix,
368suba_ex,sbca_ex,cmpa_ex,illegal,anda_ex,lda_ex, bita_ex,sta_ex,
369eora_ex,ora_ex, adca_ex,adda_ex,cmpx_ex,lds_ex, jsr_ex, sts_ex,
370nega,   illegal,illegal,coma,   lsra,   rora,   illegal,asra,
371asla,   deca,   rola,   illegal,inca,   illegal,tsta,   clra,
372negb,   illegal,illegal,comb,   lsrb,   rorb,   illegal,asrb,
373aslb,   decb,   rolb,   illegal,incb,   illegal,tstb,   clrb,
374neg_ix, illegal,illegal,com_ix, lsr_ix, ror_ix, illegal,asr_ix,
375asl_ix, dec_ix, rol_ix, illegal,inc_ix, jmp_ix, tst_ix, clr_ix,
376neg_ex, illegal,illegal,com_ex, lsr_ex, ror_ex, illegal,asr_ex,
377asl_ex, dec_ex, rol_ex, illegal,inc_ex, jmp_ex, tst_ex, clr_ex,
378subb_im,sbcb_im,cmpb_im,illegal,andb_im,ldb_im, bitb_im,stb_im,
379eorb_im,orb_im, adcb_im,addb_im,illegal,ldx_im, illegal,stx_im,
380subb_di,sbcb_di,cmpb_di,illegal,andb_di,ldb_di, bitb_di,stb_di,
381eorb_di,orb_di, adcb_di,addb_di,illegal,ldx_di, illegal,stx_di,
382subb_ix,sbcb_ix,cmpb_ix,illegal,andb_ix,ldb_ix, bitb_ix,stb_ix,
383eorb_ix,orb_ix, adcb_ix,addb_ix,adcx_im,ldx_ix, illegal,stx_ix,
384subb_ex,sbcb_ex,cmpb_ex,illegal,andb_ex,ldb_ex, bitb_ex,stb_ex,
385eorb_ex,orb_ex, adcb_ex,addb_ex,addx_ex,ldx_ex, illegal,stx_ex
107const m6800_cpu_device::op_func m6800_cpu_device::nsc8105_insn[0x100] = {
108&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::nop,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tap,    &m6800_cpu_device::illegal,&m6800_cpu_device::tpa,
109&m6800_cpu_device::inx,    &m6800_cpu_device::clv,    &m6800_cpu_device::dex,    &m6800_cpu_device::sev,    &m6800_cpu_device::clc,    &m6800_cpu_device::cli,    &m6800_cpu_device::sec,    &m6800_cpu_device::sei,
110&m6800_cpu_device::sba,    &m6800_cpu_device::illegal,&m6800_cpu_device::cba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::tab,    &m6800_cpu_device::illegal,&m6800_cpu_device::tba,
111&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::daa,    &m6800_cpu_device::aba,    &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,
112&m6800_cpu_device::bra,    &m6800_cpu_device::bhi,    &m6800_cpu_device::brn,    &m6800_cpu_device::bls,    &m6800_cpu_device::bcc,    &m6800_cpu_device::bne,    &m6800_cpu_device::bcs,    &m6800_cpu_device::beq,
113&m6800_cpu_device::bvc,    &m6800_cpu_device::bpl,    &m6800_cpu_device::bvs,    &m6800_cpu_device::bmi,    &m6800_cpu_device::bge,    &m6800_cpu_device::bgt,    &m6800_cpu_device::blt,    &m6800_cpu_device::ble,
114&m6800_cpu_device::tsx,    &m6800_cpu_device::pula,   &m6800_cpu_device::ins,    &m6800_cpu_device::pulb,   &m6800_cpu_device::des,    &m6800_cpu_device::psha,   &m6800_cpu_device::txs,    &m6800_cpu_device::pshb,
115&m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::rts,    &m6800_cpu_device::rti,    &m6800_cpu_device::illegal,&m6800_cpu_device::wai,    &m6800_cpu_device::illegal,&m6800_cpu_device::swi,
116&m6800_cpu_device::suba_im,&m6800_cpu_device::sbca_im,&m6800_cpu_device::cmpa_im,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_im,&m6800_cpu_device::lda_im, &m6800_cpu_device::bita_im,&m6800_cpu_device::sta_im,
117&m6800_cpu_device::eora_im,&m6800_cpu_device::ora_im, &m6800_cpu_device::adca_im,&m6800_cpu_device::adda_im,&m6800_cpu_device::cmpx_im,&m6800_cpu_device::lds_im, &m6800_cpu_device::bsr,    &m6800_cpu_device::sts_im,
118&m6800_cpu_device::suba_di,&m6800_cpu_device::sbca_di,&m6800_cpu_device::cmpa_di,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_di,&m6800_cpu_device::lda_di, &m6800_cpu_device::bita_di,&m6800_cpu_device::sta_di,
119&m6800_cpu_device::eora_di,&m6800_cpu_device::ora_di, &m6800_cpu_device::adca_di,&m6800_cpu_device::adda_di,&m6800_cpu_device::cmpx_di,&m6800_cpu_device::lds_di, &m6800_cpu_device::jsr_di, &m6800_cpu_device::sts_di,
120&m6800_cpu_device::suba_ix,&m6800_cpu_device::sbca_ix,&m6800_cpu_device::cmpa_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ix,&m6800_cpu_device::lda_ix, &m6800_cpu_device::bita_ix,&m6800_cpu_device::sta_ix,
121&m6800_cpu_device::eora_ix,&m6800_cpu_device::ora_ix, &m6800_cpu_device::adca_ix,&m6800_cpu_device::adda_ix,&m6800_cpu_device::cmpx_ix,&m6800_cpu_device::lds_ix, &m6800_cpu_device::jsr_ix, &m6800_cpu_device::sts_ix,
122&m6800_cpu_device::suba_ex,&m6800_cpu_device::sbca_ex,&m6800_cpu_device::cmpa_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::anda_ex,&m6800_cpu_device::lda_ex, &m6800_cpu_device::bita_ex,&m6800_cpu_device::sta_ex,
123&m6800_cpu_device::eora_ex,&m6800_cpu_device::ora_ex, &m6800_cpu_device::adca_ex,&m6800_cpu_device::adda_ex,&m6800_cpu_device::cmpx_ex,&m6800_cpu_device::lds_ex, &m6800_cpu_device::jsr_ex, &m6800_cpu_device::sts_ex,
124&m6800_cpu_device::nega,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::coma,   &m6800_cpu_device::lsra,   &m6800_cpu_device::rora,   &m6800_cpu_device::illegal,&m6800_cpu_device::asra,
125&m6800_cpu_device::asla,   &m6800_cpu_device::deca,   &m6800_cpu_device::rola,   &m6800_cpu_device::illegal,&m6800_cpu_device::inca,   &m6800_cpu_device::illegal,&m6800_cpu_device::tsta,   &m6800_cpu_device::clra,
126&m6800_cpu_device::negb,   &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::comb,   &m6800_cpu_device::lsrb,   &m6800_cpu_device::rorb,   &m6800_cpu_device::illegal,&m6800_cpu_device::asrb,
127&m6800_cpu_device::aslb,   &m6800_cpu_device::decb,   &m6800_cpu_device::rolb,   &m6800_cpu_device::illegal,&m6800_cpu_device::incb,   &m6800_cpu_device::illegal,&m6800_cpu_device::tstb,   &m6800_cpu_device::clrb,
128&m6800_cpu_device::neg_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ix, &m6800_cpu_device::lsr_ix, &m6800_cpu_device::ror_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ix,
129&m6800_cpu_device::asl_ix, &m6800_cpu_device::dec_ix, &m6800_cpu_device::rol_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ix, &m6800_cpu_device::jmp_ix, &m6800_cpu_device::tst_ix, &m6800_cpu_device::clr_ix,
130&m6800_cpu_device::neg_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::illegal,&m6800_cpu_device::com_ex, &m6800_cpu_device::lsr_ex, &m6800_cpu_device::ror_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::asr_ex,
131&m6800_cpu_device::asl_ex, &m6800_cpu_device::dec_ex, &m6800_cpu_device::rol_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::inc_ex, &m6800_cpu_device::jmp_ex, &m6800_cpu_device::tst_ex, &m6800_cpu_device::clr_ex,
132&m6800_cpu_device::subb_im,&m6800_cpu_device::sbcb_im,&m6800_cpu_device::cmpb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_im,&m6800_cpu_device::ldb_im, &m6800_cpu_device::bitb_im,&m6800_cpu_device::stb_im,
133&m6800_cpu_device::eorb_im,&m6800_cpu_device::orb_im, &m6800_cpu_device::adcb_im,&m6800_cpu_device::addb_im,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_im, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_im,
134&m6800_cpu_device::subb_di,&m6800_cpu_device::sbcb_di,&m6800_cpu_device::cmpb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_di,&m6800_cpu_device::ldb_di, &m6800_cpu_device::bitb_di,&m6800_cpu_device::stb_di,
135&m6800_cpu_device::eorb_di,&m6800_cpu_device::orb_di, &m6800_cpu_device::adcb_di,&m6800_cpu_device::addb_di,&m6800_cpu_device::illegal,&m6800_cpu_device::ldx_di, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_di,
136&m6800_cpu_device::subb_ix,&m6800_cpu_device::sbcb_ix,&m6800_cpu_device::cmpb_ix,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_ix,&m6800_cpu_device::ldb_ix, &m6800_cpu_device::bitb_ix,&m6800_cpu_device::stb_ix,
137&m6800_cpu_device::eorb_ix,&m6800_cpu_device::orb_ix, &m6800_cpu_device::adcb_ix,&m6800_cpu_device::addb_ix,&m6800_cpu_device::adcx_im,&m6800_cpu_device::ldx_ix, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_ix,
138&m6800_cpu_device::subb_ex,&m6800_cpu_device::sbcb_ex,&m6800_cpu_device::cmpb_ex,&m6800_cpu_device::illegal,&m6800_cpu_device::andb_ex,&m6800_cpu_device::ldb_ex, &m6800_cpu_device::bitb_ex,&m6800_cpu_device::stb_ex,
139&m6800_cpu_device::eorb_ex,&m6800_cpu_device::orb_ex, &m6800_cpu_device::adcb_ex,&m6800_cpu_device::addb_ex,&m6800_cpu_device::addx_ex,&m6800_cpu_device::ldx_ex, &m6800_cpu_device::illegal,&m6800_cpu_device::stx_ex
386140};
trunk/src/emu/cpu/m6800/m6800.h
r24794r24795
66#define __M6800_H__
77
88
9struct m6801_interface
10{
11   devcb_write_line        out_sc2_func;
12};
13#define M6801_INTERFACE(name) const m6801_interface (name) =
14
15
169enum
1710{
1811   M6800_PC=1, M6800_S, M6800_A, M6800_B, M6800_X, M6800_CC,
r24794r24795
5043   M6801_PORT4
5144};
5245
53DECLARE_LEGACY_CPU_DEVICE(M6800, m6800);
54DECLARE_LEGACY_CPU_DEVICE(M6801, m6801);
55DECLARE_LEGACY_CPU_DEVICE(M6802, m6802);
56DECLARE_LEGACY_CPU_DEVICE(M6803, m6803);
57DECLARE_LEGACY_CPU_DEVICE(M6808, m6808);
58DECLARE_LEGACY_CPU_DEVICE(HD6301, hd6301);
59DECLARE_LEGACY_CPU_DEVICE(HD63701, hd63701);
60DECLARE_LEGACY_CPU_DEVICE(NSC8105, nsc8105);
6146
62DECLARE_LEGACY_CPU_DEVICE(HD6303R, hd6303r);
63DECLARE_LEGACY_CPU_DEVICE(HD6303Y, hd6303y);
47#define MCFG_M6801_SC2(_devcb) \
48   m6800_cpu_device::set_out_sc2_func(*device, DEVCB2_##_devcb);
6449
6550
66DECLARE_READ8_HANDLER( m6801_io_r );
67DECLARE_WRITE8_HANDLER( m6801_io_w );
51class m6800_cpu_device :  public cpu_device
52{
53public:
54   typedef void (m6800_cpu_device::*op_func)();
6855
69CPU_DISASSEMBLE( m6800 );
70CPU_DISASSEMBLE( m6801 );
71CPU_DISASSEMBLE( m6802 );
72CPU_DISASSEMBLE( m6803 );
73CPU_DISASSEMBLE( m6808 );
74CPU_DISASSEMBLE( hd6301 );
75CPU_DISASSEMBLE( hd63701 );
76CPU_DISASSEMBLE( nsc8105 );
56   // construction/destruction
57   m6800_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
58   m6800_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, bool has_io, int clock_divider, const m6800_cpu_device::op_func *insn, const UINT8 *cycles, address_map_constructor internal = NULL);
7759
60   // static configuration helpers
61   template<class _Object> static devcb2_base &set_out_sc2_func(device_t &device, _Object object) { return downcast<m6800_cpu_device &>(device).m_out_sc2_func.set_callback(object); }
62
63   DECLARE_READ8_MEMBER( m6801_io_r );
64   DECLARE_WRITE8_MEMBER( m6801_io_w );
65
66protected:
67   // device-level overrides
68   virtual void device_start();
69   virtual void device_reset();
70
71   // device_execute_interface overrides
72   virtual UINT32 execute_min_cycles() const { return 1; }
73   virtual UINT32 execute_max_cycles() const { return 12; }
74   virtual UINT32 execute_input_lines() const { return 2; }
75   virtual UINT32 execute_default_irq_vector() const { return 0; }
76   virtual void execute_run();
77   virtual void execute_set_input(int inputnum, int state);
78
79   // device_memory_interface overrides
80   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO && m_has_io) ? &m_io_config : NULL ); }
81
82   // device_state_interface overrides
83   void state_string_export(const device_state_entry &entry, astring &string);
84
85   // device_disasm_interface overrides
86   virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
87   virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
88   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
89
90   address_space_config m_program_config;
91   address_space_config m_io_config;
92   bool m_has_io;
93
94   devcb2_write_line m_out_sc2_func;
95
96   PAIR    m_ppc;            /* Previous program counter */
97   PAIR    m_pc;             /* Program counter */
98   PAIR    m_s;              /* Stack pointer */
99   PAIR    m_x;              /* Index register */
100   PAIR    m_d;              /* Accumulators */
101   UINT8   m_cc;             /* Condition codes */
102   UINT8   m_wai_state;      /* WAI opcode state ,(or sleep opcode state) */
103   UINT8   m_nmi_state;      /* NMI line state */
104   UINT8   m_nmi_pending;    /* NMI pending */
105   UINT8   m_irq_state[3];   /* IRQ line state [IRQ1,TIN,SC1] */
106   UINT8   m_ic_eddge;       /* InputCapture eddge , b.0=fall,b.1=raise */
107   int     m_sc1_state;
108
109   /* Memory spaces */
110   address_space *m_program;
111   direct_read_data *m_direct;
112   address_space *m_io;
113
114   const op_func *m_insn;
115   const UINT8 *m_cycles;            /* clock cycle of instruction table */
116   /* internal registers */
117   UINT8   m_port1_ddr;
118   UINT8   m_port2_ddr;
119   UINT8   m_port3_ddr;
120   UINT8   m_port4_ddr;
121   UINT8   m_port1_data;
122   UINT8   m_port2_data;
123   UINT8   m_port3_data;
124   UINT8   m_port4_data;
125   UINT8   m_p3csr;          // Port 3 Control/Status Register
126   UINT8   m_tcsr;           /* Timer Control and Status Register */
127   UINT8   m_pending_tcsr;   /* pending IRQ flag for clear IRQflag process */
128   UINT8   m_irq2;           /* IRQ2 flags */
129   UINT8   m_ram_ctrl;
130   PAIR    m_counter;        /* free running counter */
131   PAIR    m_output_compare; /* output compare       */
132   UINT16  m_input_capture;  /* input capture        */
133   int     m_p3csr_is3_flag_read;
134   int     m_port3_latched;
135
136   int     m_clock_divider;
137   UINT8   m_trcsr, m_rmcr, m_rdr, m_tdr, m_rsr, m_tsr;
138   int     m_rxbits, m_txbits, m_txstate, m_trcsr_read_tdre, m_trcsr_read_orfe, m_trcsr_read_rdrf, m_tx;
139   int     m_port2_written;
140
141   int     m_icount;
142   int     m_latch09;
143
144   PAIR    m_timer_over;
145   emu_timer *m_sci_timer;
146   PAIR m_ea;        /* effective address */
147
148   static const UINT8 flags8i[256];
149   static const UINT8 flags8d[256];
150   static const UINT8 cycles_6800[256];
151   static const UINT8 cycles_6803[256];
152   static const UINT8 cycles_63701[256];
153   static const UINT8 cycles_nsc8105[256];
154   static const op_func m6800_insn[256];
155   static const op_func m6803_insn[256];
156   static const op_func hd63701_insn[256];
157   static const op_func nsc8105_insn[256];
158
159   UINT32 RM16(UINT32 Addr );
160   void WM16(UINT32 Addr, PAIR *p );
161   void enter_interrupt(const char *message,UINT16 irq_vector);
162   void m6800_check_irq2();
163   void CHECK_IRQ_LINES();
164   void check_timer_event();
165   void increment_counter(int amount);
166   void set_rmcr(UINT8 data);
167   void write_port2();
168   int m6800_rx();
169   void serial_transmit();
170   void serial_receive();
171   TIMER_CALLBACK_MEMBER( sci_tick );
172   void set_os3(int state);
173
174   void aba();
175   void abx();
176   void adca_di();
177   void adca_ex();
178   void adca_im();
179   void adca_ix();
180   void adcb_di();
181   void adcb_ex();
182   void adcb_im();
183   void adcb_ix();
184   void adcx_im();
185   void adda_di();
186   void adda_ex();
187   void adda_im();
188   void adda_ix();
189   void addb_di();
190   void addb_ex();
191   void addb_im();
192   void addb_ix();
193   void addd_di();
194   void addd_ex();
195   void addx_ex();
196   void addd_im();
197   void addd_ix();
198   void aim_di();
199   void aim_ix();
200   void anda_di();
201   void anda_ex();
202   void anda_im();
203   void anda_ix();
204   void andb_di();
205   void andb_ex();
206   void andb_im();
207   void andb_ix();
208   void asl_ex();
209   void asl_ix();
210   void asla();
211   void aslb();
212   void asld();
213   void asr_ex();
214   void asr_ix();
215   void asra();
216   void asrb();
217   void bcc();
218   void bcs();
219   void beq();
220   void bge();
221   void bgt();
222   void bhi();
223   void bita_di();
224   void bita_ex();
225   void bita_im();
226   void bita_ix();
227   void bitb_di();
228   void bitb_ex();
229   void bitb_im();
230   void bitb_ix();
231   void ble();
232   void bls();
233   void blt();
234   void bmi();
235   void bne();
236   void bpl();
237   void bra();
238   void brn();
239   void bsr();
240   void bvc();
241   void bvs();
242   void cba();
243   void clc();
244   void cli();
245   void clr_ex();
246   void clr_ix();
247   void clra();
248   void clrb();
249   void clv();
250   void cmpa_di();
251   void cmpa_ex();
252   void cmpa_im();
253   void cmpa_ix();
254   void cmpb_di();
255   void cmpb_ex();
256   void cmpb_im();
257   void cmpb_ix();
258   void cmpx_di();
259   void cmpx_ex();
260   void cmpx_im();
261   void cmpx_ix();
262   void com_ex();
263   void com_ix();
264   void coma();
265   void comb();
266   void daa();
267   void dec_ex();
268   void dec_ix();
269   void deca();
270   void decb();
271   void des();
272   void dex();
273   void eim_di();
274   void eim_ix();
275   void eora_di();
276   void eora_ex();
277   void eora_im();
278   void eora_ix();
279   void eorb_di();
280   void eorb_ex();
281   void eorb_im();
282   void eorb_ix();
283   void illegal();
284   void inc_ex();
285   void inc_ix();
286   void inca();
287   void incb();
288   void ins();
289   void inx();
290   void jmp_ex();
291   void jmp_ix();
292   void jsr_di();
293   void jsr_ex();
294   void jsr_ix();
295   void lda_di();
296   void lda_ex();
297   void lda_im();
298   void lda_ix();
299   void ldb_di();
300   void ldb_ex();
301   void ldb_im();
302   void ldb_ix();
303   void ldd_di();
304   void ldd_ex();
305   void ldd_im();
306   void ldd_ix();
307   void lds_di();
308   void lds_ex();
309   void lds_im();
310   void lds_ix();
311   void ldx_di();
312   void ldx_ex();
313   void ldx_im();
314   void ldx_ix();
315   void lsr_ex();
316   void lsr_ix();
317   void lsra();
318   void lsrb();
319   void lsrd();
320   void mul();
321   void neg_ex();
322   void neg_ix();
323   void nega();
324   void negb();
325   void nop();
326   void oim_di();
327   void oim_ix();
328   void ora_di();
329   void ora_ex();
330   void ora_im();
331   void ora_ix();
332   void orb_di();
333   void orb_ex();
334   void orb_im();
335   void orb_ix();
336   void psha();
337   void pshb();
338   void pshx();
339   void pula();
340   void pulb();
341   void pulx();
342   void rol_ex();
343   void rol_ix();
344   void rola();
345   void rolb();
346   void ror_ex();
347   void ror_ix();
348   void rora();
349   void rorb();
350   void rti();
351   void rts();
352   void sba();
353   void sbca_di();
354   void sbca_ex();
355   void sbca_im();
356   void sbca_ix();
357   void sbcb_di();
358   void sbcb_ex();
359   void sbcb_im();
360   void sbcb_ix();
361   void sec();
362   void sei();
363   void sev();
364   void slp();
365   void sta_di();
366   void sta_ex();
367   void sta_im();
368   void sta_ix();
369   void stb_di();
370   void stb_ex();
371   void stb_im();
372   void stb_ix();
373   void std_di();
374   void std_ex();
375   void std_im();
376   void std_ix();
377   void sts_di();
378   void sts_ex();
379   void sts_im();
380   void sts_ix();
381   void stx_di();
382   void stx_ex();
383   void stx_im();
384   void stx_ix();
385   void suba_di();
386   void suba_ex();
387   void suba_im();
388   void suba_ix();
389   void subb_di();
390   void subb_ex();
391   void subb_im();
392   void subb_ix();
393   void subd_di();
394   void subd_ex();
395   void subd_im();
396   void subd_ix();
397   void swi();
398   void tab();
399   void tap();
400   void tba();
401   void tim_di();
402   void tim_ix();
403   void tpa();
404   void tst_ex();
405   void tst_ix();
406   void tsta();
407   void tstb();
408   void tsx();
409   void txs();
410   void undoc1();
411   void undoc2();
412   void wai();
413   void xgdx();
414   void cpx_di();
415   void cpx_ex();
416   void cpx_im();
417   void cpx_ix();
418   void trap();
419};
420
421
422class m6801_cpu_device : public m6800_cpu_device
423{
424public:
425   m6801_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
426   m6801_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, const m6800_cpu_device::op_func *insn, const UINT8 *cycles, address_map_constructor internal = NULL);
427
428protected:
429   virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 4 - 1) / 4; }
430   virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 4); }
431   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
432};
433
434
435class m6802_cpu_device : public m6800_cpu_device
436{
437public:
438   m6802_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
439   m6802_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, const m6800_cpu_device::op_func *insn, const UINT8 *cycles);
440
441protected:
442   virtual UINT64 execute_clocks_to_cycles(UINT64 clocks) const { return (clocks + 4 - 1) / 4; }
443   virtual UINT64 execute_cycles_to_clocks(UINT64 cycles) const { return (cycles * 4); }
444   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
445};
446
447
448class m6803_cpu_device : public m6801_cpu_device
449{
450public:
451   m6803_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
452
453protected:
454   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
455};
456
457
458class m6808_cpu_device : public m6802_cpu_device
459{
460public:
461   m6808_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
462
463protected:
464   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
465};
466
467
468class hd6301_cpu_device : public m6801_cpu_device
469{
470public:
471   hd6301_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
472   hd6301_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
473
474protected:
475   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
476};
477
478
479class hd63701_cpu_device : public m6801_cpu_device
480{
481public:
482   hd63701_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
483
484protected:
485   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
486};
487
488
489class nsc8105_cpu_device : public m6802_cpu_device
490{
491public:
492   nsc8105_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
493
494protected:
495   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
496};
497
498
499// DP-40 package: HD6303RP,  HD63A03RP,  HD63B03RP,
500// FP-54 package: HD6303RF,  HD63A03RF,  HD63B03RF,
501// CG-40 package: HD6303RCG, HD63A03RCG, HD63B03RCG,
502// Not fully emulated yet
503class hd6303r_cpu_device : public hd6301_cpu_device
504{
505public:
506   hd6303r_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
507};
508
509
510// DP-64S package: HD6303YP,  HD63A03YP,  HD63B03YP,  HD63C03YP
511// FP-64  package: HD6303YF,  HD63A03YF,  HD63B03YF,  HD63C03YF
512// FP-64A package: HD6303YH,  HD63A03YH,  HD63B03YH,  HD63C03YH
513// CP-68  package: HD6303YCP, HD63A03YCP, HD63B03YCP, HD63C03YCP
514// Not fully emulated yet
515class hd6303y_cpu_device : public hd6301_cpu_device
516{
517public:
518   hd6303y_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
519};
520
521
522extern const device_type M6800;
523extern const device_type M6801;
524extern const device_type M6802;
525extern const device_type M6803;
526extern const device_type M6808;
527extern const device_type HD6301;
528extern const device_type HD63701;
529extern const device_type NSC8105;
530extern const device_type HD6303R;
531extern const device_type HD6303Y;
532
78533#endif /* __M6800_H__ */
trunk/src/mess/machine/adam_fdc.c
r24794r24795
6868//-------------------------------------------------
6969
7070static ADDRESS_MAP_START( adam_fdc_mem, AS_PROGRAM, 8, adam_fdc_device )
71   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
71   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
7272   AM_RANGE(0x0080, 0x00ff) AM_RAM
7373   AM_RANGE(0x0400, 0x07ff) AM_RAM AM_WRITEONLY AM_SHARE("ram")
7474   AM_RANGE(0x0800, 0x0800) AM_MIRROR(0xff) AM_DEVREAD(WD2793_TAG, wd2793_t, status_r)
trunk/src/mess/machine/adam_spi.c
r24794r24795
5151//-------------------------------------------------
5252
5353static ADDRESS_MAP_START( adam_spi_mem, AS_PROGRAM, 8, adam_spi_device )
54   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
54   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
5555   AM_RANGE(0x0080, 0x00ff) AM_RAM
5656   AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0)
5757ADDRESS_MAP_END
trunk/src/mess/machine/adam_kb.c
r24794r24795
5151//-------------------------------------------------
5252
5353static ADDRESS_MAP_START( adam_kb_mem, AS_PROGRAM, 8, adam_keyboard_device )
54   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
54   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
5555   AM_RANGE(0x0080, 0x00ff) AM_RAM
5656   AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0)
5757ADDRESS_MAP_END
trunk/src/mess/machine/pf10.c
r24794r24795
2626//-------------------------------------------------
2727
2828static ADDRESS_MAP_START( cpu_mem, AS_PROGRAM, 8, epson_pf10_device )
29   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
29   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE("maincpu", hd6303y_cpu_device, m6801_io_r, m6801_io_w)
3030   AM_RANGE(0x0040, 0x00ff) AM_RAM /* 192 bytes internal ram */
3131   AM_RANGE(0x0800, 0x0fff) AM_RAM /* external 2k ram */
3232   AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu", 0)
trunk/src/mess/machine/adam_prn.c
r24794r24795
5151//-------------------------------------------------
5252
5353static ADDRESS_MAP_START( adam_prn_mem, AS_PROGRAM, 8, adam_printer_device )
54   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
54   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
5555   AM_RANGE(0x0080, 0x00ff) AM_RAM
5656   AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0)
5757ADDRESS_MAP_END
trunk/src/mess/machine/adam_ddp.c
r24794r24795
5151//-------------------------------------------------
5252
5353static ADDRESS_MAP_START( adam_ddp_mem, AS_PROGRAM, 8, adam_digital_data_pack_device )
54   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
54   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
5555   AM_RANGE(0x0080, 0x00ff) AM_RAM
5656   AM_RANGE(0x0400, 0x07ff) AM_RAM
5757   AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0)
trunk/src/mess/includes/psion.h
r24794r24795
3030         m_sys_register(*this, "sys_register"),
3131         m_ram(*this, "ram"){ }
3232
33   required_device<cpu_device> m_maincpu;
33   required_device<hd63701_cpu_device> m_maincpu;
3434   required_device<hd44780_device> m_lcdc;
3535   required_device<beep_device> m_beep;
3636   required_device<datapack_device> m_pack1;
trunk/src/mess/drivers/atarist.c
r24794r24795
11831183//-------------------------------------------------
11841184
11851185static ADDRESS_MAP_START( ikbd_map, AS_PROGRAM, 8, st_state )
1186   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
1186   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_TAG, hd6301_cpu_device, m6801_io_r, m6801_io_w)
11871187   AM_RANGE(0x0080, 0x00ff) AM_RAM
11881188   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_TAG, 0)
11891189ADDRESS_MAP_END
trunk/src/mess/drivers/hx20.c
r24794r24795
537537//-------------------------------------------------
538538
539539static ADDRESS_MAP_START( hx20_mem, AS_PROGRAM, 8, hx20_state )
540   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
540   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_MAIN_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w)
541541   AM_RANGE(0x0020, 0x0020) AM_WRITE(ksc_w)
542542   AM_RANGE(0x0022, 0x0022) AM_READ(krtn07_r)
543543   AM_RANGE(0x0026, 0x0026) AM_WRITE(lcd_cs_w)
r24794r24795
568568//-------------------------------------------------
569569
570570static ADDRESS_MAP_START( hx20_sub_mem, AS_PROGRAM, 8, hx20_state )
571   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
571   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(HD6301V1_SLAVE_TAG, hd63701_cpu_device, m6801_io_r, m6801_io_w)
572572   AM_RANGE(0x0080, 0x00ff) AM_RAM
573573   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(HD6301V1_SLAVE_TAG, 0)
574574ADDRESS_MAP_END
trunk/src/mess/drivers/mc10.c
r24794r24795
4747   m_printer(*this, "printer")
4848   { }
4949
50   required_device<cpu_device> m_maincpu;
50   required_device<m6803_cpu_device> m_maincpu;
5151   optional_device<mc6847_base_device> m_mc6847;
5252   optional_device<ef9345_device> m_ef9345;
5353   required_device<dac_device> m_dac;
r24794r24795
260260
261261   //for alice32 force port4 DDR to 0xff at startup
262262   if (!strcmp(machine().system().name, "alice32") || !strcmp(machine().system().name, "alice90"))
263      m6801_io_w(prg, 0x05, 0xff);
263      m_maincpu->m6801_io_w(prg, 0x05, 0xff);
264264}
265265
266266
trunk/src/mess/drivers/psion.c
r24794r24795
100100      break;
101101   }
102102
103   m6801_io_w(space, offset, data);
103   m_maincpu->m6801_io_w(space, offset, data);
104104}
105105
106106READ8_MEMBER( psion_state::hd63701_int_reg_r )
r24794r24795
111111      /* datapack i/o data bus */
112112      return (m_pack1->data_r() | m_pack2->data_r()) & (~m_port2_ddr);
113113   case 0x14:
114      return (m6801_io_r(space, offset)&0x7f) | (m_stby_pwr<<7);
114      return (m_maincpu->m6801_io_r(space, offset)&0x7f) | (m_stby_pwr<<7);
115115   case 0x15:
116116      /*
117117      x--- ---- ON key active high
r24794r24795
124124      /* datapack control lines */
125125      return (m_pack1->control_r() | (m_pack2->control_r() & 0x8f)) | ((m_pack2->control_r() & 0x10)<<1);
126126   case 0x08:
127      m6801_io_w(space, offset, m_tcsr_value);
127      m_maincpu->m6801_io_w(space, offset, m_tcsr_value);
128128   default:
129      return m6801_io_r(space, offset);
129      return m_maincpu->m6801_io_r(space, offset);
130130   }
131131}
132132
trunk/src/mess/drivers/adam.c
r24794r24795
931931//-------------------------------------------------
932932
933933static ADDRESS_MAP_START( m6801_mem, AS_PROGRAM, 8, adam_state )
934   AM_RANGE(0x0000, 0x001f) AM_READWRITE_LEGACY(m6801_io_r, m6801_io_w)
934   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(M6801_TAG, m6801_cpu_device, m6801_io_r, m6801_io_w)
935935   AM_RANGE(0x0080, 0x00ff) AM_RAM
936936   AM_RANGE(0xf800, 0xffff) AM_ROM AM_REGION(M6801_TAG, 0)
937937ADDRESS_MAP_END
r24794r24795
10111011   }
10121012}
10131013
1014static M6801_INTERFACE( m6801_intf )
1015{
1016   DEVCB_DRIVER_LINE_MEMBER(adam_state, os3_w)
1017};
10181014
1019
10201015//-------------------------------------------------
10211016//  ADAM_EXPANSION_SLOT_INTERFACE( slot1_intf )
10221017//-------------------------------------------------
r24794r24795
11161111   MCFG_CPU_ADD(M6801_TAG, M6801, XTAL_4MHz)
11171112   MCFG_CPU_PROGRAM_MAP(m6801_mem)
11181113   MCFG_CPU_IO_MAP(m6801_io)
1119   MCFG_CPU_CONFIG(m6801_intf)
1114   MCFG_M6801_SC2(WRITELINE(adam_state, os3_w))
11201115   MCFG_QUANTUM_PERFECT_CPU(M6801_TAG)
11211116
11221117   // video hardware

Previous 199869 Revisions Next


© 1997-2024 The MAME Team