bugfixs in movw opcodes
This commit is contained in:
parent
5742e7c257
commit
4bf74d7664
|
@ -2,13 +2,13 @@
|
|||
#include <instructions/instructions.h>
|
||||
|
||||
void instruction_movw_r0_disp_r(cpu_status_t* status){
|
||||
long disp = (0x0000000F & (long)status->r[LO_NIBBLE(cpu_read8(status,status->pc+1))]);
|
||||
long disp = (0x0000000F & (long)LO_NIBBLE(cpu_read8(status,status->pc+1)));
|
||||
cpu_write16(status, status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))] + (disp << 1), status->r[0]);
|
||||
status->pc += 2;
|
||||
}
|
||||
|
||||
void instruction_movw_disp_r_r0(cpu_status_t* status){
|
||||
long disp = (0x0000000F & (long)status->r[LO_NIBBLE(cpu_read8(status,status->pc+1))]);
|
||||
long disp = (0x0000000F & (long)LO_NIBBLE(cpu_read8(status,status->pc+1)));
|
||||
status->r[0] = cpu_read16(status, status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))] + (disp << 1));
|
||||
|
||||
if ((status->r[0] & 0x8000) == 0)
|
||||
|
@ -91,6 +91,6 @@ void instruction_movw_disp_gbr_r0(cpu_status_t* status){
|
|||
}
|
||||
|
||||
void instruction_movw_r_r0_r(cpu_status_t* status){
|
||||
cpu_write16(status, status->r[LO_NIBBLE(cpu_read8(status,status->pc))] + status->r[0], status->r[LO_NIBBLE(cpu_read8(status,status->pc))]);
|
||||
cpu_write16(status, status->r[LO_NIBBLE(cpu_read8(status,status->pc))] + status->r[0], status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))]);
|
||||
status->pc += 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue