Previous 199869 Revisions Next

r35062 Monday 16th February, 2015 at 15:34:54 UTC by hap
added S2152
[src/emu/cpu/amis2000]amis2000.c amis2000.h amis2000op.inc

trunk/src/emu/cpu/amis2000/amis2000.c
r243573r243574
66  Overall functionality is similar to (and probably derived from) NEC uCOM-4.
77
88  References:
9  - AMI MOS Products Catalog Winter 1979
9  - AMI MOS Products Catalog 1979/1980
1010  - AMI S2000 Programming Manual (rev. 2)
1111
1212  TODO:
r243573r243574
2727// S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM
2828// S2150 increased RAM to 80 nibbles and ROM to 1.5KB
2929// high-voltage output versions of these chips (S2000A and S2150A) are identical overall
30const device_type AMI_S2000 = &device_creator<amis2000_device>;
31const device_type AMI_S2150 = &device_creator<amis2150_device>;
30const device_type AMI_S2000 = &device_creator<amis2000_cpu_device>;
31const device_type AMI_S2150 = &device_creator<amis2150_cpu_device>;
3232
33// S2152 is an extension to S2150, removing the K pins and adding a better timer
34const device_type AMI_S2152 = &device_creator<amis2152_cpu_device>;
3335
36
3437// internal memory maps
35static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device)
38static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_base_device)
3639   AM_RANGE(0x0000, 0x03ff) AM_ROM
3740ADDRESS_MAP_END
3841
39static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device)
42static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_base_device)
4043   AM_RANGE(0x0000, 0x03ff) AM_ROM
4144   AM_RANGE(0x0400, 0x05ff) AM_NOP // 0x00
4245   AM_RANGE(0x0600, 0x07ff) AM_ROM
4346ADDRESS_MAP_END
4447
4548
46static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_device)
49static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_base_device)
4750   AM_RANGE(0x00, 0x3f) AM_RAM
4851ADDRESS_MAP_END
4952
50static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_device)
53static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_base_device)
5154   AM_RANGE(0x00, 0x3f) AM_RAM
5255   AM_RANGE(0x40, 0x4f) AM_RAM
5356ADDRESS_MAP_END
5457
5558
5659// device definitions
57amis2000_device::amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
58   : cpu_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, "amis2000", __FILE__),
59   m_program_config("program", ENDIANNESS_BIG, 8, 13, 0, ADDRESS_MAP_NAME(program_1k)),
60   m_data_config("data", ENDIANNESS_BIG, 8, 6, 0, ADDRESS_MAP_NAME(data_64x4)),
61   m_bu_bits(2),
62   m_callstack_bits(10),
63   m_callstack_depth(3),
64   m_read_k(*this),
65   m_read_i(*this),
66   m_read_d(*this),
67   m_write_d(*this),
68   m_write_a(*this)
69{
70}
60amis2000_cpu_device::amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
61   : amis2000_base_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, 2, 10, 3, 13, ADDRESS_MAP_NAME(program_1k), 6, ADDRESS_MAP_NAME(data_64x4), "amis2000", __FILE__)
62{ }
7163
72amis2000_device::amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
73   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
74   m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program),
75   m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data),
76   m_bu_bits(bu_bits),
77   m_callstack_bits(callstack_bits),
78   m_callstack_depth(callstack_depth),
79   m_read_k(*this),
80   m_read_i(*this),
81   m_read_d(*this),
82   m_write_d(*this),
83   m_write_a(*this)
84{
85}
64amis2150_cpu_device::amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
65   : amis2000_base_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__)
66{ }
8667
87amis2150_device::amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
88   : amis2000_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__)
89{
90}
68amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
69   : amis2000_base_device(mconfig, AMI_S2152, "AMI S2152", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2152", __FILE__)
70{ }
9171
9272
73
9374// disasm
94void amis2000_device::state_string_export(const device_state_entry &entry, astring &string)
75void amis2000_base_device::state_string_export(const device_state_entry &entry, astring &string)
9576{
9677   switch (entry.index())
9778   {
r243573r243574
11091   }
11192}
11293
113offs_t amis2000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
94offs_t amis2000_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
11495{
11596   extern CPU_DISASSEMBLE(amis2000);
11697   return CPU_DISASSEMBLE_NAME(amis2000)(this, buffer, pc, oprom, opram, options);
r243573r243574
128109   S2000_ACC, S2000_E, S2000_CY
129110};
130111
131void amis2000_device::device_start()
112void amis2000_base_device::device_start()
132113{
133114   m_program = &space(AS_PROGRAM);
134115   m_data = &space(AS_DATA);
r243573r243574
138119   m_read_d.resolve_safe(0);
139120   m_write_d.resolve_safe();
140121   m_write_a.resolve_safe();
122   m_write_f.resolve_safe();
141123
142124   m_bu_mask = (1 << m_bu_bits) - 1;
143125   m_callstack_mask = (1 << m_callstack_bits) - 1;
r243573r243574
202184//  device_reset - device-specific reset
203185//-------------------------------------------------
204186
205void amis2000_device::device_reset()
187void amis2000_base_device::device_reset()
206188{
207189   m_pc = 0;
208190   m_op = 0;
r243573r243574
220202//  execute
221203//-------------------------------------------------
222204
223void amis2000_device::execute_run()
205void amis2000_base_device::execute_run()
224206{
225207   while (m_icount > 0)
226208   {
trunk/src/emu/cpu/amis2000/amis2000.h
r243573r243574
1414
1515// generic input pins (4 bits each)
1616#define MCFG_AMI_S2000_READ_K_CB(_devcb) \
17   amis2000_device::set_read_k_callback(*device, DEVCB_##_devcb);
17   amis2000_base_device::set_read_k_callback(*device, DEVCB_##_devcb);
1818
1919#define MCFG_AMI_S2000_READ_I_CB(_devcb) \
20   amis2000_device::set_read_i_callback(*device, DEVCB_##_devcb);
20   amis2000_base_device::set_read_i_callback(*device, DEVCB_##_devcb);
2121
2222// 8-bit external databus coupled as input/output pins
2323#define MCFG_AMI_S2000_READ_D_CB(_devcb) \
24   amis2000_device::set_read_d_callback(*device, DEVCB_##_devcb);
24   amis2000_base_device::set_read_d_callback(*device, DEVCB_##_devcb);
2525
2626#define MCFG_AMI_S2000_WRITE_D_CB(_devcb) \
27   amis2000_device::set_write_d_callback(*device, DEVCB_##_devcb);
27   amis2000_base_device::set_write_d_callback(*device, DEVCB_##_devcb);
2828
2929// 13-bit external addressbus coupled as output pins
3030#define MCFG_AMI_S2000_WRITE_A_CB(_devcb) \
31   amis2000_device::set_write_a_callback(*device, DEVCB_##_devcb);
31   amis2000_base_device::set_write_a_callback(*device, DEVCB_##_devcb);
3232
33// F_out pin (only for S2152)
34#define MCFG_AMI_S2152_FOUT_CB(_devcb) \
35   amis2000_base_device::set_write_f_callback(*device, DEVCB_##_devcb);
3336
34class amis2000_device : public cpu_device
37
38class amis2000_base_device : public cpu_device
3539{
3640public:
3741   // construction/destruction
38   amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
39   amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source);
42   amis2000_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
43      : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
44      , m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program)
45      , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data)
46      , m_bu_bits(bu_bits)
47      , m_callstack_bits(callstack_bits)
48      , m_callstack_depth(callstack_depth)
49      , m_read_k(*this)
50      , m_read_i(*this)
51      , m_read_d(*this)
52      , m_write_d(*this)
53      , m_write_a(*this)
54      , m_write_f(*this)
55   { }
4056
4157   // static configuration helpers
42   template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_k.set_callback(object); }
43   template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_i.set_callback(object); }
44   template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_d.set_callback(object); }
45   template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_d.set_callback(object); }
46   template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_a.set_callback(object); }
58   template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_k.set_callback(object); }
59   template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_i.set_callback(object); }
60   template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_d.set_callback(object); }
61   template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_d.set_callback(object); }
62   template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_a.set_callback(object); }
63   template<class _Object> static devcb_base &set_write_f_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_f.set_callback(object); }
4764
4865protected:
4966   // device-level overrides
r243573r243574
103120   devcb_read8 m_read_d;
104121   devcb_write8 m_write_d;
105122   devcb_write16 m_write_a;
123   devcb_write_line m_write_f;
106124   
107125   // misc internal helpers
108126   UINT8 ram_r();
r243573r243574
112130   void d_latch_out(bool active);
113131   
114132   // opcode handlers
115   void op_lai();
116   void op_lab();
117   void op_lae();
118   void op_xab();
119   void op_xabu();
120   void op_xae();
121   void op_lbe();
122   void op_lbep();
123   void op_lbz();
124   void op_lbf();
133   virtual void op_lai();
134   virtual void op_lab();
135   virtual void op_lae();
136   virtual void op_xab();
137   virtual void op_xabu();
138   virtual void op_xae();
139   virtual void op_lbe();
140   virtual void op_lbep();
141   virtual void op_lbz();
142   virtual void op_lbf();
125143
126   void op_lam();
127   void op_xc();
128   void op_xci();
129   void op_xcd();
130   void op_stm();
131   void op_rsm();
144   virtual void op_lam();
145   virtual void op_xc();
146   virtual void op_xci();
147   virtual void op_xcd();
148   virtual void op_stm();
149   virtual void op_rsm();
132150
133   void op_inp();
134   void op_out();
135   void op_disb();
136   void op_disn();
137   void op_mvs();
138   void op_psh();
139   void op_psl();
140   void op_eur();
151   virtual void op_inp();
152   virtual void op_out();
153   virtual void op_disb();
154   virtual void op_disn();
155   virtual void op_mvs();
156   virtual void op_psh();
157   virtual void op_psl();
158   virtual void op_eur();
141159
142   void op_pp();
143   void op_jmp();
144   void op_jms();
145   void op_rt();
146   void op_rts();
147   void op_nop();
148   void op_halt();
160   virtual void op_pp();
161   virtual void op_jmp();
162   virtual void op_jms();
163   virtual void op_rt();
164   virtual void op_rts();
165   virtual void op_nop();
166   virtual void op_halt();
149167
150   void op_szc();
151   void op_szm();
152   void op_szi();
153   void op_szk();
154   void op_sbe();
155   void op_sam();
156   void op_sos();
157   void op_tf1();
158   void op_tf2();
168   virtual void op_szc();
169   virtual void op_szm();
170   virtual void op_szi();
171   virtual void op_szk();
172   virtual void op_sbe();
173   virtual void op_sam();
174   virtual void op_sos();
175   virtual void op_tf1();
176   virtual void op_tf2();
159177
160   void op_adcs();
161   void op_adis();
162   void op_add();
163   void op_and();
164   void op_xor();
165   void op_stc();
166   void op_rsc();
167   void op_cma();
168   void op_sf1();
169   void op_rf1();
170   void op_sf2();
171   void op_rf2();
178   virtual void op_adcs();
179   virtual void op_adis();
180   virtual void op_add();
181   virtual void op_and();
182   virtual void op_xor();
183   virtual void op_stc();
184   virtual void op_rsc();
185   virtual void op_cma();
186   virtual void op_sf1();
187   virtual void op_rf1();
188   virtual void op_sf2();
189   virtual void op_rf2();
172190};
173191
174192
175class amis2150_device : public amis2000_device
193class amis2000_cpu_device : public amis2000_base_device
176194{
177195public:
178   amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
196   amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
179197};
180198
181199
200class amis2150_cpu_device : public amis2000_base_device
201{
202public:
203   amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
204};
182205
206
207class amis2152_cpu_device : public amis2000_base_device
208{
209public:
210   amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
211};
212
213
214
183215extern const device_type AMI_S2000;
184216extern const device_type AMI_S2150;
217extern const device_type AMI_S2152;
185218
186219
187220#endif /* _AMIS2000_H_ */
trunk/src/emu/cpu/amis2000/amis2000op.inc
r243573r243574
22
33// internal helpers
44
5inline UINT8 amis2000_device::ram_r()
5inline UINT8 amis2000_base_device::ram_r()
66{
77   UINT16 address = m_bu << 4 | m_bl;
88   return m_data->read_byte(address) & 0xf;
99}
1010
11inline void amis2000_device::ram_w(UINT8 data)
11inline void amis2000_base_device::ram_w(UINT8 data)
1212{
1313   UINT16 address = m_bu << 4 | m_bl;
1414   m_data->write_byte(address, data & 0xf);
1515}
1616
17void amis2000_device::pop_callstack()
17void amis2000_base_device::pop_callstack()
1818{
1919   m_pc = (m_pc & ~m_callstack_mask) | (m_callstack[0] & m_callstack_mask);
2020   for (int i = 0; i < m_callstack_depth-1; i++)
2121      m_callstack[i] = m_callstack[i+1];
2222}
2323
24void amis2000_device::push_callstack()
24void amis2000_base_device::push_callstack()
2525{
2626   for (int i = m_callstack_depth-1; i >= 1; i--)
2727      m_callstack[i] = m_callstack[i-1];
2828   m_callstack[0] = m_pc & m_callstack_mask;
2929}
3030
31void amis2000_device::d_latch_out(bool active)
31void amis2000_base_device::d_latch_out(bool active)
3232{
3333   m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff);
3434   m_d_active = active;
r243573r243574
3737
3838// Register Instructions
3939
40void amis2000_device::op_lai()
40void amis2000_base_device::op_lai()
4141{
4242   // LAI X: load ACC with X, select I and K inputs
4343   // note: only execute the first one in a sequence of LAI
r243573r243574
4949   }
5050}
5151
52void amis2000_device::op_lab()
52void amis2000_base_device::op_lab()
5353{
5454   // LAB: load ACC with BL
5555   m_acc = m_bl;
5656}
5757
58void amis2000_device::op_lae()
58void amis2000_base_device::op_lae()
5959{
6060   // LAE: load ACC with E
6161   m_acc = m_e;
6262}
6363
64void amis2000_device::op_xab()
64void amis2000_base_device::op_xab()
6565{
6666   // XAB: exchange ACC with BL
6767   UINT8 old_acc = m_acc;
r243573r243574
6969   m_bl = old_acc;
7070}
7171
72void amis2000_device::op_xabu()
72void amis2000_base_device::op_xabu()
7373{
7474   // XABU: exchange ACC with BU
7575   UINT8 old_acc = m_acc;
r243573r243574
7777   m_bu = old_acc & m_bu_mask;
7878}
7979
80void amis2000_device::op_xae()
80void amis2000_base_device::op_xae()
8181{
8282   // XAE: exchange ACC with E
8383   UINT8 old_acc = m_acc;
r243573r243574
8585   m_e = old_acc;
8686}
8787
88void amis2000_device::op_lbe()
88void amis2000_base_device::op_lbe()
8989{
9090   // LBE Y: load BU with Y, load BL with E
9191   // note: only execute the first one in a sequence of LB*
r243573r243574
9797   }
9898}
9999
100void amis2000_device::op_lbep()
100void amis2000_base_device::op_lbep()
101101{
102102   // LBEP Y: load BU with Y, load BL with E+1
103103   // note: only execute the first one in a sequence of LB*
r243573r243574
109109   }
110110}
111111
112void amis2000_device::op_lbz()
112void amis2000_base_device::op_lbz()
113113{
114114   // LBZ Y: load BU with Y, load BL with 0
115115   // note: only execute the first one in a sequence of LB*
r243573r243574
121121   }
122122}
123123
124void amis2000_device::op_lbf()
124void amis2000_base_device::op_lbf()
125125{
126126   // LBF Y: load BU with Y, load BL with 15
127127   // note: only execute the first one in a sequence of LB*
r243573r243574
136136
137137// RAM Instructions
138138
139void amis2000_device::op_lam()
139void amis2000_base_device::op_lam()
140140{
141141   // LAM _Y: load ACC with RAM, xor BU with _Y
142142   m_acc = ram_r();
r243573r243574
144144   m_bu ^= (param & m_bu_mask);
145145}
146146
147void amis2000_device::op_xc()
147void amis2000_base_device::op_xc()
148148{
149149   // XC _Y: exchange ACC with RAM, xor BU with _Y
150150   UINT8 old_acc = m_acc;
r243573r243574
154154   m_bu ^= (param & m_bu_mask);
155155}
156156
157void amis2000_device::op_xci()
157void amis2000_base_device::op_xci()
158158{
159159   // XCI _Y: exchange ACC with RAM, increment BL(skip next on carry), xor BU with _Y
160160   op_xc();
r243573r243574
162162   m_skip = (m_bl == 0);
163163}
164164
165void amis2000_device::op_xcd()
165void amis2000_base_device::op_xcd()
166166{
167167   // XCD _Y: exchange ACC with RAM, decrement BL(skip next on carry), xor BU with _Y
168168   op_xc();
r243573r243574
170170   m_skip = (m_bl == 0xf);
171171}
172172
173void amis2000_device::op_stm()
173void amis2000_base_device::op_stm()
174174{
175175   // STM Z: set RAM bit Z
176176   UINT8 param = 1 << (m_op & 0x03);
177177   ram_w(ram_r() | param);
178178}
179179
180void amis2000_device::op_rsm()
180void amis2000_base_device::op_rsm()
181181{
182182   // RSM Z: reset RAM bit Z
183183   UINT8 param = 1 << (m_op & 0x03);
r243573r243574
187187
188188// Input/Output Instructions
189189
190void amis2000_device::op_inp()
190void amis2000_base_device::op_inp()
191191{
192192   // INP: input D-pins to ACC and RAM
193193   UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff);
r243573r243574
195195   ram_w(in >> 4 & 0xf);
196196}
197197
198void amis2000_device::op_out()
198void amis2000_base_device::op_out()
199199{
200200   // OUT: pulse output ACC and RAM to D-pins
201201   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
202202}
203203
204void amis2000_device::op_disb()
204void amis2000_base_device::op_disb()
205205{
206206   // DISB: set D-latch to ACC and RAM directly
207207   m_d = m_acc | ram_r() << 4;
208208   d_latch_out(true);
209209}
210210
211void amis2000_device::op_disn()
211void amis2000_base_device::op_disn()
212212{
213213   // DISN: set D-latch to ACC+carry via on-die segment decoder
214214   static const UINT8 lut_segment_decoder[0x10] =
r243573r243574
220220   d_latch_out(true);
221221}
222222
223void amis2000_device::op_mvs()
223void amis2000_base_device::op_mvs()
224224{
225225   // MVS: output master strobe latch to A-pins
226226   d_latch_out(false);
227227   m_write_a(0, m_a, 0xffff);
228228}
229229
230void amis2000_device::op_psh()
230void amis2000_base_device::op_psh()
231231{
232232   // PSH: preset high(BL) master strobe latch
233233   switch (m_bl)
r243573r243574
254254   }
255255}
256256
257void amis2000_device::op_psl()
257void amis2000_base_device::op_psl()
258258{
259259   // PSL: preset low(BL) master strobe latch
260260   switch (m_bl)
r243573r243574
281281   }
282282}
283283
284void amis2000_device::op_eur()
284void amis2000_base_device::op_eur()
285285{
286286   // EUR: set timer frequency(European) and D-latch polarity, via ACC
287287   m_d_polarity = (m_acc & 1) ? 0x00 : 0xff;
r243573r243574
291291
292292// Program Control Instructions
293293
294void amis2000_device::op_pp()
294void amis2000_base_device::op_pp()
295295{
296296   // PP _X: prepare page/bank with _X
297297   UINT8 param = ~m_op & 0x0f;
r243573r243574
301301      m_pbr = param & 7;
302302}
303303
304void amis2000_device::op_jmp()
304void amis2000_base_device::op_jmp()
305305{
306306   // JMP X: jump to X(+PP)
307307   UINT16 mask = 0x3f;
r243573r243574
316316   m_pc = (m_pc & ~mask) | param;
317317}
318318
319void amis2000_device::op_jms()
319void amis2000_base_device::op_jms()
320320{
321321   // JMS X: call to X(+PP)
322322   m_icount--;
r243573r243574
328328      m_pc |= 0x3c0;
329329}
330330
331void amis2000_device::op_rt()
331void amis2000_base_device::op_rt()
332332{
333333   // RT: return from subroutine
334334   pop_callstack();
335335}
336336
337void amis2000_device::op_rts()
337void amis2000_base_device::op_rts()
338338{
339339   // RTS: return from subroutine and skip next
340340   op_rt();
341341   m_skip = true;
342342}
343343
344void amis2000_device::op_nop()
344void amis2000_base_device::op_nop()
345345{
346346   // NOP: no operation
347347}
348348
349void amis2000_device::op_halt()
349void amis2000_base_device::op_halt()
350350{
351351   // HALT: debugger breakpoint for devkit-use
352352   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
r243573r243574
355355
356356// Skip Instructions
357357
358void amis2000_device::op_szc()
358void amis2000_base_device::op_szc()
359359{
360360   // SZC: skip next on zero(no) carry
361361   m_skip = !m_carry;
362362}
363363
364void amis2000_device::op_szm()
364void amis2000_base_device::op_szm()
365365{
366366   // SZM Z: skip next on zero RAM bit Z
367367   UINT8 param = 1 << (m_op & 0x03);
368368   m_skip = !(ram_r() & param);
369369}
370370
371void amis2000_device::op_szi()
371void amis2000_base_device::op_szi()
372372{
373373   // SZI: skip next on I pin(s)
374374   m_skip = ((~m_read_i(0, 0xff) & m_ki_mask) != 0);
375375}
376376
377void amis2000_device::op_szk()
377void amis2000_base_device::op_szk()
378378{
379379   // SZK: skip next on K pin(s)
380380   m_skip = ((~m_read_k(0, 0xff) & m_ki_mask) != 0);
381381}
382382
383void amis2000_device::op_sbe()
383void amis2000_base_device::op_sbe()
384384{
385385   // SBE: skip next on BL equals E
386386   m_skip = (m_bl == m_e);
387387}
388388
389void amis2000_device::op_sam()
389void amis2000_base_device::op_sam()
390390{
391391   // SAM: skip next on ACC equals RAM
392392   m_skip = (m_acc == ram_r());
393393}
394394
395void amis2000_device::op_sos()
395void amis2000_base_device::op_sos()
396396{
397397   // SOS: skip next on SF(timer output), clear SF
398398   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
399399}
400400
401void amis2000_device::op_tf1()
401void amis2000_base_device::op_tf1()
402402{
403403   // TF1: skip next on flag 1
404404   m_skip = ((m_f & 0x01) != 0);
405405}
406406
407void amis2000_device::op_tf2()
407void amis2000_base_device::op_tf2()
408408{
409409   // TF2: skip next on flag 2
410410   m_skip = ((m_f & 0x02) != 0);
r243573r243574
413413
414414// Arithmetic and Logical Instructions
415415
416void amis2000_device::op_adcs()
416void amis2000_base_device::op_adcs()
417417{
418418   // ADCS: add RAM to ACC+carry, skip next on not carry
419419   m_acc += ram_r() + m_carry;
r243573r243574
422422   m_acc &= 0xf;
423423}
424424
425void amis2000_device::op_adis()
425void amis2000_base_device::op_adis()
426426{
427427   // ADIS X: add X to ACC, skip next on not carry
428428   UINT8 param = m_op & 0x0f;
r243573r243574
431431   m_acc &= 0xf;
432432}
433433
434void amis2000_device::op_add()
434void amis2000_base_device::op_add()
435435{
436436   // ADD: add RAM to ACC
437437   m_acc = (m_acc + ram_r()) & 0xf;
438438}
439439
440void amis2000_device::op_and()
440void amis2000_base_device::op_and()
441441{
442442   // AND: and ACC with RAM
443443   m_acc &= ram_r();
444444}
445445
446void amis2000_device::op_xor()
446void amis2000_base_device::op_xor()
447447{
448448   // XOR: xor ACC with RAM
449449   m_acc ^= ram_r();
450450}
451451
452void amis2000_device::op_stc()
452void amis2000_base_device::op_stc()
453453{
454454   // STC: set carry
455455   m_carry = 1;
456456}
457457
458void amis2000_device::op_rsc()
458void amis2000_base_device::op_rsc()
459459{
460460   // RSC: reset carry
461461   m_carry = 0;
462462}
463463
464void amis2000_device::op_cma()
464void amis2000_base_device::op_cma()
465465{
466466   // CMA: complement ACC
467467   m_acc ^= 0xf;
468468}
469469
470void amis2000_device::op_sf1()
470void amis2000_base_device::op_sf1()
471471{
472472   // SF1: set flag 1
473473   m_f |= 0x01;
474474}
475475
476void amis2000_device::op_rf1()
476void amis2000_base_device::op_rf1()
477477{
478478   // RF1: reset flag 1
479479   m_f &= ~0x01;
480480}
481481
482void amis2000_device::op_sf2()
482void amis2000_base_device::op_sf2()
483483{
484484   // SF2: set flag 2
485485   m_f |= 0x02;
486486}
487487
488void amis2000_device::op_rf2()
488void amis2000_base_device::op_rf2()
489489{
490490   // RF2: reset flag 2
491491   m_f &= ~0x02;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team