TRM: Memory - fvdhoef/aquarius-plus GitHub Wiki

[!WARNING] BASIC programs (machine language subroutines) should never write to the memory banking I/O ports. The plusBASIC interpreter requires memory to be in a specific configuration and will crash if the expected RAM page is not mapped into each memory bank. plusBASIC automatically manages page swapping and all memory related statements and functions have options to access paged RAM.

Memory Banks

There are 4 banks of 16k of ram available to the z80’s address space. Each of of four banks can be independently switched out to point at different 16k portions of the 512k of ram.

Bank Hexadecimal Decimal I/O Port Hex
0 $0000 - $3FFF 0 - 16383 240 $F0
1 $4000 - $7FFF 16384 - 32767 241 $F1
2 $8000 - $BFFF 32768 - 49151 242 $F2
3 $C000 - $FFFF 49152 - 65535 243 $F3

Memory Pages

Page Hex Description
0 $00 Startup ROM
1 - 18 $01 - $12 Undefined
19 $13 Cartridge port
20 $14 Video RAM
21 $15 Character RAM
22 - 31 $16 - $1F Reserved
32 - 63 $20 - $3F 512KB RAM
  • Pages 32 through 47 is User RAM and is free for use by BASIC programs.
  • Pages 48 through 63 is reserved for plusBASIC and is read-only from BASIC programs.

plusBASIC RAM Allocation

Page Hex Description
48 $32 Reserved
49 $32 Reserved
50 $32 Transient buffers
51 $33 Boot ROM work area
52 $34 Screen buffers
53 $35 Video RAM shadow buffer
54 $36 plusBASIC system buffers
55 $37 PT3 Player code and data
56 $38 Bank 0 RAM
57 $39 Bank 1 RAM
58 $3A Bank 2 RAM
59 $3B Bank 3 RAM
60 $3C Main System ROM
61 $3D Extended System ROM
62 $3E Auxiliary System ROM
63 $3F Cartridge Image