Added x86 package
Some checks failed
/ test (push) Failing after 14s

This commit is contained in:
Eduard Urbach 2025-06-23 11:43:09 +02:00
parent 31c5ed614c
commit 9b2b2578f5
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
57 changed files with 2661 additions and 0 deletions

16
src/x86/Pop.go Normal file
View file

@ -0,0 +1,16 @@
package x86
import "git.urbach.dev/cli/q/src/cpu"
// PopRegister pops a value from the stack and saves it into the register.
func PopRegister(code []byte, register cpu.Register) []byte {
if register > 0b111 {
code = append(code, REX(0, 0, 0, 1))
register &= 0b111
}
return append(
code,
0x58+byte(register),
)
}