Renamed x64 to x86

This commit is contained in:
Eduard Urbach 2025-02-05 23:16:18 +01:00
parent f558a69366
commit 9c53235e7e
Signed by: eduard
GPG key ID: 49226B848C78F6C8
80 changed files with 1757 additions and 1757 deletions

27
src/x86/StoreDynamic.go Normal file
View file

@ -0,0 +1,27 @@
package x86
import (
"encoding/binary"
"git.akyoto.dev/cli/q/src/cpu"
)
// StoreDynamicNumber stores a number into the memory address at `destination` with a register offset.
func StoreDynamicNumber(code []byte, destination cpu.Register, offset cpu.Register, length byte, number int) []byte {
code = memoryAccessDynamic(code, 0xC6, 0xC7, destination, offset, length, 0b000)
switch length {
case 8, 4:
return binary.LittleEndian.AppendUint32(code, uint32(number))
case 2:
return binary.LittleEndian.AppendUint16(code, uint16(number))
}
return append(code, byte(number))
}
// StoreDynamicRegister stores the contents of the `source` register into the memory address at `destination` with a register offset.
func StoreDynamicRegister(code []byte, destination cpu.Register, offset cpu.Register, length byte, source cpu.Register) []byte {
return memoryAccessDynamic(code, 0x88, 0x89, destination, offset, length, source)
}