performance-aware/execution.odin

25 lines
702 B
Odin

package sim_8086
import "core:os"
import "core:fmt"
import "core:math"
import "core:strings"
execute_instruction :: proc(inst: Instruction) {
#partial switch inst.opname {
case .MOV:
if reg_id,ok := inst.dst.(RegisterId); ok {
#partial switch val in inst.src {
case Immediate8:
registers[reg_id].value.low = (u8)(val)
case ImmediateU8:
registers[reg_id].value.low = (u8)(val)
case Immediate16:
registers[reg_id].value.low = (u8)(val)
case RegisterId:
registers[reg_id].value.full = registers[val].value.full
}
}
}
}