27 lines
454 B
Go
Raw Normal View History

2023-10-21 15:46:20 +00:00
package asm
import (
"fmt"
"io"
"git.akyoto.dev/cli/q/src/asm/x64"
"git.akyoto.dev/cli/q/src/register"
)
type RegisterNumber struct {
Base
Register register.Register
Number uint64
}
func (x *RegisterNumber) Write(w io.ByteWriter) {
switch x.Mnemonic {
case MOV:
x64.MoveRegNum32(w, uint8(x.Register), uint32(x.Number))
}
}
func (x *RegisterNumber) String() string {
return fmt.Sprintf("%s %s, %x", x.Mnemonic, x.Register, x.Number)
}