nemu/src/instructions/mov.c

16 lines
593 B
C

#include <cpu.h>
#include <instructions/instructions.h>
void instruction_mov_r_r(cpu_status_t* status) {
status->r[HI_NIBBLE(cpu_read8(status,status->pc))] = status->r[LO_NIBBLE(cpu_read8(status,status->pc+1))];
status->pc += 2;
}
void instruction_mov_imm_r(cpu_status_t* status){
if ((cpu_read8(status,status->pc+1) & 0x80) == 0)
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] = (0x000000FF & cpu_read8(status,status->pc+1));
else
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] = (0xFFFFFF00 | cpu_read8(status,status->pc+1));
status->pc += 2;
}