Acorn BBC BASIC II Memory Map
Addresses outside the ROM used by Acorn BBC BASIC II at run time — zero-page
workspace, RAM buffers, and memory-mapped I/O. For the ROM code
itself (&8000–&BFFF), see the
disassembly listing.
Zero page
| Address | Name | Access | Description |
|---|---|---|---|
&0000–&0001 |
zp_lomem |
R/W | LOMEM: the start of variable storage. Defaults to |
&0002–&0003 |
zp_vartop |
R/W | VARTOP: the address just past the last allocated variable — where the next new variable goes. Runs from |
&0004–&0005 |
zp_stack_ptr |
R/W | Pointer to the top of BASIC's value stack, which grows
downward from |
&0006–&0007 |
zp_himem |
R/W | HIMEM: the top of memory available to BASIC. The value stack ( |
&0008–&0009 |
zp_erl |
R | ERL: the line number in which the last error occurred, set by the error handler and read by the |
&000A |
zp_text_ptr_off |
R/W | PtrA offset: the offset of the next character within the program line addressed by |
&000B–&000C |
zp_text_ptr |
R/W | PtrA: the primary program/text pointer — the base address of the line currently being interpreted. Combined with |
&000D–&0011 |
zp_rnd_seed |
R/W | RND state: the 33-bit linear-feedback shift register behind |
&0012–&0013 |
zp_top |
R/W | TOP: the address just past the end of the tokenised program text (and the default for |
&0014 |
zp_print_bytes |
R/W | Print field width: the @%-derived field width used while formatting a number for |
&0015 |
zp_print_flag |
R/W | Number-base flag for output: 0 selects decimal, negative selects hexadecimal (set by |
&0016–&0017 |
zp_error_vec |
R/W |
|
&0018 |
zp_page |
R | PAGE high byte: the start of the BASIC program as a page number (PAGE = this × 256). Read from OSHWM at startup; the |
&0019–&001A |
zp_text_ptr2 |
R/W | PtrB: the secondary text pointer, used by the expression evaluator and the tokeniser while |
&001B |
zp_text_ptr2_off |
R/W | PtrB offset: the offset of the next character for the secondary text pointer |
&001C–&001D |
zp_data_ptr |
R/W | DATA pointer: the address of the next |
&001E |
zp_count |
R/W | COUNT: the number of characters printed since the last newline (the print column). Used for |
&001F |
zp_listo |
R/W | LISTO flags: the listing-indent options set by |
&0020 |
zp_trace_flag |
R/W | TRACE flag: &00 = tracing off, &FF = on ( |
&0021–&0022 |
zp_trace_max |
R/W | TRACE ceiling: the highest line number that |
&0023 |
zp_width |
R/W | WIDTH: the print line width for the auto-newline ( |
&0024 |
zp_repeat_level |
R/W | REPEAT stack depth: how many |
&0025 |
zp_gosub_level |
R/W | GOSUB stack depth: how many |
&0026 |
zp_for_level |
R/W | FOR stack depth: how many |
&0027 |
zp_var_type |
R/W | Value type of the most recently fetched/evaluated value: 0 = string, positive (&40) = integer, negative = real. Drives the type dispatch throughout the evaluator. |
&0028 |
zp_opt_flag |
R/W | Inline-assembler OPT flags ( |
&0029 |
zp_asm_opcode |
R/W | Inline assembler: the opcode byte being built for the instruction currently being assembled, before its operand bytes are appended. |
&002A–&002D |
zp_iwa |
R/W | IWA — the 32-bit integer work accumulator. Holds the integer operand/result of the evaluator and the integer arithmetic primitives, and doubles as a pointer to a variable’s value during a fetch. |
&002E–&0035 |
zp_fwa_sign |
R/W | FWA — floating-point work accumulator A (&2E-&35): sign (&2E), overflow/guard (&2F), excess-128 exponent (&30), 32-bit mantissa MSB-first (&31-&34) and a rounding byte (&35). The main register for real arithmetic; see |
&0036 |
zp_strbuf_len |
R/W | Length of the string currently in the string work area at |
&0037–&0038 |
zp_general |
R/W | General-purpose work pointer (&37-&3A). Reused widely — the tokeniser/line scanner, the variable-chain walk, the program editor — as a scratch 16-bit pointer. |
&0039–&003A |
zp_fileblk |
R/W | Filing-system control block (&39 onward): the OSFILE / load-save parameter block. Filing is not active during arithmetic, so this overlaps the FP workspace below ( |
&003B–&0042 |
zp_fwb_sign |
R/W | FWB — floating-point work accumulator B (&3B-&42), same layout as |
&0043–&0047 |
zp_fp_temp |
R/W | Floating-point temporary / scratch (&43-&47). Holds spill bytes for the FP routines and serves as the quotient build area for integer |
&0048 |
zp_dp_flag |
R/W | Decimal-point-seen flag, set while parsing a number literal so a second |
&0049 |
zp_dec_exp |
R/W | Decimal exponent accumulated while parsing the |
&004A |
zp_int_exp |
R/W | Integer-part / exponent scratch: holds the integer exponent during number parsing and the integer part of a value in |
&004B–&004C |
zp_fp_ptr |
R/W | Pointer to a packed 5-byte floating-point value (a variable or an FP temporary) for the pack/unpack routines. |
&004D–&004E |
zp_coeff_ptr |
R/W | Pointer to the current coefficient table, used while evaluating the continued-fraction approximations in the trig functions. |
&00FD–&00FE |
zp_error_ptr |
R/W | Pointer to the error block currently being reported (the bytes after a |
&00FF |
zp_escflg |
R/W | ESCFLG — the MOS escape flag. Its top bit is set when Escape is pressed; BASIC polls it between statements, acknowledges it via OSBYTE, and raises the "Escape" error. |
Other
| Address | Name | Access | Description |
|---|---|---|---|
&003C |
zp_fwb_ovf |
FWB overflow byte (&3C), part of |
6502 hardware stack
| Address | Name | Access | Description |
|---|---|---|---|
&0100–&01FF |
hw_stack |
R/W | The 6502 hardware stack (page 1), used normally for JSR/RTS and register saves. A PROC/FN call copies a snapshot of the live stack onto the BASIC value stack and restores it on return, so call nesting is bounded by free stack space rather than a fixed table. |
Resident integers & FP workspace
| Address | Name | Access | Description |
|---|---|---|---|
&0400–&046B |
resint_at |
R/W | The resident integer variables, four bytes each: @% here at &0400, then A%-Z% at &0404-&046B. @% sets the |
&046C–&047F |
fp_temp1 |
R/W | Four 5-byte packed floating-point temporaries: TEMP1 (&046C), TEMP2 (&0471), TEMP3 (&0476) and TEMP4 (&047B). The maths routines stash intermediate reals here while reusing |
&0480–&04FF |
var_ptr_table |
R/W | The dynamic-variable chain-head table: a two-byte head pointer per initial-character class (A-Z, a-z, |
String and line buffers
| Address | Name | Access | Description |
|---|---|---|---|
&0600–&06FF |
string_work |
R/W | The string work area / |
&0700–&07FF |
line_input_buf |
R/W | The line input buffer. The line editor reads a typed line (at the |
Index bases
Addresses used only as an indexing base
— the operand names a base and the byte actually touched is
base + X (or + Y), where the index register is a
caller-supplied offset, never zero. The literal byte at the base address is
never read or written, so these are documented here rather than on the memory
map: they are bases, not locations the ROM owns.
Other
| Base | Name | Description |
|---|---|---|
&0106 |
frame_local_count |
|
&047F |
var_table_base |
|
&04F1 |
for_var_lo |
|
&04F2 |
for_var_hi |
|
&04F3 |
for_type |
|
&04F4 |
for_step0 |
|
&04F5 |
for_step1 |
|
&04F6 |
for_step2 |
|
&04F7 |
for_step3 |
|
&04F9 |
for_limit0 |
|
&04FA |
for_limit1 |
|
&04FB |
for_limit2 |
|
&04FC |
for_limit3 |
|
&04FE |
for_loopback_lo |
|
&04FF |
for_loopback_hi |
|
&0501 |
for_set_ptr_hi |
|
&0502 |
for_set_type |
|
&0503 |
for_set_step0 |
|
&0504 |
for_set_step1 |
|
&0505 |
for_set_step2 |
|
&0506 |
for_set_step3 |
|
&0508 |
for_set_limit0 |
|
&0509 |
for_set_limit1 |
|
&050A |
for_set_limit2 |
|
&050B |
for_set_limit3 |
|
&050D |
for_set_loop_lo |
|
&050E |
for_set_loop_hi |
|
&05A3 |
repeat_loop_lo |
|
&05B7 |
repeat_loop_hi |
|
&05CB |
gosub_return_lo |
|
&05E5 |
gosub_return_hi |
|
&05FF |
strbuf_base |
FOR / REPEAT / GOSUB stacks
| Base | Name | Description |
|---|---|---|
&0500 |
for_stack |
The |
&05A4 |
repeat_stack |
|
&05B8 |
repeat_stack_hi |
High bytes of the |
&05CC |
gosub_stack |
|
&05E6 |
gosub_stack_hi |
High bytes of the |
