Documentation
¶
Overview ¶
Package arm7tdmi imlplements the ARM7TDMI instruction set as defined in the ARM7TDMI Instruction Set Reference:
http://www.ecs.csun.edu/~smirzaei/docs/ece425/arm7tdmi_instruction_set_reference.pdf
For this project we only need to emulte the Thumb architecture. The strategy for this was to implement the nineteen opcode formats in turn, until there was nothing left. As of writing only format 17, software interrupts, remain unimplemented. To this end, the following reference was preferred:
https://usermanual.wiki/Pdf/ARM7TDMImanualpt3.1481331792/view
The full version of that manual was found here. Cycle timings for the instructions were found in chapter 7.
https://www.dwedit.org/files/ARM7TDMI.pdf
More detailed explanations of Thumb instruction were found in chapter A7.1 of the ARM Architecture Reference Manual. In particular the side-effects of particular instructions were found in the supplied pseudo-code. Where appropriate, the pseudo-code has been included as a comment in the Go source.
https://www.cs.miami.edu/home/burt/learning/Csc521.141/Documents/arm_arm.pdf
Index ¶
Constants ¶
const ( FlashOrigin = uint32(0x00000000) Flash32kMemtop = uint32(0x00007fff) SRAMOrigin = uint32(0x40000000) SRAM8kMemtop = uint32(0x40001fff) PeripheralsOrigin = uint32(0xe0000000) PeripheralsMemtop = uint32(0xffffffff) )
const ( TIMERcontrol = PeripheralsOrigin | 0x00008004 TIMERvalue = PeripheralsOrigin | 0x00008008 )
const (
InternalClk = 70 // Mhz
)
Clock speeds inside the arm7 sub-system.
const (
MAMCR = PeripheralsOrigin | 0x001fc000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARM ¶
type ARM struct {
// contains filtered or unexported fields
}
ARM implements the ARM7TDMI-S LPC2103 processor.
func NewARM ¶
func NewARM(mem SharedMemory, hook CartridgeHook) *ARM
NewARM is the preferred method of initialisation for the ARM type.
func (*ARM) PlumbSharedMemory ¶
func (arm *ARM) PlumbSharedMemory(mem SharedMemory)
PlumbSharedMemory should be used to update the shared memory reference. Useful when used in conjunction with the rewind system.
func (*ARM) Run ¶
Run will continue until the ARM program encounters a switch from THUMB mode to ARM mode. Note that currently, this means the ARM program may run forever.
Returns the number of ARM cycles and any errors.
func (*ARM) SetDisassembler ¶
func (arm *ARM) SetDisassembler(disasm mapper.CartCoProcDisassembler)
SetDisassembler implements the mapper.CartCoProcBus interface.
type ARMinterruptReturn ¶
type CartridgeHook ¶
type CartridgeHook interface { // Returns false if parent cartridge mapping does not understand the // address. ARMinterrupt(addr uint32, val1 uint32, val2 uint32) (ARMinterruptReturn, error) }
CartridgeHook allows the parent cartridge mapping to emulate ARM code in a more direct way. This is primarily because we do not yet emulate full ARM bytecode only Thumb bytecode, and the value of doing so is unclear.
type SharedMemory ¶
type SharedMemory interface { // blocks mays be different for read and write operations. MapAddress(addr uint32, write bool) (*[]byte, uint32) // and Program Counter ResetVectors() (uint32, uint32, uint32) }
SharedMemory represents the memory passed between the parent cartridge-mapper implementation and the ARM.