Simplified memory access encoding
This commit is contained in:
parent
21e544640d
commit
47f2bc7947
3 changed files with 69 additions and 109 deletions
|
@ -4,10 +4,6 @@ import "git.akyoto.dev/cli/q/src/cpu"
|
|||
|
||||
// memoryAccess encodes a memory access.
|
||||
func memoryAccess(code []byte, opCode8 byte, opCode32 byte, register cpu.Register, offset byte, numBytes byte, source cpu.Register) []byte {
|
||||
if numBytes == 2 {
|
||||
code = append(code, 0x66)
|
||||
}
|
||||
|
||||
opCode := opCode32
|
||||
|
||||
if numBytes == 1 {
|
||||
|
@ -20,6 +16,10 @@ func memoryAccess(code []byte, opCode8 byte, opCode32 byte, register cpu.Registe
|
|||
mod = AddressMemoryOffset8
|
||||
}
|
||||
|
||||
if numBytes == 2 {
|
||||
code = append(code, 0x66)
|
||||
}
|
||||
|
||||
code = encode(code, mod, source, register, numBytes, opCode)
|
||||
|
||||
if register == RSP || register == R12 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue