Improved x64 encoder

This commit is contained in:
Eduard Urbach 2024-07-20 00:58:39 +02:00
parent b776775f8f
commit 2c2b6e93db
Signed by: eduard
GPG key ID: 49226B848C78F6C8
15 changed files with 317 additions and 53 deletions

View file

@ -6,10 +6,10 @@ import (
// AddRegisterNumber adds a number to the given register.
func AddRegisterNumber(code []byte, destination cpu.Register, number int) []byte {
return regRegNum(code, 0, byte(destination), number, 0x83, 0x81)
return encodeNum(code, 1, AddressDirect, 0, byte(destination), number, 0x83, 0x81)
}
// AddRegisterRegister adds a register value into another register.
func AddRegisterRegister(code []byte, destination cpu.Register, operand cpu.Register) []byte {
return regReg(code, byte(operand), byte(destination), 0x01)
return encode(code, 1, AddressDirect, byte(operand), byte(destination), 0x01)
}