Device: Memory
The memory device provides access to up to 16 megabytes of additional memory.
Port | Name | Description | Read | Write |
---|---|---|---|---|
0x10 | Head 1 | First read-write head. | ✓ | ✓ |
0x11 | aliased | aliased | ✓ | ✓ |
0x12 | Offset | Page offset of first head. | ✓ | ✓ |
0x13 | continued | continued | ✓ | ✓ |
0x14 | Address | Memory address of first head. | ✓ | ✓ |
0x15 | continued | continued | ✓ | ✓ |
0x16 | Page count | Number of provisioned pages. | ✓ | ✓ |
0x17 | continued | continued | ✓ | ✓ |
0x18 | Head 2 | Second read-write head. | ✓ | ✓ |
0x19 | aliased | aliased | ✓ | ✓ |
0x1A | Offset | Page offset of second head. | ✓ | ✓ |
0x1B | continued | continued | ✓ | ✓ |
0x1C | Address | Memory address of second head. | ✓ | ✓ |
0x1D | continued | continued | ✓ | ✓ |
0x1E | Page copy | Copy whole pages of memory. | ✗ | ✓ |
0x1F | continued | continued | ✗ | ✓ |
Memory
Memory is provisioned in 256 byte blocks, called pages. Up to 65535 pages can be provisioned. The initial value of each byte of expansion memory is zero.
Each byte of provisioned memory is uniquely identified by a 24-bit memory address, with the high 16 bits identifying a page of memory and the low 8 bits identifying a byte within that page.
Ports
Head
Memory can be read from and written to via two independent read-write heads. Each head is associated with an offset port and an address port. Each head port is aliased for fast access.
The memory address which will be read from or written to by a head is calculated by multiplying the value of the associated offset port by 256 and then adding the value of the associated address port. The behaviour on overflow is implementation defined.
Reading from a head port will return the byte at the memory address currently referenced by that head, and then the value of the address port will be incremented by 1, wrapping to zero on overflow. The behaviour when reading from unprovisioned memory is implementation defined.
Writing to a head port will write the byte written to the memory address currently referenced by that head, and then the value of the address port will be incremented by 1, wrapping to zero on overflow. The behaviour when writing to unprovisioned memory is implementation defined.
Offset
Reading from this port group will return the base page offset of the associated head. The initial value of this port is zero.
Writing to this port group will set the base page offset of the associated head.
Address
Reading from this port group will return the byte offset of the associated head. The initial value of this port is zero.
Writing to this port group will set the byte offset of the associated head.
Page count
Reading from this port group will return the number of pages currently provisioned for use. The initial value of this port is implementation defined.
Writing to this port group will perform a cached write, and then will request that a number of pages equal to the value written be provisioned for use.
If the number of pages to be provisioned is greater than the number currently provisioned, the system will provision new pages until either the number of pages provisioned equals the number of pages requested or until no new pages can be provisioned. Pages are provisioned in ascending order, starting with the page directly following the highest-addressed page. The initial value of each byte of memory on each newly provisioned page is zero.
If the number of pages to be provisioned is less than the number currently provisioned, the system will deprovision pages until either the number of pages provisioned equals the number of pages requested, or until the number of pages provisioned is equal to an implementation defined minimum value. Pages are deprovisioned in descending order, starting from the highest-addressed page.
Page copy
Writing to this port group will perform a cached write, and then will copy a number of pages equal to the value written.
The initial source page will be the page addressed by the value of the second offset port, and the initial destination page will be the page addressed by the value of the first offset port. While the number of pages copied is less than the number of pages to be copied, and while the source and destination pages are both provisioned, the contents of the source page will be copied to the destination page, then the page directly following the source page will become the new source page, and then the page directly following the destination page will become the new destination page.
System wake
This device will never send a wake request to the system device.