Device: Memory

The memory device provides access to up to 16 megabytes of additional memory.

PortNameDescriptionReadWrite
0x10Head 1First read-write head.
0x11aliasedaliased
0x12OffsetPage offset of first head.
0x13continuedcontinued
0x14AddressMemory address of first head.
0x15continuedcontinued
0x16Page countNumber of provisioned pages.
0x17continuedcontinued
0x18Head 2Second read-write head.
0x19aliasedaliased
0x1AOffsetPage offset of second head.
0x1Bcontinuedcontinued
0x1CAddressMemory address of second head.
0x1Dcontinuedcontinued
0x1EPage copyCopy whole pages of memory.
0x1Fcontinuedcontinued

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

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.