lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Ah. Clearly, I should have been paying more attention to this thread.

On Mon, 18 Feb 2013, Justin Cormack wrote:
Well thats the Lua on RiscOS solution, pretty much provide peek and poke,

I've taken a couple of approaches in my systems.

Peek and poke in a real-time system with no MMU. Any old random number
can be a memory address. There are variants for each size of
transaction, so you can say x = memory.peekbyte( address ) or memory.pokebyte( address, value ). A vxWorks system also has a
function that allows me to search the system's symbol table for
global addresses by name.

On VMS, a mapping needs to be established to the global section. So
these systems have an added function that performs the mapping and
returns its base address. So you'd do base = memory.mgblsc( "section" )
followed by x = memory.peekword( base + offset ) etc.

The VMS systems also have a VMEbus adapter for custom hardware with CSRs
residing in the A16 space. For these, I've implemented a couple of
tables, vme.a16d16 and vme.a16d32. A script treats these as an array,
using vme.a16d16[ address ] = value to write a 16-bit CSR or value = vme.a16d32[ address ] to read a 32-bit one.
--
roger ivie
rivie@ridgenet.net