parent
31c5ed614c
commit
9b2b2578f5
57 changed files with 2661 additions and 0 deletions
16
src/x86/Pop.go
Normal file
16
src/x86/Pop.go
Normal 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),
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue