Implemented subtraction

This commit is contained in:
Eduard Urbach 2024-06-24 16:55:15 +02:00
parent 0657b88945
commit 9e3af3b01c
Signed by: eduard
GPG key ID: 49226B848C78F6C8
9 changed files with 92 additions and 28 deletions

View file

@ -1,18 +0,0 @@
package x64
import "git.akyoto.dev/cli/q/src/build/cpu"
// AddRegNum8 adds a byte to the given register.
func AddRegNum8(code []byte, destination cpu.Register, number uint8) []byte {
if destination >= 8 {
code = append(code, REX(0, 0, 0, 1))
destination -= 8
}
return append(
code,
0x83,
ModRM(0b11, 0b000, byte(destination)),
byte(number),
)
}