mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 13:04:35 +03:00
Add jmp_imm8(0xeb) instruction
This commit is contained in:
@@ -27,5 +27,6 @@ public:
|
||||
void nop(); // 0x90
|
||||
void mov_ecx_imm32(); // 0xb9
|
||||
void mov_ebx_imm32(); // 0xbb
|
||||
void jmp_imm8(); // 0xeb
|
||||
void hlt(); // 0xf4
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ void Instructions::init_instructions(){
|
||||
this->instructions[0x90] = &Instructions::nop;
|
||||
this->instructions[0xb9] = &Instructions::mov_ecx_imm32;
|
||||
this->instructions[0xbb] = &Instructions::mov_ebx_imm32;
|
||||
this->instructions[0xeb] = &Instructions::jmp_imm8;
|
||||
this->instructions[0xf4] = &Instructions::hlt;
|
||||
}
|
||||
|
||||
@@ -115,6 +116,14 @@ void Instructions::mov_ebx_imm32(){
|
||||
this->eip += 3;
|
||||
}
|
||||
|
||||
void jmp_imm8() {
|
||||
printf("jmp_imm8 called.\n");
|
||||
|
||||
this->eip++;
|
||||
uint8_t imm8 = memory.read_uint8(this->eip);
|
||||
this->eip += imm8;
|
||||
}
|
||||
|
||||
void Instructions::hlt(){
|
||||
printf("hlt called.\n");
|
||||
this->eip = 0x00;
|
||||
|
||||
Reference in New Issue
Block a user