Flattened package hierarchy

This commit is contained in:
Eduard Urbach 2024-08-25 20:38:22 +02:00
parent 12dcf672cb
commit a4dc5a4eff
Signed by: eduard
GPG key ID: 49226B848C78F6C8
89 changed files with 42 additions and 42 deletions

View file

@ -1,27 +0,0 @@
package x64
import (
"encoding/binary"
"git.akyoto.dev/cli/q/src/cpu"
)
// StoreNumber stores a number into the memory address included in the given register.
func StoreNumber(code []byte, register cpu.Register, offset byte, length byte, number int) []byte {
code = memoryAccess(code, 0xC6, 0xC7, register, 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))
}
// StoreRegister stores the contents of the `source` register into the memory address included in the given register.
func StoreRegister(code []byte, register cpu.Register, offset byte, length byte, source cpu.Register) []byte {
return memoryAccess(code, 0x88, 0x89, register, offset, length, source)
}