40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
#include <instructions/instructions.h>
|
|
|
|
void instruction_tst_r_r(cpu_status_t* status){
|
|
if ((status->r[LO_NIBBLE(cpu_read8(status,status->pc))] & status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))]) == 0)
|
|
status->t = 1;
|
|
else
|
|
status->t = 0;
|
|
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_or_r_r(cpu_status_t* status){
|
|
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] |= status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))];
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_and_r_r(cpu_status_t* status){
|
|
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] &= status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))];
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_xor_r_r(cpu_status_t* status){
|
|
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] ^= status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))];
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_and_imm_r0(cpu_status_t* status){
|
|
status->r[0] &= (0x000000FF & (long)cpu_read8(status,status->pc+1));
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_not_r_r(cpu_status_t* status){
|
|
status->r[LO_NIBBLE(cpu_read8(status,status->pc))] = ~status->r[HI_NIBBLE(cpu_read8(status,status->pc+1))];
|
|
status->pc += 2;
|
|
}
|
|
|
|
void instruction_or_imm_r0(cpu_status_t* status){
|
|
status->r[0] |= (0x000000FF & (long)cpu_read8(status,status->pc+1));
|
|
status->pc += 2;
|
|
} |