q/src/arm/Load.go

14 lines
348 B
Go
Raw Normal View History

2025-03-06 23:13:14 +01:00
package arm
import "git.urbach.dev/cli/q/src/cpu"
// LoadRegister loads from memory into a register.
func LoadRegister(destination cpu.Register, base cpu.Register, offset int16, length byte) uint32 {
if offset < 0 {
offset &= 0xFF
offset |= 1 << 8
}
return 0b11111000010<<21 | uint32(offset)<<12 | uint32(base)<<5 | uint32(destination)
}