PDP11 BBC BASIC Memory overview =============================== 0000 +--------------------------------------------+ | BASIC interpreter code | +============================================+ 0000 -----------------+ | TTY settings 16 bytes | | +--------------------------------------------+ 0010 | | Keyboard workspace 12 bytes | | Unix +--------------------------------------------+ 001C | interface | TRAP buffer and CHAROUT buffer 10 bytes | | +--------------------------------------------+ 0036 | | MEMBOT, MEMTOP 4 bytes | | +============================================+ 003A = &3A bytes ----+ | Any future expansion will be here | | +--------------------------------------------+ -0006 | | RND workspace 6 bytes | | +--------------------------------------------+ 0000 <-- always ---+ | | String buffer 256 bytes | PAGE-&300 | | +--------------------------------------------+ 0100 | | | Command buffer + MOS Buffer 256 bytes | | | +--------------------------------------------+ 0200 | | Integer variables 108 bytes | | +--------------------------------------------+ 026C | | Variable pointers 116 bytes | | +--------------------------------------------+ 02E0 | | Memory pointers 12 bytes | | +--------------------------------------------+ 02EC | | Program lines 8 bytes | | +--------------------------------------------+ 02F4 | | Program pointers and flags 12 bytes | | +============================================+ 0300 = &306 bytes ---+ PAGE | Program text | | | TOP +--------------------------------------------+ LOMEM | Variables | | | +--------------------------------------------+ END | Unused memory | | | +--------------------------------------------+ r6 | Stack | | | +--------------------------------------------+ HIMEM | | | PDPTube Unix | +----------------------+---------------------+ | FExx command line | xx00 end of memory | +----------------------+ eg E000 | | FF00 error buffer | FC00 | | FFFF default escflg | FFxx command line | FFFF +----------------------+---------------------+ Internal memory: ^@%-512 : String buffer, string can be fetched with $(^@%-512) ^@%-256 : Command buffer, string can be fetched with $(^@%-256) ^@% : Integer variables ^@%+108 : Pointers to dynamic variables PDP11 BBC BASIC Memory details ------------------------------ +--------------------------------------------+ | Unix interface variables | | | | additional entries may go here | | | | TTY settings - 16 bytes | may or | SV_TTY - Current TTY settings | may | SV_OSTTY - Host's tty flags | not be | SV_IOCTL - Current tty characters | present | SV_OSIOCTL - Host's tty Intr+Quit chars | | | | Keyboard workspace - 12 bytes | | | | TRAP I/O buffers - 10 bytes | may or | TRAP_BUF - TRAP and four parameters | may | CHAR_BUF - Character I/O buffers | not be | | present ^@%-&20C | MEMBOT - absolute memory limits | ^@%-&20A | MEMTOP - 4 bytes | +--------------------------------------------+ | BASIC workspace | | | | additional entries may go here | | | ^@%-&206 PAGE-&306 | SV_RAND - RND seed | ^@%-&202 PAGE-&302 | SV_RAND4 - Fifth byte of RND seed | ^@%-&201 PAGE-&301 | SV_STEP - AUTO step | | | ^@%-&200 PAGE-&300 | String buffer - 256 bytes | ^@%-&100 PAGE-&200 | Command buffer - 256 bytes | ^@%-&012 PAGE-&112 | MOS_BUF | ^@% PAGE-&100 | Integer variables - 108 bytes |<--+ ^@%+&06C PAGE-&094 | Pointers to dynamic variables - 116 bytes | | | | | | Memory pointers - 12 bytes | | ^@%+&0E0 PAGE-32 | SV_PAGE - PAGE - start of program | fixed ^@%+&0E2 PAGE-30 | SV_TOP - TOP - end of program | &100 ^@%+&0E4 PAGE-28 | SV_LOMEM - LOMEM - start of variables | bytes ^@%+&0E6 PAGE-26 | SV_VAREND - END - end of variables | | ^@%+&0E8 PAGE-24 | SV_STACK - r6 - bottom of local stack | | ^@%+&0EA PAGE-22 | SV_HIMEM - HIMEM - top of stack/memory | | | | | | Program lines - 8 bytes | ^@%+&0EC PAGE-20 | SV_LINE - Current line number | ^@%+&0EE PAGE-18 | SV_TRACE - TRACE line number | ^@%+&0F0 PAGE-16 | SV_AUTO - AUTO line number | ^@%+&0F2 PAGE-14 | SV_ERL - Line number error occured in | | | | Program pointers - 6 bytes | ^@%+&0F4 PAGE-12 | SV_ONERR - Points to after ON ERROR | ^@%+&0F6 PAGE-10 | SV_FAULT - Last error | ^@%+&0F8 PAGE-8 | SV_DATA - DATA pointer | | | | Program settings - 6 bytes | ^@%+&0FA PAGE-6 | SV_COUNT - COUNT | ^@%+&0FB PAGE-5 | SV_WIDTH - WIDTH | ^@%+&0FC PAGE-4 | SV_OPTIONS - LISTO and OPT options | ^@%+&0FD PAGE-3 | SV_ERR - ERR | ^@%+&0FE PAGE-2 | SV_SYS - I/O flags | | ^@%+&0FF PAGE-1 | SV_ESCFLG - Escape flag | | +--------------------------------------------+ | ^@%+&100 PAGE | Approx &3800 on PDPTube | --+ | &4000 on Unix | | | TOP +--------------------------------------------+ LOMEM | Variables | | | +--------------------------------------------+ END | Unused memory | | | +--------------------------------------------+ r6 | Stack | | | +--------------------------------------------+ HIMEM | | | PDPTube Unix | +----------------------+---------------------+ | FExx command line | xx00 end of memory | +----------------------+ eg E000 | | FF00 error buffer | FC00 | | FFFF default escflg | FFxx command line | FFFF +----------------------+---------------------+