This specification describes the memory device of the Bedrock computer system.
The memory device provides access to up to 16 megabytes of additional memory.
Ports
Port | Name | Description | Read | Write |
---|---|---|---|---|
0x10 |
Count | Number of pages allocated. | ✓ | ✓ |
0x11 |
grouped | grouped | ✓ | ✓ |
0x12 |
Page offset | Page offset for first head. | ✓ | ✓ |
0x13 |
grouped | grouped | ✓ | ✓ |
0x14 |
Address offset | Address offset for first head. | ✓ | ✓ |
0x15 |
grouped | grouped | ✓ | ✓ |
0x16 |
Head | Read and write with first head. | ✓ | ✓ |
0x17 |
aliased | aliased | ✓ | ✓ |
0x18 |
Copy | Copy one page to another. | ✗ | ✓ |
0x19 |
grouped | grouped | ✗ | ✓ |
0x1A |
Page offset | Page offset for second head. | ✓ | ✓ |
0x1B |
grouped | grouped | ✓ | ✓ |
0x1C |
Address offset | Address offset for second head. | ✓ | ✓ |
0x1D |
grouped | grouped | ✓ | ✓ |
0x1E |
Head | Read and write with second head. | ✓ | ✓ |
0x1F |
aliased | aliased | ✓ | ✓ |
Count
Reading from this port group will return the allocated page count. The number of pages initially allocated for use is implementation defined.
Writing to this port group will perform an atomic write, requesting that the allocated page count be changed to the value written on commit. If the requested value is greater than the current allocated page count, new pages will be allocated until either the requested value is reached or the available memory is exhausted. If the requested value is less than the current allocated page count, pages will be deallocated until either the requested value or an implementation defined minimum value is reached.
Page offset
Each page offset port group is associated with a memory head, and exposes the page offset of that head for reading and writing. The initial page offset for each head is zero.
Address offset
Each address offset port group is associated with a memory head, and exposes the address offset of that head for reading and writing. The initial address offset for each head is zero.
Head
Each head port is associated with a memory head, and exposes that head for reading and writing. The two port groups following each head port contain the page offset and address offset for that head.
Copy
Writing to this port group will perform an atomic write, requesting that a number of pages equal to the value written is copied on commit.
The initial source page is addressed by the page offset of the second memory head. The initial destination page is addressed by the page offset of the first memory head. While the source and destination pages are both allocated, and while the number of pages copied is less than the number requested, the contents of the source page will be copied to the destination page and then the source and destination page addresses will be incremented by 1.
Data structures
Memory page
A page is a 256 byte block of writeable memory. The initial value of each byte in a page is zero.
Memory is allocated and deallocated as pages. The next page to be allocated will be assigned the lowest available page address. The next page to be deallocated will be the allocated page with the highest page address. A maximum of 65535 pages can be allocated at a time.
Memory head
Memory is accessed via either of two memory heads. Each head contains a 16-bit page offset value and a 16-bit address offset value. The initial value of each offset value is zero.
Each head is associated with a page offset port and an address offset port, which are used to set the page and address offsets for that head. The memory address referenced by a head is calculated by multiplying the page offset by 256 and then adding the address offset.
Reading a byte from a memory head will return the byte at the memory address referenced by that head, and then will increment the address offset by 1, wrapping to zero on overflow. The behaviour when reading from an unallocated memory address is undefined.
Writing a byte to a memory head will write that byte to the memory address referenced by that head, and then will increment the address offset by 1, wrapping to zero on overflow. The behaviour when writing to an unallocated memory address is undefined.
This device contains two memory heads: one controlled by the first eight ports, and one controlled by the last eight.
Wake
This device will never send a wake request to the system device.