Q: What does the memory map look like when I execute an addin?
Item
| Address
32k flash RAM pages of BIOS/OS
| $0000
|  
| $7FFF
|
Bank 1 : 8k flash RAM for ADDIN CODE
| $8000
|  
| $9FFF
|
Bank 2: 8k flash RAM Switchable
| $A000
|  
| $BFFF
|
10k system RAM - used for firmware globals, SYSCALL parameter passing, etc.
| $C000
|  
| $EFFF
|
4k user RAM : STACK starts at $FFFF and stacks down through memory. Addins can store data from $F000 upward.
| $F000
|  
| $FFFF
| |
Q: Where's the rest of the 2Mb?
The z80 processor can only directly access address in a 64k memory map (64k=16bit
address reference). The rex uses paging (bank switching) to map banks of the firmware
and RAM into the 64k address space so that it can then be accessed by the 16bit Z80 address
references. More detail on bank switching to come...
Q: Where are they stored when not executing?
Addins are executed "in situ" - the code isn't actually copied anywhere before it executes
- simply the page bank where the addin is stored is mapped into the 8000-9fff address space.
The standard eight Rex addins are stored in the Rex database (user space), in two components:
- a database record in the SHELLADDIN table contains the addin name,
description, icon and some other info about the addin, including the 8KB page
number
- the actual addin code, up to 8KB. There are 8 slots (pages) available, at
absolute address 00100000-0010FFFF. This is followed by another unused
64KB , with the Rex database apparently starting at 00120000.
Q: Where can I learn more about the memory hardware?
The data sheet
for the flash memory chips used in Rex (4 x Fujitsu 29DL164BD-90) is on Fujitsu's site.
This was pivotal in Chris Harris understanding how to write (and erase) the Rex flash
memory, as done in "Adder" app.