Following are some of the more important RAM-based variables used by the operating system. Amstrad have expressed an intent always to try and use these locations in subsequent versions of the software, but they are not guaranteeing it. It would be sensible to perform checks by calling firmware routines which return known values to selected addresses and only if the correct values are returned for addresses you wish to use, should then assume they are available to you.
Many of the addresses shown here have little or no explanation other than the name given to them by the program developers. It is entirely up to you to experiment with them and come to your own decision as to their usefulness. Thankfully though, many addresses are fully self-evident and will provide you with a lot of scope for enhancing your own programs.
Address | Name | Size | Comments | |
Hex | Decimal | |||
&B000 | 45056 | copyofmmu0 | &01 | Copy of MMU0 |
&B001 | 45057 | copyofmmu1 | &01 | Copy of MMU1 |
&B002 | 45058 | copyofmmu2 | &01 | Copy of MMU2 |
&B003 | 45059 | copyofmmu3 | &01 | Copy of MMU3 |
&B03B | 45115 | &50 | A small strack which is only used in initialisation. Therefore, you should be able to use this as a temporary storage area when code space is tight. | |
&B08D | 45197 | kbdstate1 | &0A | 1 bit per key: 1=down, 0=up to correspond to the matrix |
&B097 | 45207 | kbdstate2 | &0A | 2nd byte of state |
&B0A1 | 45217 | padkeybuf | &40 | Keyboard buffer |
&B0E1 | 45281 | padnextin | &01 | Offset into padkeybuf |
&B0E2 | 45282 | padnextout | &01 | Next character due out |
&B0E3 | 45283 | padbufempty | &01 | Non-zero if empty |
&B0E4 | 45284 | lastkbdstate | &02 | Saved state |
&B0E6 | 45286 | thiskbdstate | &02 | This state |
&B0E8 | 45288 | caps.state | &01 | 0=ff, &FF=on |
&B112 | 45330 | rptdelay | &01 | Keyboard repeat centiseconds |
&B113 | 45331 | rptrate | &01 | Keyboard delay centiseconds |
&B114 | 45332 | rpttimer | &01 | Count down timer for key repeat |
&B115 | 45333 | keytorepeat | &01 | Key number |
&B116 | 45334 | rptkeystates | &01 | Shift states |
&B12C | 45356 | soundcounter | &01 | Non-zero if playing a tune |
&B12D | 45357 | soundptr | &02 | Pointer to array of frequency, duration |
&B132 | 45362 | poweroffminutes | &01 | Configured time to power off |
&B133 | 45363 | minutesleft | &01 | Minutes left |
&B134 | 45364 | minutecounter | &02 | Minute counter |
&B137 | 45367 | preservecontext | &01 | 0=return to main screen at power on |
&B138 | 45368 | dontpreservecontext | &01 | 1=don't preserve (diagnostics/battery) |
&B139 | 45369 | mainprog | &01 | 6=inbasic, 128=inexternal (foreground program id) |
&B13A | 45370 | currentprinter | &01 | 0 for parallel, 1 for serial |
&b13D | 45373 | wasmenusel | &01 | After KMWAITCHAR this is 1 if menu used, 0 if not |
&B140 | 45376 | sdumpname | &04 | File names s.a, s.b, s.c and so on - for screen dumps |
&B150 | 45392 | d.datebuf | &12 | Date buffer |
&B162 | 45410 | d.asciitime | &0C | hh:mm:ss |
&B16E | 45422 | currentcfg | &4C | Current configuration parameters |
&B1BD | 45501 | g.pos | &01 | Current column number (charout) |
&B258 | 45656 | d.calcmode | &01 | Non-zero if keyboard in calculator mode |
&B259 | 45657 | d.kmexplen | &01 | Expansion string length |
&B25A | 45658 | d.kmexpptr | &02 | Expansion string pointer. |
&B25C | 45660 | d.expbuffer | &02 | Address of expansion key buffer |
&B25E | 45662 | d.expbufptr | &02 | Pointer to free byte |
&B260 | 45664 | d.expbufend | &02 | Last byte in buffer |
&B2A1 | 45729 | macro_buf | &100 | Macro buffer |
&B3A7 | 45991 | - | File selector variables... | |
&B3A7 | 45991 | fs_clicat | &01 | Non-zero if Cat command, not Select |
&B3A8 | 45992 | fs_showsizes | &01 | Non-zero if showing file sizes (pad default=off) |
&B3A9 | 45993 | fs_showsys | &01 | Non-zero if showing system files |
&B3AA | 45994 | fs_curfile | &01 | Current file number offset from top left |
&B3AB | 45995 | fs_topleftfile | &01 | File number displayed top left |
&B3AC | 45996 | fs_numcols | &01 | Number of columns |
&B3AD | 45997 | fs_colwidth | &01 | Width of columns |
&B3AE | 45998 | fs_numshown | &01 | Number of columns shown |
&B3AF | 45999 | fs_maxfiles | &01 | Max files that can be shown |
&B3B2 | 46002 | fs_numfilerows | &01 | Rows of files in CAT command |
&B3B3 | 46003 | fs_startlist | &02 | Start of file list. Zero if doing unsorted list |
&B3B5 | 46005 | fs_startdir | &02 | Start of directory entries |
&B3B9 | 46009 | fs_numfiles | &01 | Number of files in directory |
&B3BA | 46010 | fs_lastshown | &01 | Last file number currently shown |
BBC Basic Main System Variables | ||||
Address | Size | Comments | ||
Hex | Decimal | |||
&A000 | 40960 | &100 | String accumulator | |
&A100 | 41216 | &100 | String input buffer | |
&A200 | 41472 | &6C | Static variables @% to Z% | |
&A2DC | 41692 | &02 | PAGE | |
&A2DE | 41694 | &02 | TOP | |
&A2E0 | 41696 | &02 | LOMEM | |
&A2E2 | 41698 | &02 | Free space pointer | |
&A2E4 | 41700 | &02 | HIMEM | |
&A2E6 | 41702 | &02 | Current line number | |
&A2E8 | 41704 | &02 | TRACE number | |
&A2EA | 41706 | &02 | AUTO number | |
&A2EC | 41708 | &02 | ON ERROR number |