2 Skelton for retropc emulator
5 Author : Takeda.Toshiya
11 #include "mcs48_flags.h"
17 /***************************************************************************
21 Intel MCS-48/UPI-41 Portable Emulator
23 Copyright Mirko Buffoni
24 Based on the original work Copyright Dan Boris, an 8048 emulator
25 You are not allowed to distribute this software commercially
27 ****************************************************************************
29 Note that the default internal divisor for this chip is by 3 and
30 then again by 5, or by 15 total.
32 ***************************************************************************/
34 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
35 #pragma warning( disable : 4244 )
39 /***************************************************************************
41 ***************************************************************************/
44 __MCS48_OPHANDLER( illegal )
46 // logerror("MCS-48 PC:%04X - Illegal opcode = %02x\n", cpustate->pc - 1, __mcs48_program_r(cpustate->pc - 1));
50 __MCS48_OPHANDLER( add_a_r0 ) { execute_add(cpustate, __mcs48_reg_r(0)); return 1; }
51 __MCS48_OPHANDLER( add_a_r1 ) { execute_add(cpustate, __mcs48_reg_r(1)); return 1; }
52 __MCS48_OPHANDLER( add_a_r2 ) { execute_add(cpustate, __mcs48_reg_r(2)); return 1; }
53 __MCS48_OPHANDLER( add_a_r3 ) { execute_add(cpustate, __mcs48_reg_r(3)); return 1; }
54 __MCS48_OPHANDLER( add_a_r4 ) { execute_add(cpustate, __mcs48_reg_r(4)); return 1; }
55 __MCS48_OPHANDLER( add_a_r5 ) { execute_add(cpustate, __mcs48_reg_r(5)); return 1; }
56 __MCS48_OPHANDLER( add_a_r6 ) { execute_add(cpustate, __mcs48_reg_r(6)); return 1; }
57 __MCS48_OPHANDLER( add_a_r7 ) { execute_add(cpustate, __mcs48_reg_r(7)); return 1; }
58 __MCS48_OPHANDLER( add_a_xr0 ) { execute_add(cpustate, __mcs48_ram_r(__mcs48_reg_r(0))); return 1; }
59 __MCS48_OPHANDLER( add_a_xr1 ) { execute_add(cpustate, __mcs48_ram_r(__mcs48_reg_r(1))); return 1; }
60 __MCS48_OPHANDLER( add_a_n ) { execute_add(cpustate, argument_fetch(cpustate)); return 2; }
62 __MCS48_OPHANDLER( adc_a_r0 ) { execute_addc(cpustate, __mcs48_reg_r(0)); return 1; }
63 __MCS48_OPHANDLER( adc_a_r1 ) { execute_addc(cpustate, __mcs48_reg_r(1)); return 1; }
64 __MCS48_OPHANDLER( adc_a_r2 ) { execute_addc(cpustate, __mcs48_reg_r(2)); return 1; }
65 __MCS48_OPHANDLER( adc_a_r3 ) { execute_addc(cpustate, __mcs48_reg_r(3)); return 1; }
66 __MCS48_OPHANDLER( adc_a_r4 ) { execute_addc(cpustate, __mcs48_reg_r(4)); return 1; }
67 __MCS48_OPHANDLER( adc_a_r5 ) { execute_addc(cpustate, __mcs48_reg_r(5)); return 1; }
68 __MCS48_OPHANDLER( adc_a_r6 ) { execute_addc(cpustate, __mcs48_reg_r(6)); return 1; }
69 __MCS48_OPHANDLER( adc_a_r7 ) { execute_addc(cpustate, __mcs48_reg_r(7)); return 1; }
70 __MCS48_OPHANDLER( adc_a_xr0 ) { execute_addc(cpustate, __mcs48_ram_r(__mcs48_reg_r(0))); return 1; }
71 __MCS48_OPHANDLER( adc_a_xr1 ) { execute_addc(cpustate, __mcs48_ram_r(__mcs48_reg_r(1))); return 1; }
72 __MCS48_OPHANDLER( adc_a_n ) { execute_addc(cpustate, argument_fetch(cpustate)); return 2; }
74 __MCS48_OPHANDLER( anl_a_r0 ) { cpustate->a &= __mcs48_reg_r(0); return 1; }
75 __MCS48_OPHANDLER( anl_a_r1 ) { cpustate->a &= __mcs48_reg_r(1); return 1; }
76 __MCS48_OPHANDLER( anl_a_r2 ) { cpustate->a &= __mcs48_reg_r(2); return 1; }
77 __MCS48_OPHANDLER( anl_a_r3 ) { cpustate->a &= __mcs48_reg_r(3); return 1; }
78 __MCS48_OPHANDLER( anl_a_r4 ) { cpustate->a &= __mcs48_reg_r(4); return 1; }
79 __MCS48_OPHANDLER( anl_a_r5 ) { cpustate->a &= __mcs48_reg_r(5); return 1; }
80 __MCS48_OPHANDLER( anl_a_r6 ) { cpustate->a &= __mcs48_reg_r(6); return 1; }
81 __MCS48_OPHANDLER( anl_a_r7 ) { cpustate->a &= __mcs48_reg_r(7); return 1; }
82 __MCS48_OPHANDLER( anl_a_xr0 ) { cpustate->a &= __mcs48_ram_r(__mcs48_reg_r(0)); return 1; }
83 __MCS48_OPHANDLER( anl_a_xr1 ) { cpustate->a &= __mcs48_ram_r(__mcs48_reg_r(1)); return 1; }
84 __MCS48_OPHANDLER( anl_a_n ) { cpustate->a &= argument_fetch(cpustate); return 2; }
86 __MCS48_OPHANDLER( anl_bus_n ) { __mcs48_bus_w(__mcs48_bus_r() & argument_fetch(cpustate)); return 2; }
87 __MCS48_OPHANDLER( anl_p1_n ) { __mcs48_port_w(1, cpustate->p1 &= argument_fetch(cpustate)); return 2; }
88 __MCS48_OPHANDLER( anl_p2_n ) { __mcs48_port_w(2, cpustate->p2 &= argument_fetch(cpustate)); return 2; }
89 __MCS48_OPHANDLER( anld_p4_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_AND, 4); return 2; }
90 __MCS48_OPHANDLER( anld_p5_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_AND, 5); return 2; }
91 __MCS48_OPHANDLER( anld_p6_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_AND, 6); return 2; }
92 __MCS48_OPHANDLER( anld_p7_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_AND, 7); return 2; }
94 __MCS48_OPHANDLER( call_0 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x000); return 2; }
95 __MCS48_OPHANDLER( call_1 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x100); return 2; }
96 __MCS48_OPHANDLER( call_2 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x200); return 2; }
97 __MCS48_OPHANDLER( call_3 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x300); return 2; }
98 __MCS48_OPHANDLER( call_4 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x400); return 2; }
99 __MCS48_OPHANDLER( call_5 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x500); return 2; }
100 __MCS48_OPHANDLER( call_6 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x600); return 2; }
101 __MCS48_OPHANDLER( call_7 ) { execute_call(cpustate, argument_fetch(cpustate) | 0x700); return 2; }
103 __MCS48_OPHANDLER( clr_a ) { cpustate->a = 0; return 1; }
104 __MCS48_OPHANDLER( clr_c ) { cpustate->psw &= ~C_FLAG; return 1; }
105 __MCS48_OPHANDLER( clr_f0 ) { cpustate->psw &= ~F_FLAG; cpustate->sts &= ~STS_F0; return 1; }
106 __MCS48_OPHANDLER( clr_f1 ) { cpustate->sts &= ~STS_F1; return 1; }
108 __MCS48_OPHANDLER( cpl_a ) { cpustate->a ^= 0xff; return 1; }
109 __MCS48_OPHANDLER( cpl_c ) { cpustate->psw ^= C_FLAG; return 1; }
110 __MCS48_OPHANDLER( cpl_f0 ) { cpustate->psw ^= F_FLAG; cpustate->sts ^= STS_F0; return 1; }
111 __MCS48_OPHANDLER( cpl_f1 ) { cpustate->sts ^= STS_F1; return 1; }
113 __MCS48_OPHANDLER( da_a )
115 if ((cpustate->a & 0x0f) > 0x09 || (cpustate->psw & A_FLAG))
118 if ((cpustate->a & 0xf0) == 0x00)
119 cpustate->psw |= C_FLAG;
121 if ((cpustate->a & 0xf0) > 0x90 || (cpustate->psw & C_FLAG))
124 cpustate->psw |= C_FLAG;
127 cpustate->psw &= ~C_FLAG;
131 __MCS48_OPHANDLER( dec_a ) { cpustate->a--; return 1; }
132 __MCS48_OPHANDLER( dec_r0 ) { __mcs48_reg_w(0, __mcs48_reg_r(0) - 1); return 1; }
133 __MCS48_OPHANDLER( dec_r1 ) { __mcs48_reg_w(1, __mcs48_reg_r(1) - 1); return 1; }
134 __MCS48_OPHANDLER( dec_r2 ) { __mcs48_reg_w(2, __mcs48_reg_r(2) - 1); return 1; }
135 __MCS48_OPHANDLER( dec_r3 ) { __mcs48_reg_w(3, __mcs48_reg_r(3) - 1); return 1; }
136 __MCS48_OPHANDLER( dec_r4 ) { __mcs48_reg_w(4, __mcs48_reg_r(4) - 1); return 1; }
137 __MCS48_OPHANDLER( dec_r5 ) { __mcs48_reg_w(5, __mcs48_reg_r(5) - 1); return 1; }
138 __MCS48_OPHANDLER( dec_r6 ) { __mcs48_reg_w(6, __mcs48_reg_r(6) - 1); return 1; }
139 __MCS48_OPHANDLER( dec_r7 ) { __mcs48_reg_w(7, __mcs48_reg_r(7) - 1); return 1; }
141 __MCS48_OPHANDLER( dis_i ) { cpustate->xirq_enabled = FALSE; return 1; }
142 __MCS48_OPHANDLER( dis_tcnti ) { cpustate->tirq_enabled = FALSE; cpustate->timer_overflow = FALSE; return 1; }
144 __MCS48_OPHANDLER( djnz_r0 ) { UINT8 r0 = __mcs48_reg_r(0); __mcs48_reg_w(0, --r0); execute_jcc(cpustate, r0 != 0); return 2; }
145 __MCS48_OPHANDLER( djnz_r1 ) { UINT8 r1 = __mcs48_reg_r(1); __mcs48_reg_w(1, --r1); execute_jcc(cpustate, r1 != 0); return 2; }
146 __MCS48_OPHANDLER( djnz_r2 ) { UINT8 r2 = __mcs48_reg_r(2); __mcs48_reg_w(2, --r2); execute_jcc(cpustate, r2 != 0); return 2; }
147 __MCS48_OPHANDLER( djnz_r3 ) { UINT8 r3 = __mcs48_reg_r(3); __mcs48_reg_w(3, --r3); execute_jcc(cpustate, r3 != 0); return 2; }
148 __MCS48_OPHANDLER( djnz_r4 ) { UINT8 r4 = __mcs48_reg_r(4); __mcs48_reg_w(4, --r4); execute_jcc(cpustate, r4 != 0); return 2; }
149 __MCS48_OPHANDLER( djnz_r5 ) { UINT8 r5 = __mcs48_reg_r(5); __mcs48_reg_w(5, --r5); execute_jcc(cpustate, r5 != 0); return 2; }
150 __MCS48_OPHANDLER( djnz_r6 ) { UINT8 r6 = __mcs48_reg_r(6); __mcs48_reg_w(6, --r6); execute_jcc(cpustate, r6 != 0); return 2; }
151 __MCS48_OPHANDLER( djnz_r7 ) { UINT8 r7 = __mcs48_reg_r(7); __mcs48_reg_w(7, --r7); execute_jcc(cpustate, r7 != 0); return 2; }
153 __MCS48_OPHANDLER( en_i ) { cpustate->xirq_enabled = TRUE; return 1 + check_irqs(cpustate); }
154 __MCS48_OPHANDLER( en_tcnti ) { cpustate->tirq_enabled = TRUE; return 1 + check_irqs(cpustate); }
155 __MCS48_OPHANDLER( ent0_clk ) { cpustate->t0_clk_enabled = TRUE; return 1; }
157 __MCS48_OPHANDLER( in_a_p1 ) { cpustate->a = __mcs48_port_r(1) & cpustate->p1; return 2; }
158 __MCS48_OPHANDLER( in_a_p2 ) { cpustate->a = __mcs48_port_r(2) & cpustate->p2; return 2; }
159 __MCS48_OPHANDLER( ins_a_bus ) { cpustate->a = __mcs48_bus_r(); return 2; }
161 __MCS48_OPHANDLER( inc_a ) { cpustate->a++; return 1; }
162 __MCS48_OPHANDLER( inc_r0 ) { __mcs48_reg_w(0, __mcs48_reg_r(0) + 1); return 1; }
163 __MCS48_OPHANDLER( inc_r1 ) { __mcs48_reg_w(1, __mcs48_reg_r(1) + 1); return 1; }
164 __MCS48_OPHANDLER( inc_r2 ) { __mcs48_reg_w(2, __mcs48_reg_r(2) + 1); return 1; }
165 __MCS48_OPHANDLER( inc_r3 ) { __mcs48_reg_w(3, __mcs48_reg_r(3) + 1); return 1; }
166 __MCS48_OPHANDLER( inc_r4 ) { __mcs48_reg_w(4, __mcs48_reg_r(4) + 1); return 1; }
167 __MCS48_OPHANDLER( inc_r5 ) { __mcs48_reg_w(5, __mcs48_reg_r(5) + 1); return 1; }
168 __MCS48_OPHANDLER( inc_r6 ) { __mcs48_reg_w(6, __mcs48_reg_r(6) + 1); return 1; }
169 __MCS48_OPHANDLER( inc_r7 ) { __mcs48_reg_w(7, __mcs48_reg_r(7) + 1); return 1; }
170 __MCS48_OPHANDLER( inc_xr0 ) { UINT8 r0 = __mcs48_reg_r(0); __mcs48_ram_w(r0, __mcs48_ram_r(r0) + 1); return 1; }
171 __MCS48_OPHANDLER( inc_xr1 ) { UINT8 r1 = __mcs48_reg_r(1); __mcs48_ram_w(r1, __mcs48_ram_r(r1) + 1); return 1; }
173 __MCS48_OPHANDLER( jb_0 ) { execute_jcc(cpustate, (cpustate->a & 0x01) != 0); return 2; }
174 __MCS48_OPHANDLER( jb_1 ) { execute_jcc(cpustate, (cpustate->a & 0x02) != 0); return 2; }
175 __MCS48_OPHANDLER( jb_2 ) { execute_jcc(cpustate, (cpustate->a & 0x04) != 0); return 2; }
176 __MCS48_OPHANDLER( jb_3 ) { execute_jcc(cpustate, (cpustate->a & 0x08) != 0); return 2; }
177 __MCS48_OPHANDLER( jb_4 ) { execute_jcc(cpustate, (cpustate->a & 0x10) != 0); return 2; }
178 __MCS48_OPHANDLER( jb_5 ) { execute_jcc(cpustate, (cpustate->a & 0x20) != 0); return 2; }
179 __MCS48_OPHANDLER( jb_6 ) { execute_jcc(cpustate, (cpustate->a & 0x40) != 0); return 2; }
180 __MCS48_OPHANDLER( jb_7 ) { execute_jcc(cpustate, (cpustate->a & 0x80) != 0); return 2; }
181 __MCS48_OPHANDLER( jc ) { execute_jcc(cpustate, (cpustate->psw & C_FLAG) != 0); return 2; }
182 __MCS48_OPHANDLER( jf0 ) { execute_jcc(cpustate, (cpustate->psw & F_FLAG) != 0); return 2; }
183 __MCS48_OPHANDLER( jf1 ) { execute_jcc(cpustate, (cpustate->sts & STS_F1) != 0); return 2; }
184 __MCS48_OPHANDLER( jnc ) { execute_jcc(cpustate, (cpustate->psw & C_FLAG) == 0); return 2; }
185 __MCS48_OPHANDLER( jni ) { execute_jcc(cpustate, cpustate->int_state == 0); return 2; }
186 __MCS48_OPHANDLER( jnt_0 ) { execute_jcc(cpustate, __mcs48_test_r(0) == 0); return 2; }
187 __MCS48_OPHANDLER( jnt_1 ) { execute_jcc(cpustate, __mcs48_test_r(1) == 0); return 2; }
188 __MCS48_OPHANDLER( jnz ) { execute_jcc(cpustate, cpustate->a != 0); return 2; }
189 __MCS48_OPHANDLER( jtf ) { execute_jcc(cpustate, cpustate->timer_flag); cpustate->timer_flag = FALSE; return 2; }
190 __MCS48_OPHANDLER( jt_0 ) { execute_jcc(cpustate, __mcs48_test_r(0) != 0); return 2; }
191 __MCS48_OPHANDLER( jt_1 ) { execute_jcc(cpustate, __mcs48_test_r(1) != 0); return 2; }
192 __MCS48_OPHANDLER( jz ) { execute_jcc(cpustate, cpustate->a == 0); return 2; }
194 __MCS48_OPHANDLER( jmp_0 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x000); return 2; }
195 __MCS48_OPHANDLER( jmp_1 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x100); return 2; }
196 __MCS48_OPHANDLER( jmp_2 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x200); return 2; }
197 __MCS48_OPHANDLER( jmp_3 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x300); return 2; }
198 __MCS48_OPHANDLER( jmp_4 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x400); return 2; }
199 __MCS48_OPHANDLER( jmp_5 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x500); return 2; }
200 __MCS48_OPHANDLER( jmp_6 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x600); return 2; }
201 __MCS48_OPHANDLER( jmp_7 ) { execute_jmp(cpustate, argument_fetch(cpustate) | 0x700); return 2; }
202 __MCS48_OPHANDLER( jmpp_xa ) { cpustate->pc &= 0xf00; cpustate->pc |= __mcs48_program_r(cpustate->pc | cpustate->a); return 2; }
204 __MCS48_OPHANDLER( mov_a_n ) { cpustate->a = argument_fetch(cpustate); return 2; }
205 __MCS48_OPHANDLER( mov_a_psw ) { cpustate->a = cpustate->psw; return 1; }
206 __MCS48_OPHANDLER( mov_a_r0 ) { cpustate->a = __mcs48_reg_r(0); return 1; }
207 __MCS48_OPHANDLER( mov_a_r1 ) { cpustate->a = __mcs48_reg_r(1); return 1; }
208 __MCS48_OPHANDLER( mov_a_r2 ) { cpustate->a = __mcs48_reg_r(2); return 1; }
209 __MCS48_OPHANDLER( mov_a_r3 ) { cpustate->a = __mcs48_reg_r(3); return 1; }
210 __MCS48_OPHANDLER( mov_a_r4 ) { cpustate->a = __mcs48_reg_r(4); return 1; }
211 __MCS48_OPHANDLER( mov_a_r5 ) { cpustate->a = __mcs48_reg_r(5); return 1; }
212 __MCS48_OPHANDLER( mov_a_r6 ) { cpustate->a = __mcs48_reg_r(6); return 1; }
213 __MCS48_OPHANDLER( mov_a_r7 ) { cpustate->a = __mcs48_reg_r(7); return 1; }
214 __MCS48_OPHANDLER( mov_a_xr0 ) { cpustate->a = __mcs48_ram_r(__mcs48_reg_r(0)); return 1; }
215 __MCS48_OPHANDLER( mov_a_xr1 ) { cpustate->a = __mcs48_ram_r(__mcs48_reg_r(1)); return 1; }
216 __MCS48_OPHANDLER( mov_a_t ) { cpustate->a = cpustate->timer; return 1; }
218 __MCS48_OPHANDLER( mov_psw_a ) { cpustate->psw = cpustate->a; update_regptr(cpustate); return 1; }
219 __MCS48_OPHANDLER( mov_r0_a ) { __mcs48_reg_w(0, cpustate->a); return 1; }
220 __MCS48_OPHANDLER( mov_r1_a ) { __mcs48_reg_w(1, cpustate->a); return 1; }
221 __MCS48_OPHANDLER( mov_r2_a ) { __mcs48_reg_w(2, cpustate->a); return 1; }
222 __MCS48_OPHANDLER( mov_r3_a ) { __mcs48_reg_w(3, cpustate->a); return 1; }
223 __MCS48_OPHANDLER( mov_r4_a ) { __mcs48_reg_w(4, cpustate->a); return 1; }
224 __MCS48_OPHANDLER( mov_r5_a ) { __mcs48_reg_w(5, cpustate->a); return 1; }
225 __MCS48_OPHANDLER( mov_r6_a ) { __mcs48_reg_w(6, cpustate->a); return 1; }
226 __MCS48_OPHANDLER( mov_r7_a ) { __mcs48_reg_w(7, cpustate->a); return 1; }
227 __MCS48_OPHANDLER( mov_r0_n ) { __mcs48_reg_w(0, argument_fetch(cpustate)); return 2; }
228 __MCS48_OPHANDLER( mov_r1_n ) { __mcs48_reg_w(1, argument_fetch(cpustate)); return 2; }
229 __MCS48_OPHANDLER( mov_r2_n ) { __mcs48_reg_w(2, argument_fetch(cpustate)); return 2; }
230 __MCS48_OPHANDLER( mov_r3_n ) { __mcs48_reg_w(3, argument_fetch(cpustate)); return 2; }
231 __MCS48_OPHANDLER( mov_r4_n ) { __mcs48_reg_w(4, argument_fetch(cpustate)); return 2; }
232 __MCS48_OPHANDLER( mov_r5_n ) { __mcs48_reg_w(5, argument_fetch(cpustate)); return 2; }
233 __MCS48_OPHANDLER( mov_r6_n ) { __mcs48_reg_w(6, argument_fetch(cpustate)); return 2; }
234 __MCS48_OPHANDLER( mov_r7_n ) { __mcs48_reg_w(7, argument_fetch(cpustate)); return 2; }
235 __MCS48_OPHANDLER( mov_t_a ) { cpustate->timer = cpustate->a; return 1; }
236 __MCS48_OPHANDLER( mov_xr0_a ) { __mcs48_ram_w(__mcs48_reg_r(0), cpustate->a); return 1; }
237 __MCS48_OPHANDLER( mov_xr1_a ) { __mcs48_ram_w(__mcs48_reg_r(1), cpustate->a); return 1; }
238 __MCS48_OPHANDLER( mov_xr0_n ) { __mcs48_ram_w(__mcs48_reg_r(0), argument_fetch(cpustate)); return 2; }
239 __MCS48_OPHANDLER( mov_xr1_n ) { __mcs48_ram_w(__mcs48_reg_r(1), argument_fetch(cpustate)); return 2; }
241 __MCS48_OPHANDLER( movd_a_p4 ) { expander_operation(cpustate, MCS48_EXPANDER_OP_READ, 4); return 2; }
242 __MCS48_OPHANDLER( movd_a_p5 ) { expander_operation(cpustate, MCS48_EXPANDER_OP_READ, 5); return 2; }
243 __MCS48_OPHANDLER( movd_a_p6 ) { expander_operation(cpustate, MCS48_EXPANDER_OP_READ, 6); return 2; }
244 __MCS48_OPHANDLER( movd_a_p7 ) { expander_operation(cpustate, MCS48_EXPANDER_OP_READ, 7); return 2; }
245 __MCS48_OPHANDLER( movd_p4_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_WRITE, 4); return 2; }
246 __MCS48_OPHANDLER( movd_p5_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_WRITE, 5); return 2; }
247 __MCS48_OPHANDLER( movd_p6_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_WRITE, 6); return 2; }
248 __MCS48_OPHANDLER( movd_p7_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_WRITE, 7); return 2; }
250 __MCS48_OPHANDLER( movp_a_xa ) { cpustate->a = __mcs48_program_r((cpustate->pc & 0xf00) | cpustate->a); return 2; }
251 __MCS48_OPHANDLER( movp3_a_xa ) { cpustate->a = __mcs48_program_r(0x300 | cpustate->a); return 2; }
253 __MCS48_OPHANDLER( movx_a_xr0 ) { cpustate->a = __mcs48_ext_r(__mcs48_reg_r(0)); return 2; }
254 __MCS48_OPHANDLER( movx_a_xr1 ) { cpustate->a = __mcs48_ext_r(__mcs48_reg_r(1)); return 2; }
255 __MCS48_OPHANDLER( movx_xr0_a ) { __mcs48_ext_w(__mcs48_reg_r(0), cpustate->a); return 2; }
256 __MCS48_OPHANDLER( movx_xr1_a ) { __mcs48_ext_w(__mcs48_reg_r(1), cpustate->a); return 2; }
258 __MCS48_OPHANDLER( nop ) { return 1; }
260 __MCS48_OPHANDLER( orl_a_r0 ) { cpustate->a |= __mcs48_reg_r(0); return 1; }
261 __MCS48_OPHANDLER( orl_a_r1 ) { cpustate->a |= __mcs48_reg_r(1); return 1; }
262 __MCS48_OPHANDLER( orl_a_r2 ) { cpustate->a |= __mcs48_reg_r(2); return 1; }
263 __MCS48_OPHANDLER( orl_a_r3 ) { cpustate->a |= __mcs48_reg_r(3); return 1; }
264 __MCS48_OPHANDLER( orl_a_r4 ) { cpustate->a |= __mcs48_reg_r(4); return 1; }
265 __MCS48_OPHANDLER( orl_a_r5 ) { cpustate->a |= __mcs48_reg_r(5); return 1; }
266 __MCS48_OPHANDLER( orl_a_r6 ) { cpustate->a |= __mcs48_reg_r(6); return 1; }
267 __MCS48_OPHANDLER( orl_a_r7 ) { cpustate->a |= __mcs48_reg_r(7); return 1; }
268 __MCS48_OPHANDLER( orl_a_xr0 ) { cpustate->a |= __mcs48_ram_r(__mcs48_reg_r(0)); return 1; }
269 __MCS48_OPHANDLER( orl_a_xr1 ) { cpustate->a |= __mcs48_ram_r(__mcs48_reg_r(1)); return 1; }
270 __MCS48_OPHANDLER( orl_a_n ) { cpustate->a |= argument_fetch(cpustate); return 2; }
272 __MCS48_OPHANDLER( orl_bus_n ) { __mcs48_bus_w(__mcs48_bus_r() | argument_fetch(cpustate)); return 2; }
273 __MCS48_OPHANDLER( orl_p1_n ) { __mcs48_port_w(1, cpustate->p1 |= argument_fetch(cpustate)); return 2; }
274 __MCS48_OPHANDLER( orl_p2_n ) { __mcs48_port_w(2, cpustate->p2 |= argument_fetch(cpustate)); return 2; }
275 __MCS48_OPHANDLER( orld_p4_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_OR, 4); return 2; }
276 __MCS48_OPHANDLER( orld_p5_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_OR, 5); return 2; }
277 __MCS48_OPHANDLER( orld_p6_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_OR, 6); return 2; }
278 __MCS48_OPHANDLER( orld_p7_a ) { expander_operation(cpustate, MCS48_EXPANDER_OP_OR, 7); return 2; }
280 __MCS48_OPHANDLER( outl_bus_a ) { __mcs48_bus_w(cpustate->a); return 2; }
281 __MCS48_OPHANDLER( outl_p1_a ) { __mcs48_port_w(1, cpustate->p1 = cpustate->a); return 2; }
282 __MCS48_OPHANDLER( outl_p2_a ) { __mcs48_port_w(2, cpustate->p2 = cpustate->a); return 2; }
284 __MCS48_OPHANDLER( ret ) { pull_pc(cpustate); return 2; }
285 __MCS48_OPHANDLER( retr )
287 pull_pc_psw(cpustate);
289 /* implicitly clear the IRQ in progress flip flop and re-check interrupts */
290 cpustate->irq_in_progress = FALSE;
291 return 2 + check_irqs(cpustate);
294 __MCS48_OPHANDLER( rl_a ) { cpustate->a = (cpustate->a << 1) | (cpustate->a >> 7); return 1; }
295 __MCS48_OPHANDLER( rlc_a ) { UINT8 newc = cpustate->a & C_FLAG; cpustate->a = (cpustate->a << 1) | (cpustate->psw >> 7); cpustate->psw = (cpustate->psw & ~C_FLAG) | newc; return 1; }
297 __MCS48_OPHANDLER( rr_a ) { cpustate->a = (cpustate->a >> 1) | (cpustate->a << 7); return 1; }
298 __MCS48_OPHANDLER( rrc_a ) { UINT8 newc = (cpustate->a << 7) & C_FLAG; cpustate->a = (cpustate->a >> 1) | (cpustate->psw & C_FLAG); cpustate->psw = (cpustate->psw & ~C_FLAG) | newc; return 1; }
300 __MCS48_OPHANDLER( sel_mb0 ) { cpustate->a11 = 0x000; return 1; }
301 __MCS48_OPHANDLER( sel_mb1 ) { cpustate->a11 = 0x800; return 1; }
303 __MCS48_OPHANDLER( sel_rb0 ) { cpustate->psw &= ~B_FLAG; update_regptr(cpustate); return 1; }
304 __MCS48_OPHANDLER( sel_rb1 ) { cpustate->psw |= B_FLAG; update_regptr(cpustate); return 1; }
306 __MCS48_OPHANDLER( stop_tcnt ) { cpustate->timecount_enabled = 0; return 1; }
308 __MCS48_OPHANDLER( strt_cnt ) { cpustate->timecount_enabled = __MCS48_COUNTER_ENABLED; cpustate->t1_history = __mcs48_test_r(1); return 1; }
309 __MCS48_OPHANDLER( strt_t ) { cpustate->timecount_enabled = __MCS48_TIMER_ENABLED; cpustate->prescaler = 0; return 1; }
311 __MCS48_OPHANDLER( swap_a ) { cpustate->a = (cpustate->a << 4) | (cpustate->a >> 4); return 1; }
313 __MCS48_OPHANDLER( xch_a_r0 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(0); __mcs48_reg_w(0, tmp); return 1; }
314 __MCS48_OPHANDLER( xch_a_r1 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(1); __mcs48_reg_w(1, tmp); return 1; }
315 __MCS48_OPHANDLER( xch_a_r2 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(2); __mcs48_reg_w(2, tmp); return 1; }
316 __MCS48_OPHANDLER( xch_a_r3 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(3); __mcs48_reg_w(3, tmp); return 1; }
317 __MCS48_OPHANDLER( xch_a_r4 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(4); __mcs48_reg_w(4, tmp); return 1; }
318 __MCS48_OPHANDLER( xch_a_r5 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(5); __mcs48_reg_w(5, tmp); return 1; }
319 __MCS48_OPHANDLER( xch_a_r6 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(6); __mcs48_reg_w(6, tmp); return 1; }
320 __MCS48_OPHANDLER( xch_a_r7 ) { UINT8 tmp = cpustate->a; cpustate->a = __mcs48_reg_r(7); __mcs48_reg_w(7, tmp); return 1; }
321 __MCS48_OPHANDLER( xch_a_xr0 ) { UINT8 r0 = __mcs48_reg_r(0); UINT8 tmp = cpustate->a; cpustate->a = __mcs48_ram_r(r0); __mcs48_ram_w(r0, tmp); return 1; }
322 __MCS48_OPHANDLER( xch_a_xr1 ) { UINT8 r1 = __mcs48_reg_r(1); UINT8 tmp = cpustate->a; cpustate->a = __mcs48_ram_r(r1); __mcs48_ram_w(r1, tmp); return 1; }
324 __MCS48_OPHANDLER( xchd_a_xr0 ) { UINT8 r0 = __mcs48_reg_r(0); UINT8 oldram = __mcs48_ram_r(r0); __mcs48_ram_w(r0, (oldram & 0xf0) | (cpustate->a & 0x0f)); cpustate->a = (cpustate->a & 0xf0) | (oldram & 0x0f); return 1; }
325 __MCS48_OPHANDLER( xchd_a_xr1 ) { UINT8 r1 = __mcs48_reg_r(1); UINT8 oldram = __mcs48_ram_r(r1); __mcs48_ram_w(r1, (oldram & 0xf0) | (cpustate->a & 0x0f)); cpustate->a = (cpustate->a & 0xf0) | (oldram & 0x0f); return 1; }
327 __MCS48_OPHANDLER( xrl_a_r0 ) { cpustate->a ^= __mcs48_reg_r(0); return 1; }
328 __MCS48_OPHANDLER( xrl_a_r1 ) { cpustate->a ^= __mcs48_reg_r(1); return 1; }
329 __MCS48_OPHANDLER( xrl_a_r2 ) { cpustate->a ^= __mcs48_reg_r(2); return 1; }
330 __MCS48_OPHANDLER( xrl_a_r3 ) { cpustate->a ^= __mcs48_reg_r(3); return 1; }
331 __MCS48_OPHANDLER( xrl_a_r4 ) { cpustate->a ^= __mcs48_reg_r(4); return 1; }
332 __MCS48_OPHANDLER( xrl_a_r5 ) { cpustate->a ^= __mcs48_reg_r(5); return 1; }
333 __MCS48_OPHANDLER( xrl_a_r6 ) { cpustate->a ^= __mcs48_reg_r(6); return 1; }
334 __MCS48_OPHANDLER( xrl_a_r7 ) { cpustate->a ^= __mcs48_reg_r(7); return 1; }
335 __MCS48_OPHANDLER( xrl_a_xr0 ) { cpustate->a ^= __mcs48_ram_r(__mcs48_reg_r(0)); return 1; }
336 __MCS48_OPHANDLER( xrl_a_xr1 ) { cpustate->a ^= __mcs48_ram_r(__mcs48_reg_r(1)); return 1; }
337 __MCS48_OPHANDLER( xrl_a_n ) { cpustate->a ^= argument_fetch(cpustate); return 2; }
339 /***************************************************************************
341 ***************************************************************************/
344 /***************************************************************************
346 ***************************************************************************/
348 void MCS48_BASE::initialize()
351 DEVICE::initialize();
354 void MCS48_BASE::release()
359 void MCS48_BASE::reset()
361 mcs48_state *cpustate = (mcs48_state *)opaque;
363 /* confirmed from reset description */
365 cpustate->psw = (cpustate->psw & (C_FLAG | A_FLAG)) | 0x08;
366 cpustate->a11 = 0x000;
367 // __mcs48_bus_w(0xff);
370 // __mcs48_port_w(1, cpustate->p1);
371 // __mcs48_port_w(2, cpustate->p2);
372 cpustate->tirq_enabled = FALSE;
373 cpustate->xirq_enabled = FALSE;
374 cpustate->t0_clk_enabled = FALSE;
375 cpustate->timecount_enabled = 0;
376 cpustate->timer_flag = FALSE;
379 cpustate->icount = 0;
381 /* confirmed from interrupt logic description */
382 cpustate->int_state = TRUE;
383 cpustate->irq_state = cpustate->irq_in_progress = FALSE;
384 cpustate->timer_overflow = FALSE;
387 void MCS48_BASE::load_rom_image(const _TCHAR *file_path)
389 mcs48_state *cpustate = (mcs48_state *)opaque;
391 memset(cpustate->rom, 0, sizeof(cpustate->rom));
393 FILEIO* fio = new FILEIO();
394 if(fio->Fopen(file_path, FILEIO_READ_BINARY)) {
395 fio->Fread(cpustate->rom, sizeof(cpustate->rom), 1);
401 uint8_t *MCS48_BASE::get_rom_ptr()
403 mcs48_state *cpustate = (mcs48_state *)opaque;
404 return cpustate->rom;
407 /***************************************************************************
409 ***************************************************************************/
412 int MCS48_BASE::op_call(mcs48_state *cpustate)
414 unsigned opcode = opcode_fetch(cpustate);
416 /* process opcode and count cycles */
417 return (this->*opcode_table[opcode])(cpustate);
420 int MCS48_BASE::run(int icount)
426 uint32_t MCS48_BASE::get_pc()
428 mcs48_state *cpustate = (mcs48_state *)opaque;
429 return cpustate->prevpc;
432 uint32_t MCS48_BASE::get_next_pc()
434 mcs48_state *cpustate = (mcs48_state *)opaque;
438 /***************************************************************************
439 GENERAL CONTEXT ACCESS
440 ***************************************************************************/
442 void MCS48_BASE::write_signal(int id, uint32_t data, uint32_t mask)
444 mcs48_state *cpustate = (mcs48_state *)opaque;
446 if(id == SIG_CPU_IRQ) {
447 UINT8 prev = cpustate->int_state;
448 cpustate->int_state = ((data & mask) != 0);
450 if(prev && !cpustate->int_state) {
451 cpustate->irq_state = TRUE;
456 //#ifdef USE_DEBUGGER
457 void MCS48_BASE::write_debug_data8(uint32_t addr, uint32_t data)
459 d_mem_stored->write_data8(addr, data);
462 uint32_t MCS48_BASE::read_debug_data8(uint32_t addr)
464 return d_mem_stored->read_data8(addr);
467 void MCS48_BASE::write_debug_io8(uint32_t addr, uint32_t data)
469 d_io_stored->write_io8(addr, data);
472 uint32_t MCS48_BASE::read_debug_io8(uint32_t addr)
474 return d_io_stored->read_io8(addr);
477 bool MCS48_BASE::write_debug_reg(const _TCHAR *reg, uint32_t data)
479 mcs48_state *cpustate = (mcs48_state *)opaque;
481 if(_tcsicmp(reg, _T("R0")) == 0) {
482 __mcs48_reg_w(0, data);
483 } else if(_tcsicmp(reg, _T("R1")) == 0) {
484 __mcs48_reg_w(1, data);
485 } else if(_tcsicmp(reg, _T("R2")) == 0) {
486 __mcs48_reg_w(2, data);
487 } else if(_tcsicmp(reg, _T("R3")) == 0) {
488 __mcs48_reg_w(3, data);
489 } else if(_tcsicmp(reg, _T("R4")) == 0) {
490 __mcs48_reg_w(4, data);
491 } else if(_tcsicmp(reg, _T("R5")) == 0) {
492 __mcs48_reg_w(5, data);
493 } else if(_tcsicmp(reg, _T("R6")) == 0) {
494 __mcs48_reg_w(6, data);
495 } else if(_tcsicmp(reg, _T("R7")) == 0) {
496 __mcs48_reg_w(7, data);
503 bool MCS48_BASE::get_debug_regs_info(_TCHAR *buffer, size_t buffer_len)
506 R0 = 00 R1 = 00 R2 = 00 R3 = 00 (R0)= 00 (R1)= 00 (SP-1)= 0000 PC = 0000
507 R4 = 00 R5 = 00 R6 = 00 R7 = 00 AC = 00 SP = 00 [MB F1 C AC F0 BS]
508 Clocks = 0 (0) Since Scanline = 0/0 (0/0)
510 mcs48_state *cpustate = (mcs48_state *)opaque;
511 UINT8 sp = 8 + 2 * (cpustate->psw & 7);
512 UINT8 prev_sp = 8 + 2 * ((cpustate->psw - 1) & 7);
514 my_stprintf_s(buffer, buffer_len,
515 _T("R0 = %02X R1 = %02X R2 = %02X R3 = %02X (R0)= %02X (R1)= %02X (SP-1)= %04X PC = %04X\n")
516 _T("R4 = %02X R5 = %02X R6 = %02X R7 = %02X AC = %02X SP = %02X [%s %s %s %s %s %s]\n")
517 _T("Clocks = %llu (%llu) Since Scanline = %d/%d (%d/%d)"),
518 __mcs48_reg_r(0), __mcs48_reg_r(1), __mcs48_reg_r(2), __mcs48_reg_r(3), d_mem_stored->read_data8(__mcs48_reg_r(0)), d_mem_stored->read_data8(__mcs48_reg_r(1)),
519 d_mem_stored->read_data8(prev_sp) | (d_mem_stored->read_data8(prev_sp + 1) << 8), cpustate->pc,
520 __mcs48_reg_r(4), __mcs48_reg_r(5), __mcs48_reg_r(6), __mcs48_reg_r(7), cpustate->a, sp,
521 (cpustate->a11 == 0x800) ? _T("MB") : _T("--"), (cpustate->sts & STS_F1) ? _T("F1") : _T("--"),
522 (cpustate->psw & C_FLAG) ? _T("C" ) : _T("-" ), (cpustate->psw & A_FLAG) ? _T("AC") : _T("--"),
523 (cpustate->psw & F_FLAG) ? _T("F0") : _T("--"), (cpustate->psw & B_FLAG) ? _T("BS") : _T("--"),
524 total_icount, total_icount - prev_total_icount,
525 get_passed_clock_since_vline(), get_cur_vline_clocks(), get_cur_vline(), get_lines_per_frame());
526 prev_total_icount = total_icount;
530 // license:BSD-3-Clause
531 // copyright-holders:Aaron Giles
532 /***************************************************************************
536 Simple MCS-48/UPI-41 disassembler.
537 Written by Aaron Giles
539 ***************************************************************************/
541 int MCS48_BASE::debug_dasm_with_userdata(uint32_t pc, _TCHAR *buffer, size_t buffer_len, uint32_t userdata)
543 mcs48_state *cpustate = (mcs48_state *)opaque;
548 switch (__mcs48_program_r(ptr++))
550 case 0x00: my_stprintf_s(buffer, buffer_len, _T("nop")); break;
551 case 0x02: if (!upi41) {
552 my_stprintf_s(buffer, buffer_len, _T("out bus,a"));
554 my_stprintf_s(buffer, buffer_len, _T("out dbb,a"));
557 case 0x03: my_stprintf_s(buffer, buffer_len, _T("add a,#$%02X"), __mcs48_program_r(ptr++)); break;
558 case 0x04: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x000 | __mcs48_program_r(ptr++))); break;
559 case 0x05: my_stprintf_s(buffer, buffer_len, _T("en i")); break;
560 case 0x07: my_stprintf_s(buffer, buffer_len, _T("dec a")); break;
561 case 0x08: if (!upi41) {
562 my_stprintf_s(buffer, buffer_len, _T("in a,bus"));
564 my_stprintf_s(buffer, buffer_len, _T("illegal"));
567 case 0x09: my_stprintf_s(buffer, buffer_len, _T("in a,p1")); break;
568 case 0x0a: my_stprintf_s(buffer, buffer_len, _T("in a,p2")); break;
569 case 0x0c: my_stprintf_s(buffer, buffer_len, _T("movd a,p4")); break;
570 case 0x0d: my_stprintf_s(buffer, buffer_len, _T("movd a,p5")); break;
571 case 0x0e: my_stprintf_s(buffer, buffer_len, _T("movd a,p6")); break;
572 case 0x0f: my_stprintf_s(buffer, buffer_len, _T("movd a,p7")); break;
573 case 0x10: my_stprintf_s(buffer, buffer_len, _T("inc @r0")); break;
574 case 0x11: my_stprintf_s(buffer, buffer_len, _T("inc @r1")); break;
575 case 0x12: my_stprintf_s(buffer, buffer_len, _T("jb0 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
576 case 0x13: my_stprintf_s(buffer, buffer_len, _T("addc a,#$%02X"), __mcs48_program_r(ptr++)); break;
577 case 0x14: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x000 | __mcs48_program_r(ptr++))); break;
578 case 0x15: my_stprintf_s(buffer, buffer_len, _T("dis i")); break;
579 case 0x16: my_stprintf_s(buffer, buffer_len, _T("jtf %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
580 case 0x17: my_stprintf_s(buffer, buffer_len, _T("inc a")); break;
581 case 0x18: my_stprintf_s(buffer, buffer_len, _T("inc r0")); break;
582 case 0x19: my_stprintf_s(buffer, buffer_len, _T("inc r1")); break;
583 case 0x1a: my_stprintf_s(buffer, buffer_len, _T("inc r2")); break;
584 case 0x1b: my_stprintf_s(buffer, buffer_len, _T("inc r3")); break;
585 case 0x1c: my_stprintf_s(buffer, buffer_len, _T("inc r4")); break;
586 case 0x1d: my_stprintf_s(buffer, buffer_len, _T("inc r5")); break;
587 case 0x1e: my_stprintf_s(buffer, buffer_len, _T("inc r6")); break;
588 case 0x1f: my_stprintf_s(buffer, buffer_len, _T("inc r7")); break;
589 case 0x20: my_stprintf_s(buffer, buffer_len, _T("xch a,@r0")); break;
590 case 0x21: my_stprintf_s(buffer, buffer_len, _T("xch a,@r1")); break;
591 case 0x22: if (!upi41) {
592 my_stprintf_s(buffer, buffer_len, _T("illegal"));
594 my_stprintf_s(buffer, buffer_len, _T("in a,dbb"));
597 case 0x23: my_stprintf_s(buffer, buffer_len, _T("mov a,#$%02X"), __mcs48_program_r(ptr++)); break;
598 case 0x24: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x100 | __mcs48_program_r(ptr++))); break;
599 case 0x25: my_stprintf_s(buffer, buffer_len, _T("en tcnti")); break;
600 case 0x26: my_stprintf_s(buffer, buffer_len, _T("jnt0 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
601 case 0x27: my_stprintf_s(buffer, buffer_len, _T("clr a")); break;
602 case 0x28: my_stprintf_s(buffer, buffer_len, _T("xch a,r0")); break;
603 case 0x29: my_stprintf_s(buffer, buffer_len, _T("xch a,r1")); break;
604 case 0x2a: my_stprintf_s(buffer, buffer_len, _T("xch a,r2")); break;
605 case 0x2b: my_stprintf_s(buffer, buffer_len, _T("xch a,r3")); break;
606 case 0x2c: my_stprintf_s(buffer, buffer_len, _T("xch a,r4")); break;
607 case 0x2d: my_stprintf_s(buffer, buffer_len, _T("xch a,r5")); break;
608 case 0x2e: my_stprintf_s(buffer, buffer_len, _T("xch a,r6")); break;
609 case 0x2f: my_stprintf_s(buffer, buffer_len, _T("xch a,r7")); break;
610 case 0x30: my_stprintf_s(buffer, buffer_len, _T("xchd a,@r0")); break;
611 case 0x31: my_stprintf_s(buffer, buffer_len, _T("xchd a,@r1")); break;
612 case 0x32: my_stprintf_s(buffer, buffer_len, _T("jb1 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
613 case 0x34: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x100 | __mcs48_program_r(ptr++))); break;
614 case 0x35: my_stprintf_s(buffer, buffer_len, _T("dis tcnti")); break;
615 case 0x36: my_stprintf_s(buffer, buffer_len, _T("jt0 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
616 case 0x37: my_stprintf_s(buffer, buffer_len, _T("cpl a")); break;
617 case 0x39: my_stprintf_s(buffer, buffer_len, _T("outl p1,a")); break;
618 case 0x3a: my_stprintf_s(buffer, buffer_len, _T("outl p2,a")); break;
619 case 0x3c: my_stprintf_s(buffer, buffer_len, _T("movd p4,a")); break;
620 case 0x3d: my_stprintf_s(buffer, buffer_len, _T("movd p5,a")); break;
621 case 0x3e: my_stprintf_s(buffer, buffer_len, _T("movd p6,a")); break;
622 case 0x3f: my_stprintf_s(buffer, buffer_len, _T("movd p7,a")); break;
623 case 0x40: my_stprintf_s(buffer, buffer_len, _T("orl a,@r0")); break;
624 case 0x41: my_stprintf_s(buffer, buffer_len, _T("orl a,@r1")); break;
625 case 0x42: my_stprintf_s(buffer, buffer_len, _T("mov a,t")); break;
626 case 0x43: my_stprintf_s(buffer, buffer_len, _T("orl a,#$%02X"), __mcs48_program_r(ptr++)); break;
627 case 0x44: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x200 | __mcs48_program_r(ptr++))); break;
628 case 0x45: my_stprintf_s(buffer, buffer_len, _T("strt cnt")); break;
629 case 0x46: my_stprintf_s(buffer, buffer_len, _T("jnt1 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
630 case 0x47: my_stprintf_s(buffer, buffer_len, _T("swap a")); break;
631 case 0x48: my_stprintf_s(buffer, buffer_len, _T("orl a,r0")); break;
632 case 0x49: my_stprintf_s(buffer, buffer_len, _T("orl a,r1")); break;
633 case 0x4a: my_stprintf_s(buffer, buffer_len, _T("orl a,r2")); break;
634 case 0x4b: my_stprintf_s(buffer, buffer_len, _T("orl a,r3")); break;
635 case 0x4c: my_stprintf_s(buffer, buffer_len, _T("orl a,r4")); break;
636 case 0x4d: my_stprintf_s(buffer, buffer_len, _T("orl a,r5")); break;
637 case 0x4e: my_stprintf_s(buffer, buffer_len, _T("orl a,r6")); break;
638 case 0x4f: my_stprintf_s(buffer, buffer_len, _T("orl a,r7")); break;
639 case 0x50: my_stprintf_s(buffer, buffer_len, _T("anl a,@r0")); break;
640 case 0x51: my_stprintf_s(buffer, buffer_len, _T("anl a,@r1")); break;
641 case 0x52: my_stprintf_s(buffer, buffer_len, _T("jb2 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
642 case 0x53: my_stprintf_s(buffer, buffer_len, _T("anl a,#$%02X"), __mcs48_program_r(ptr++)); break;
643 case 0x54: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x200 | __mcs48_program_r(ptr++))); break;
644 case 0x55: my_stprintf_s(buffer, buffer_len, _T("strt t")); break;
645 case 0x56: my_stprintf_s(buffer, buffer_len, _T("jt1 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
646 case 0x57: my_stprintf_s(buffer, buffer_len, _T("da a")); break;
647 case 0x58: my_stprintf_s(buffer, buffer_len, _T("anl a,r0")); break;
648 case 0x59: my_stprintf_s(buffer, buffer_len, _T("anl a,r1")); break;
649 case 0x5a: my_stprintf_s(buffer, buffer_len, _T("anl a,r2")); break;
650 case 0x5b: my_stprintf_s(buffer, buffer_len, _T("anl a,r3")); break;
651 case 0x5c: my_stprintf_s(buffer, buffer_len, _T("anl a,r4")); break;
652 case 0x5d: my_stprintf_s(buffer, buffer_len, _T("anl a,r5")); break;
653 case 0x5e: my_stprintf_s(buffer, buffer_len, _T("anl a,r6")); break;
654 case 0x5f: my_stprintf_s(buffer, buffer_len, _T("anl a,r7")); break;
655 case 0x60: my_stprintf_s(buffer, buffer_len, _T("add a,@r0")); break;
656 case 0x61: my_stprintf_s(buffer, buffer_len, _T("add a,@r1")); break;
657 case 0x62: my_stprintf_s(buffer, buffer_len, _T("mov t,a")); break;
658 case 0x64: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x300 | __mcs48_program_r(ptr++))); break;
659 case 0x65: my_stprintf_s(buffer, buffer_len, _T("stop tcnt")); break;
660 case 0x67: my_stprintf_s(buffer, buffer_len, _T("rrc a")); break;
661 case 0x68: my_stprintf_s(buffer, buffer_len, _T("add a,r0")); break;
662 case 0x69: my_stprintf_s(buffer, buffer_len, _T("add a,r1")); break;
663 case 0x6a: my_stprintf_s(buffer, buffer_len, _T("add a,r2")); break;
664 case 0x6b: my_stprintf_s(buffer, buffer_len, _T("add a,r3")); break;
665 case 0x6c: my_stprintf_s(buffer, buffer_len, _T("add a,r4")); break;
666 case 0x6d: my_stprintf_s(buffer, buffer_len, _T("add a,r5")); break;
667 case 0x6e: my_stprintf_s(buffer, buffer_len, _T("add a,r6")); break;
668 case 0x6f: my_stprintf_s(buffer, buffer_len, _T("add a,r7")); break;
669 case 0x70: my_stprintf_s(buffer, buffer_len, _T("addc a,@r0")); break;
670 case 0x71: my_stprintf_s(buffer, buffer_len, _T("addc a,@r1")); break;
671 case 0x72: my_stprintf_s(buffer, buffer_len, _T("jb3 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
672 case 0x74: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x300 | __mcs48_program_r(ptr++))); break;
673 case 0x75: if (!upi41) {
674 my_stprintf_s(buffer, buffer_len, _T("ent0 clk"));
676 my_stprintf_s(buffer, buffer_len, _T("illegal"));
679 case 0x76: my_stprintf_s(buffer, buffer_len, _T("jf1 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
680 case 0x77: my_stprintf_s(buffer, buffer_len, _T("rr a")); break;
681 case 0x78: my_stprintf_s(buffer, buffer_len, _T("addc a,r0")); break;
682 case 0x79: my_stprintf_s(buffer, buffer_len, _T("addc a,r1")); break;
683 case 0x7a: my_stprintf_s(buffer, buffer_len, _T("addc a,r2")); break;
684 case 0x7b: my_stprintf_s(buffer, buffer_len, _T("addc a,r3")); break;
685 case 0x7c: my_stprintf_s(buffer, buffer_len, _T("addc a,r4")); break;
686 case 0x7d: my_stprintf_s(buffer, buffer_len, _T("addc a,r5")); break;
687 case 0x7e: my_stprintf_s(buffer, buffer_len, _T("addc a,r6")); break;
688 case 0x7f: my_stprintf_s(buffer, buffer_len, _T("addc a,r7")); break;
689 case 0x80: if (!upi41) {
690 my_stprintf_s(buffer, buffer_len, _T("movx a,@r0"));
692 my_stprintf_s(buffer, buffer_len, _T("illegal"));
695 case 0x81: if (!upi41) {
696 my_stprintf_s(buffer, buffer_len, _T("movx a,@r1"));
698 my_stprintf_s(buffer, buffer_len, _T("illegal"));
701 case 0x83: my_stprintf_s(buffer, buffer_len, _T("ret")); break;
702 case 0x84: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x400 | __mcs48_program_r(ptr++))); break;
703 case 0x85: my_stprintf_s(buffer, buffer_len, _T("clr f0"));
705 case 0x86: if (!upi41) {
706 my_stprintf_s(buffer, buffer_len, _T("jni %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++)));
708 my_stprintf_s(buffer, buffer_len, _T("jobf %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++)));
711 case 0x88: if (!upi41) {
712 my_stprintf_s(buffer, buffer_len, _T("orl bus,#$%02X"), __mcs48_program_r(ptr++));
714 my_stprintf_s(buffer, buffer_len, _T("illegal"));
717 case 0x89: my_stprintf_s(buffer, buffer_len, _T("orl p1,#$%02X"), __mcs48_program_r(ptr++)); break;
718 case 0x8a: my_stprintf_s(buffer, buffer_len, _T("orl p2,#$%02X"), __mcs48_program_r(ptr++)); break;
719 case 0x8c: my_stprintf_s(buffer, buffer_len, _T("orld p4,a")); break;
720 case 0x8d: my_stprintf_s(buffer, buffer_len, _T("orld p5,a")); break;
721 case 0x8e: my_stprintf_s(buffer, buffer_len, _T("orld p6,a")); break;
722 case 0x8f: my_stprintf_s(buffer, buffer_len, _T("orld p7,a")); break;
723 case 0x90: if (!upi41) {
724 my_stprintf_s(buffer, buffer_len, _T("movx @r0,a"));
726 my_stprintf_s(buffer, buffer_len, _T("mov sts,a"));
729 case 0x91: if (!upi41) {
730 my_stprintf_s(buffer, buffer_len, _T("movx @r1,a"));
732 my_stprintf_s(buffer, buffer_len, _T("illegal"));
735 case 0x92: my_stprintf_s(buffer, buffer_len, _T("jb4 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
736 case 0x93: my_stprintf_s(buffer, buffer_len, _T("retr")); break;
737 case 0x94: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x400 | __mcs48_program_r(ptr++))); break;
738 case 0x95: my_stprintf_s(buffer, buffer_len, _T("cpl f0")); break;
739 case 0x96: my_stprintf_s(buffer, buffer_len, _T("jnz %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
740 case 0x97: my_stprintf_s(buffer, buffer_len, _T("clr c")); break;
741 case 0x98: if (!upi41) {
742 my_stprintf_s(buffer, buffer_len, _T("anl bus,#$%02X"), __mcs48_program_r(ptr++));
744 my_stprintf_s(buffer, buffer_len, _T("illegal"));
747 case 0x99: my_stprintf_s(buffer, buffer_len, _T("anl p1,#$%02X"), __mcs48_program_r(ptr++)); break;
748 case 0x9a: my_stprintf_s(buffer, buffer_len, _T("anl p2,#$%02X"), __mcs48_program_r(ptr++)); break;
749 case 0x9c: my_stprintf_s(buffer, buffer_len, _T("anld p4,a")); break;
750 case 0x9d: my_stprintf_s(buffer, buffer_len, _T("anld p5,a")); break;
751 case 0x9e: my_stprintf_s(buffer, buffer_len, _T("anld p6,a")); break;
752 case 0x9f: my_stprintf_s(buffer, buffer_len, _T("anld p7,a")); break;
753 case 0xa0: my_stprintf_s(buffer, buffer_len, _T("mov @r0,a")); break;
754 case 0xa1: my_stprintf_s(buffer, buffer_len, _T("mov @r1,a")); break;
755 case 0xa3: my_stprintf_s(buffer, buffer_len, _T("movp a,@a")); break;
756 case 0xa4: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x500 | __mcs48_program_r(ptr++))); break;
757 case 0xa5: my_stprintf_s(buffer, buffer_len, _T("clr f1")); break;
758 case 0xa7: my_stprintf_s(buffer, buffer_len, _T("cpl c")); break;
759 case 0xa8: my_stprintf_s(buffer, buffer_len, _T("mov r0,a")); break;
760 case 0xa9: my_stprintf_s(buffer, buffer_len, _T("mov r1,a")); break;
761 case 0xaa: my_stprintf_s(buffer, buffer_len, _T("mov r2,a")); break;
762 case 0xab: my_stprintf_s(buffer, buffer_len, _T("mov r3,a")); break;
763 case 0xac: my_stprintf_s(buffer, buffer_len, _T("mov r4,a")); break;
764 case 0xad: my_stprintf_s(buffer, buffer_len, _T("mov r5,a")); break;
765 case 0xae: my_stprintf_s(buffer, buffer_len, _T("mov r6,a")); break;
766 case 0xaf: my_stprintf_s(buffer, buffer_len, _T("mov r7,a")); break;
767 case 0xb0: my_stprintf_s(buffer, buffer_len, _T("mov @r0,#$%02X"), __mcs48_program_r(ptr++)); break;
768 case 0xb1: my_stprintf_s(buffer, buffer_len, _T("mov @r1,#$%02X"), __mcs48_program_r(ptr++)); break;
769 case 0xb2: my_stprintf_s(buffer, buffer_len, _T("jb5 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
770 case 0xb3: my_stprintf_s(buffer, buffer_len, _T("jmpp @a")); break;
771 case 0xb4: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x500 | __mcs48_program_r(ptr++))); break;
772 case 0xb5: my_stprintf_s(buffer, buffer_len, _T("cpl f1")); break;
773 case 0xb6: my_stprintf_s(buffer, buffer_len, _T("jf0 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
774 case 0xb8: my_stprintf_s(buffer, buffer_len, _T("mov r0,#$%02X"), __mcs48_program_r(ptr++)); break;
775 case 0xb9: my_stprintf_s(buffer, buffer_len, _T("mov r1,#$%02X"), __mcs48_program_r(ptr++)); break;
776 case 0xba: my_stprintf_s(buffer, buffer_len, _T("mov r2,#$%02X"), __mcs48_program_r(ptr++)); break;
777 case 0xbb: my_stprintf_s(buffer, buffer_len, _T("mov r3,#$%02X"), __mcs48_program_r(ptr++)); break;
778 case 0xbc: my_stprintf_s(buffer, buffer_len, _T("mov r4,#$%02X"), __mcs48_program_r(ptr++)); break;
779 case 0xbd: my_stprintf_s(buffer, buffer_len, _T("mov r5,#$%02X"), __mcs48_program_r(ptr++)); break;
780 case 0xbe: my_stprintf_s(buffer, buffer_len, _T("mov r6,#$%02X"), __mcs48_program_r(ptr++)); break;
781 case 0xbf: my_stprintf_s(buffer, buffer_len, _T("mov r7,#$%02X"), __mcs48_program_r(ptr++)); break;
782 case 0xc4: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x600 | __mcs48_program_r(ptr++))); break;
783 case 0xc5: my_stprintf_s(buffer, buffer_len, _T("sel rb0")); break;
784 case 0xc6: my_stprintf_s(buffer, buffer_len, _T("jz %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
785 case 0xc7: my_stprintf_s(buffer, buffer_len, _T("mov a,psw")); break;
786 case 0xc8: my_stprintf_s(buffer, buffer_len, _T("dec r0")); break;
787 case 0xc9: my_stprintf_s(buffer, buffer_len, _T("dec r1")); break;
788 case 0xca: my_stprintf_s(buffer, buffer_len, _T("dec r2")); break;
789 case 0xcb: my_stprintf_s(buffer, buffer_len, _T("dec r3")); break;
790 case 0xcc: my_stprintf_s(buffer, buffer_len, _T("dec r4")); break;
791 case 0xcd: my_stprintf_s(buffer, buffer_len, _T("dec r5")); break;
792 case 0xce: my_stprintf_s(buffer, buffer_len, _T("dec r6")); break;
793 case 0xcf: my_stprintf_s(buffer, buffer_len, _T("dec r7")); break;
794 case 0xd0: my_stprintf_s(buffer, buffer_len, _T("xrl a,@r0")); break;
795 case 0xd1: my_stprintf_s(buffer, buffer_len, _T("xrl a,@r1")); break;
796 case 0xd2: my_stprintf_s(buffer, buffer_len, _T("jb6 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
797 case 0xd3: my_stprintf_s(buffer, buffer_len, _T("xrl a,#$%02X"), __mcs48_program_r(ptr++)); break;
798 case 0xd4: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x600 | __mcs48_program_r(ptr++))); break;
799 case 0xd5: my_stprintf_s(buffer, buffer_len, _T("sel rb1")); break;
800 case 0xd6: if (!upi41) {
801 my_stprintf_s(buffer, buffer_len, _T("illegal"));
803 my_stprintf_s(buffer, buffer_len, _T("jnibf %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++)));
806 case 0xd7: my_stprintf_s(buffer, buffer_len, _T("mov psw,a")); break;
807 case 0xd8: my_stprintf_s(buffer, buffer_len, _T("xrl a,r0")); break;
808 case 0xd9: my_stprintf_s(buffer, buffer_len, _T("xrl a,r1")); break;
809 case 0xda: my_stprintf_s(buffer, buffer_len, _T("xrl a,r2")); break;
810 case 0xdb: my_stprintf_s(buffer, buffer_len, _T("xrl a,r3")); break;
811 case 0xdc: my_stprintf_s(buffer, buffer_len, _T("xrl a,r4")); break;
812 case 0xdd: my_stprintf_s(buffer, buffer_len, _T("xrl a,r5")); break;
813 case 0xde: my_stprintf_s(buffer, buffer_len, _T("xrl a,r6")); break;
814 case 0xdf: my_stprintf_s(buffer, buffer_len, _T("xrl a,r7")); break;
815 case 0xe3: my_stprintf_s(buffer, buffer_len, _T("movp3 a,@a")); break;
816 case 0xe4: my_stprintf_s(buffer, buffer_len, _T("jmp %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x700 | __mcs48_program_r(ptr++))); break;
817 case 0xe5: if (!upi41) {
818 my_stprintf_s(buffer, buffer_len, _T("sel mb0"));
820 my_stprintf_s(buffer, buffer_len, _T("en dma"));
823 case 0xe6: my_stprintf_s(buffer, buffer_len, _T("jnc %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
824 case 0xe7: my_stprintf_s(buffer, buffer_len, _T("rl a")); break;
825 case 0xe8: my_stprintf_s(buffer, buffer_len, _T("djnz r0,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
826 case 0xe9: my_stprintf_s(buffer, buffer_len, _T("djnz r1,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
827 case 0xea: my_stprintf_s(buffer, buffer_len, _T("djnz r2,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
828 case 0xeb: my_stprintf_s(buffer, buffer_len, _T("djnz r3,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
829 case 0xec: my_stprintf_s(buffer, buffer_len, _T("djnz r4,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
830 case 0xed: my_stprintf_s(buffer, buffer_len, _T("djnz r5,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
831 case 0xee: my_stprintf_s(buffer, buffer_len, _T("djnz r6,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
832 case 0xef: my_stprintf_s(buffer, buffer_len, _T("djnz r7,%s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
833 case 0xf0: my_stprintf_s(buffer, buffer_len, _T("mov a,@r0")); break;
834 case 0xf1: my_stprintf_s(buffer, buffer_len, _T("mov a,@r1")); break;
835 case 0xf2: my_stprintf_s(buffer, buffer_len, _T("jb7 %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
836 case 0xf4: my_stprintf_s(buffer, buffer_len, _T("call %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), 0x700 | __mcs48_program_r(ptr++))); break;
837 case 0xf5: if (!upi41) {
838 my_stprintf_s(buffer, buffer_len, _T("sel mb1"));
840 my_stprintf_s(buffer, buffer_len, _T("en flags"));
843 case 0xf6: my_stprintf_s(buffer, buffer_len, _T("jc %s"), get_value_or_symbol(d_debugger->first_symbol, _T("$%03X"), (pc & 0xf00) | __mcs48_program_r(ptr++))); break;
844 case 0xf7: my_stprintf_s(buffer, buffer_len, _T("rlc a")); break;
845 case 0xf8: my_stprintf_s(buffer, buffer_len, _T("mov a,r0")); break;
846 case 0xf9: my_stprintf_s(buffer, buffer_len, _T("mov a,r1")); break;
847 case 0xfa: my_stprintf_s(buffer, buffer_len, _T("mov a,r2")); break;
848 case 0xfb: my_stprintf_s(buffer, buffer_len, _T("mov a,r3")); break;
849 case 0xfc: my_stprintf_s(buffer, buffer_len, _T("mov a,r4")); break;
850 case 0xfd: my_stprintf_s(buffer, buffer_len, _T("mov a,r5")); break;
851 case 0xfe: my_stprintf_s(buffer, buffer_len, _T("mov a,r6")); break;
852 case 0xff: my_stprintf_s(buffer, buffer_len, _T("mov a,r7")); break;
853 default: my_stprintf_s(buffer, buffer_len, _T("illegal")); break;
860 #define STATE_VERSION 3
862 bool MCS48MEM::process_state(FILEIO* state_fio, bool loading)
864 if(!state_fio->StateCheckUint32(STATE_VERSION)) {
867 if(!state_fio->StateCheckInt32(this_device_id)) {
870 state_fio->StateArray(ram, sizeof(ram), 1);