48 write(address, operand);
49 PSW.Z = (operand == 0);
50 PSW.N = (operand & 0x80);
55 uint16_t result =
A + value +
PSW.C;
56 PSW.V = ((
A ^ result) & (
adr ^ result) & 0x80);
57 PSW.C = (result > 0xFF);
58 PSW.H = ((
A ^
adr ^ result) & 0x10);
60 PSW.Z = ((
A & 0xFF) == 0);
65 uint8_t applyOn =
read(dest);
66 int result = applyOn + operand +
PSW.C;
67 PSW.V = (applyOn & 0x80) == (operand & 0x80) &&
68 (operand & 0x80) != (result & 0x80);
69 PSW.H = ((applyOn & 0xf) + (operand & 0xf) +
PSW.C) > 0xf;
70 PSW.C = result > 0xff;
72 PSW.Z = ((result & 0xFF) == 0);
73 PSW.N = (result & 0x80);
77 uint8_t value =
read(
adr) ^ 0xff;
78 int result =
A + value +
PSW.C;
79 PSW.V = (
A & 0x80) == (value & 0x80) && (value & 0x80) != (result & 0x80);
80 PSW.H = ((
A & 0xf) + (value & 0xf) +
PSW.C) > 0xf;
81 PSW.C = result > 0xff;
83 PSW.Z = ((
A & 0xFF) == 0);
89 uint8_t applyOn =
read(dest);
90 int result = applyOn + operand +
PSW.C;
91 PSW.V = (applyOn & 0x80) == (operand & 0x80) &&
92 (operand & 0x80) != (operand & 0x80);
93 PSW.H = ((applyOn & 0xF) + (operand & 0xF) +
PSW.C) > 0xF;
94 PSW.C = result > 0xFF;
96 PSW.Z = ((
A & 0xFF) == 0);
101 uint8_t value =
read(
adr) ^ 0xff;
102 int result =
X + value + 1;
103 PSW.C = result > 0xff;
104 PSW.Z = (result == 0);
105 PSW.N = (result & 0x80);
109 uint8_t value =
read(
adr) ^ 0xff;
110 int result =
Y + value + 1;
111 PSW.C = result > 0xff;
112 PSW.Z = (result == 0);
113 PSW.N = (result & 0x80);
118 int result =
read(dst) + value + 1;
119 PSW.C = result > 0xff;
121 PSW.Z = (result == 0);
122 PSW.N = (result & 0x80);
126 uint8_t value =
read(
adr) ^ 0xff;
127 int result =
A + value + 1;
128 PSW.C = result > 0xff;
129 PSW.Z = ((result & 0xFF) == 0);
130 PSW.N = (result & 0x80);
140 uint8_t result =
read(dest) & operand;
142 PSW.Z = (result == 0);
143 PSW.N = (result & 0x80);
153 uint8_t result =
read(dst) | value;
155 PSW.Z = (result == 0);
156 PSW.N = (result & 0x80);
166 uint8_t result =
read(dest) ^ operand;
168 PSW.Z = (result == 0);
169 PSW.N = (result & 0x80);
173 uint8_t val =
read(operand);
175 PSW.C = (val & 0x80);
178 PSW.N = (val & 0x80);
183 PSW.C = (val & 0x01);
187 PSW.N = (val & 0x80);
193 val = (val >> 1) | (
PSW.C << 7);
197 PSW.N = (val & 0x80);
202 bool newC = val & 0x80;
203 val = (val << 1) |
PSW.C;
208 PSW.N = (val & 0x80);
212 uint8_t value = isImmediate ?
imm() : operand;
213 value = ((value & 0xF0) >> 4) | ((value & 0x0F) << 4);
214 PSW.Z = (value == 0);
215 PSW.N = (value & 0x80);
223 PSW.N = (val & 0x80);
227 uint8_t val =
read(operand) - 1;
229 PSW.Z = (operand == 0);
230 PSW.N = (operand & 0x80);
235 PSW.Z = (operand == 0);
236 PSW.N = (operand & 0x8000);
241 PSW.Z = (operand == 0);
242 PSW.N = (operand & 0x8000);
247 PSW.Z = (operand == 0);
248 PSW.N = (operand & 0x8000);
252 uint32_t result = dest + operand;
253 PSW.C = (result > 0xFFFF);
254 PSW.Z = ((result & 0xFFFF) == 0);
255 PSW.N = (result & 0x8000);
256 PSW.V = ((dest ^ result) & (operand ^ result) & 0x8000);
257 dest = result & 0xFFFF;
261 uint32_t result = dest - operand;
262 PSW.C = (result < 0x10000);
263 PSW.Z = ((result & 0xFFFF) == 0);
264 PSW.N = (result & 0x8000);
265 PSW.V = ((dest ^ result) & (dest ^ operand) & 0x8000);
266 dest = result & 0xFFFF;
270 uint32_t result =
YA - operand;
271 PSW.C = (result < 0x10000);
272 PSW.Z = ((result & 0xFFFF) == 0);
273 PSW.N = (result & 0x8000);
277 uint16_t result =
A * operand;
279 PSW.Z = (result == 0);
280 PSW.N = (result & 0x8000);
288 uint8_t quotient =
A / operand;
289 uint8_t remainder =
A % operand;
292 PSW.Z = (quotient == 0);
293 PSW.N = (quotient & 0x80);
347 if (operand & (1 << bit)) {
353 if (!(operand & (1 << bit))) {
363 uint16_t return_address =
PC + 2;
364 write(
SP, return_address & 0xFF);
365 write(
SP - 1, (return_address >> 8) & 0xFF);
371 uint16_t return_address =
PC + 2;
372 write(
SP, return_address & 0xFF);
373 write(
SP - 1, (return_address >> 8) & 0xFF);
379 uint16_t return_address =
PC + 2;
380 write(
SP, return_address & 0xFF);
381 write(
SP - 1, (return_address >> 8) & 0xFF);
383 PC = 0xFFDE + offset;
387 uint16_t return_address =
PC + 2;
388 write(
SP, return_address & 0xFF);
389 write(
SP - 1, (return_address >> 8) & 0xFF);
395 uint16_t return_address =
read(
SP) | (
read(
SP + 1) << 8);
401 uint16_t return_address =
read(
SP) | (
read(
SP + 1) << 8);
417void Spc700::SET1(uint8_t bit, uint8_t& operand) { operand |= (1 << bit); }
419void Spc700::CLR1(uint8_t bit, uint8_t& operand) { operand &= ~(1 << bit); }
422 PSW.C = (operand & (1 << bit));
423 operand |= (1 << bit);
427 PSW.C = (operand & (1 << bit));
428 operand &= ~(1 << bit);
432 operand &= (1 << bit);
433 PSW.Z = (operand == 0);
434 PSW.N = (operand & 0x80);
438 operand |= (1 << bit);
439 PSW.Z = (operand == 0);
440 PSW.N = (operand & 0x80);
444 operand ^= (1 << bit);
445 PSW.Z = (operand == 0);
446 PSW.N = (operand & 0x80);
450 operand ^= (1 << bit);
451 PSW.Z = (operand == 0);
452 PSW.N = (operand & 0x80);
456 PSW.C = (operand & (1 << bit));
457 operand |= (1 << bit);
void CMPM(uint16_t dst, uint8_t value)
void SUBW(uint16_t &dest, uint16_t operand)
void PCALL(uint8_t offset)
void JMP(uint16_t address)
uint8_t read(uint16_t address)
void NOT1(uint8_t bit, uint8_t &operand)
void AND1(uint8_t bit, uint8_t &operand)
void ANDM(uint16_t dest, uint8_t operand)
void MOVW(uint16_t &dest, uint16_t operand)
void EORM(uint16_t dest, uint8_t operand)
void DEC(uint16_t operand)
void DIV(uint8_t operand)
void EOR1(uint8_t bit, uint8_t &operand)
void SBCM(uint16_t &dest, uint8_t operand)
void SET1(uint8_t bit, uint8_t &operand)
void TCLR1(uint8_t bit, uint8_t &operand)
void TCALL(uint8_t offset)
void ROL(uint16_t operand)
void MOV_ADDR(uint16_t address, uint8_t operand)
void write(uint16_t address, uint8_t value)
void XCN(uint8_t operand, bool isImmediate=false)
void PUSH(uint8_t operand)
void ADDW(uint16_t &dest, uint16_t operand)
void INCW(uint16_t &operand)
void BBC(uint8_t bit, uint8_t operand)
void CALL(uint16_t address)
void DECW(uint16_t &operand)
void BBS(uint8_t bit, uint8_t operand)
void POP(uint8_t &operand)
void ASL(uint16_t operand)
void CLR1(uint8_t bit, uint8_t &operand)
void ADCM(uint16_t &dest, uint8_t operand)
void OR1(uint8_t bit, uint8_t &operand)
void CMPW(uint16_t operand)
void MOV1(uint8_t bit, uint8_t &operand)
void TSET1(uint8_t bit, uint8_t &operand)
void ORM(uint16_t dest, uint8_t operand)
void MUL(uint8_t operand)
SNES Emulation and debugging tools.
Main namespace for the application.