50 write(address, operand);
51 PSW.
Z = (operand == 0);
52 PSW.
N = (operand & 0x80);
57 uint16_t result =
A + value +
PSW.
C;
58 PSW.
V = ((
A ^ result) & (
adr ^ result) & 0x80);
59 PSW.
C = (result > 0xFF);
62 PSW.
Z = ((
A & 0xFF) == 0);
67 uint8_t applyOn =
read(dest);
68 int result = applyOn + operand +
PSW.
C;
69 PSW.
V = (applyOn & 0x80) == (operand & 0x80) &&
70 (operand & 0x80) != (result & 0x80);
71 PSW.
H = ((applyOn & 0xf) + (operand & 0xf) +
PSW.
C) > 0xf;
72 PSW.
C = result > 0xff;
74 PSW.
Z = ((result & 0xFF) == 0);
75 PSW.
N = (result & 0x80);
79 uint8_t value =
read(
adr) ^ 0xff;
80 int result =
A + value +
PSW.
C;
81 PSW.
V = (
A & 0x80) == (value & 0x80) && (value & 0x80) != (result & 0x80);
82 PSW.
H = ((
A & 0xf) + (value & 0xf) +
PSW.
C) > 0xf;
83 PSW.
C = result > 0xff;
85 PSW.
Z = ((
A & 0xFF) == 0);
91 uint8_t applyOn =
read(dest);
92 int result = applyOn + operand +
PSW.
C;
93 PSW.
V = (applyOn & 0x80) == (operand & 0x80) &&
94 (operand & 0x80) != (operand & 0x80);
95 PSW.
H = ((applyOn & 0xF) + (operand & 0xF) +
PSW.
C) > 0xF;
96 PSW.
C = result > 0xFF;
98 PSW.
Z = ((
A & 0xFF) == 0);
103 uint8_t value =
read(
adr) ^ 0xff;
104 int result =
X + value + 1;
105 PSW.
C = result > 0xff;
106 PSW.
Z = (result == 0);
107 PSW.
N = (result & 0x80);
111 uint8_t value =
read(
adr) ^ 0xff;
112 int result =
Y + value + 1;
113 PSW.
C = result > 0xff;
114 PSW.
Z = (result == 0);
115 PSW.
N = (result & 0x80);
120 int result =
read(dst) + value + 1;
121 PSW.
C = result > 0xff;
123 PSW.
Z = (result == 0);
124 PSW.
N = (result & 0x80);
128 uint8_t value =
read(
adr) ^ 0xff;
129 int result =
A + value + 1;
130 PSW.
C = result > 0xff;
131 PSW.
Z = ((result & 0xFF) == 0);
132 PSW.
N = (result & 0x80);
142 uint8_t result =
read(dest) & operand;
144 PSW.
Z = (result == 0);
145 PSW.
N = (result & 0x80);
155 uint8_t result =
read(dst) | value;
157 PSW.
Z = (result == 0);
158 PSW.
N = (result & 0x80);
168 uint8_t result =
read(dest) ^ operand;
170 PSW.
Z = (result == 0);
171 PSW.
N = (result & 0x80);
175 uint8_t val =
read(operand);
177 PSW.
C = (val & 0x80);
180 PSW.
N = (val & 0x80);
185 PSW.
C = (val & 0x01);
189 PSW.
N = (val & 0x80);
195 val = (val >> 1) | (
PSW.
C << 7);
199 PSW.
N = (val & 0x80);
204 bool newC = val & 0x80;
205 val = (val << 1) |
PSW.
C;
210 PSW.
N = (val & 0x80);
214 uint8_t value = isImmediate ?
imm() : operand;
215 value = ((value & 0xF0) >> 4) | ((value & 0x0F) << 4);
216 PSW.
Z = (value == 0);
217 PSW.
N = (value & 0x80);
225 PSW.
N = (val & 0x80);
229 uint8_t val =
read(operand) - 1;
231 PSW.
Z = (operand == 0);
232 PSW.
N = (operand & 0x80);
237 PSW.
Z = (operand == 0);
238 PSW.
N = (operand & 0x8000);
243 PSW.
Z = (operand == 0);
244 PSW.
N = (operand & 0x8000);
249 PSW.
Z = (operand == 0);
250 PSW.
N = (operand & 0x8000);
254 uint32_t result = dest + operand;
255 PSW.
C = (result > 0xFFFF);
256 PSW.
Z = ((result & 0xFFFF) == 0);
257 PSW.
N = (result & 0x8000);
258 PSW.
V = ((dest ^ result) & (operand ^ result) & 0x8000);
259 dest = result & 0xFFFF;
263 uint32_t result = dest - operand;
264 PSW.
C = (result < 0x10000);
265 PSW.
Z = ((result & 0xFFFF) == 0);
266 PSW.
N = (result & 0x8000);
267 PSW.
V = ((dest ^ result) & (dest ^ operand) & 0x8000);
268 dest = result & 0xFFFF;
272 uint32_t result =
YA - operand;
273 PSW.
C = (result < 0x10000);
274 PSW.
Z = ((result & 0xFFFF) == 0);
275 PSW.
N = (result & 0x8000);
279 uint16_t result =
A * operand;
281 PSW.
Z = (result == 0);
282 PSW.
N = (result & 0x8000);
290 uint8_t quotient =
A / operand;
291 uint8_t remainder =
A % operand;
294 PSW.
Z = (quotient == 0);
295 PSW.
N = (quotient & 0x80);
349 if (operand & (1 << bit)) {
355 if (!(operand & (1 << bit))) {
365 uint16_t return_address =
PC + 2;
366 write(
SP, return_address & 0xFF);
367 write(
SP - 1, (return_address >> 8) & 0xFF);
373 uint16_t return_address =
PC + 2;
374 write(
SP, return_address & 0xFF);
375 write(
SP - 1, (return_address >> 8) & 0xFF);
381 uint16_t return_address =
PC + 2;
382 write(
SP, return_address & 0xFF);
383 write(
SP - 1, (return_address >> 8) & 0xFF);
385 PC = 0xFFDE + offset;
389 uint16_t return_address =
PC + 2;
390 write(
SP, return_address & 0xFF);
391 write(
SP - 1, (return_address >> 8) & 0xFF);
397 uint16_t return_address =
read(
SP) | (
read(
SP + 1) << 8);
403 uint16_t return_address =
read(
SP) | (
read(
SP + 1) << 8);
419void Spc700::SET1(uint8_t bit, uint8_t& operand) { operand |= (1 << bit); }
421void Spc700::CLR1(uint8_t bit, uint8_t& operand) { operand &= ~(1 << bit); }
424 PSW.
C = (operand & (1 << bit));
425 operand |= (1 << bit);
429 PSW.
C = (operand & (1 << bit));
430 operand &= ~(1 << bit);
434 operand &= (1 << bit);
435 PSW.
Z = (operand == 0);
436 PSW.
N = (operand & 0x80);
440 operand |= (1 << bit);
441 PSW.
Z = (operand == 0);
442 PSW.
N = (operand & 0x80);
446 operand ^= (1 << bit);
447 PSW.
Z = (operand == 0);
448 PSW.
N = (operand & 0x80);
452 operand ^= (1 << bit);
453 PSW.
Z = (operand == 0);
454 PSW.
N = (operand & 0x80);
458 PSW.
C = (operand & (1 << bit));
459 operand |= (1 << bit);
void PUSH(uint8_t operand)
void ANDM(uint16_t dest, uint8_t operand)
void EORM(uint16_t dest, uint8_t operand)
void JMP(uint16_t address)
void SET1(uint8_t bit, uint8_t &operand)
void TCLR1(uint8_t bit, uint8_t &operand)
void CALL(uint16_t address)
void POP(uint8_t &operand)
void MOV1(uint8_t bit, uint8_t &operand)
void XCN(uint8_t operand, bool isImmediate=false)
void ROL(uint16_t operand)
void INCW(uint16_t &operand)
void DEC(uint16_t operand)
void MOVW(uint16_t &dest, uint16_t operand)
void DIV(uint8_t operand)
void CMPM(uint16_t dst, uint8_t value)
void AND1(uint8_t bit, uint8_t &operand)
void TCALL(uint8_t offset)
void PCALL(uint8_t offset)
void SBCM(uint16_t &dest, uint8_t operand)
void MOV_ADDR(uint16_t address, uint8_t operand)
void DECW(uint16_t &operand)
void ADCM(uint16_t &dest, uint8_t operand)
void EOR1(uint8_t bit, uint8_t &operand)
void SUBW(uint16_t &dest, uint16_t operand)
void CLR1(uint8_t bit, uint8_t &operand)
void BBS(uint8_t bit, uint8_t operand)
void CMPW(uint16_t operand)
void ASL(uint16_t operand)
void NOT1(uint8_t bit, uint8_t &operand)
void MUL(uint8_t operand)
void OR1(uint8_t bit, uint8_t &operand)
void BBC(uint8_t bit, uint8_t operand)
void TSET1(uint8_t bit, uint8_t &operand)
void write(uint16_t address, uint8_t value)
void ORM(uint16_t dest, uint8_t operand)
uint8_t read(uint16_t address)
void ADDW(uint16_t &dest, uint16_t operand)
std::function< void(bool)> idle