This commit is contained in:
folkert van heusden 2023-03-19 20:28:47 +01:00
parent 658071b486
commit 963b6a5a3f
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

13
cpu.cpp
View file

@ -490,8 +490,11 @@ bool cpu::double_operand_instructions(const uint16_t instr)
uint16_t result = g_dst.value.value() | g_src.value.value(); uint16_t result = g_dst.value.value() | g_src.value.value();
if (put_result(g_dst, result)) if (put_result(g_dst, result)) {
setPSW_flags_nzv(result, word_mode); setPSW_n(SIGN(result, word_mode));
setPSW_z(result == 0);
setPSW_v(false);
}
return true; return true;
} }
@ -769,14 +772,14 @@ bool cpu::single_operand_instructions(const uint16_t instr)
case 0b000101000: { // CLR/CLRB case 0b000101000: { // CLR/CLRB
{ {
auto g_dst = getGAMAddress(dst_mode, dst_reg, word_mode); // read and write in word-mode but update in 'word_mode'
auto g_dst = getGAM(dst_mode, dst_reg, false, false);
uint16_t r = 0; uint16_t r = 0;
// CLRB only clears the least significant byte // CLRB only clears the least significant byte
if (word_mode) { if (word_mode) {
if (dst_mode == 0) r = g_dst.value.value() & 0xff00;
r = getRegister(dst_reg, false, false) & 0xff00;
// both in byte and word mode the full word must be updated // both in byte and word mode the full word must be updated
g_dst.word_mode = false; g_dst.word_mode = false;