ocpu: Add AND instruction
This commit is contained in:
parent
4a18c50bdc
commit
1d1f09d4e8
|
@ -48,6 +48,16 @@
|
|||
#define INS_DIV_REG 0xB4
|
||||
#define INS_INC 0x15
|
||||
#define INS_DEC 0x16
|
||||
#define INS_AND_IM 0x20
|
||||
#define INS_AND_REG 0xC0
|
||||
#define INS_OR_IM 0x21
|
||||
#define INS_OR_REG 0xC1
|
||||
#define INS_NOR_IM 0x22
|
||||
#define INS_NOR_REG 0xC2
|
||||
#define INS_XOR_IM 0x23
|
||||
#define INS_XOR_REG 0xC3
|
||||
#define INS_NAND_IM 0x24
|
||||
#define INS_NAND_REG 0xC4
|
||||
#define INS_OCPU_NOP 0x90
|
||||
#define INS_OCPU_SEC 0x61
|
||||
#define INS_OCPU_CLC 0x62
|
||||
|
|
|
@ -350,6 +350,26 @@ void ocpu_execute() {
|
|||
write_register(reg, 0, word_value);
|
||||
}
|
||||
break;
|
||||
case INS_AND_IM:
|
||||
reg = ocpu_fetch_byte();
|
||||
if (!is_word_reg(reg)) {
|
||||
value = match_register(reg) & ocpu_fetch_byte();
|
||||
write_register(reg, value, 0);
|
||||
} else {
|
||||
word_value = match_register(reg) & ocpu_fetch_byte();
|
||||
write_register(reg, 0, word_value);
|
||||
}
|
||||
break;
|
||||
case INS_AND_REG:
|
||||
reg = ocpu_fetch_byte();
|
||||
if (!is_word_reg(reg)) {
|
||||
value = match_register(reg) & match_register(ocpu_fetch_byte());
|
||||
write_register(reg, value, 0);
|
||||
} else {
|
||||
word_value = match_register(reg) & match_register(ocpu_fetch_byte());
|
||||
write_register(reg, 0, word_value);
|
||||
}
|
||||
break;
|
||||
case INS_OCPU_NOP:
|
||||
break;
|
||||
case INS_OCPU_SEC:
|
||||
|
|
Loading…
Reference in New Issue