HP 21xx
Series
Single-User HP BASIC
Memory Map
 

HP BASIC
Memory Map & Notable Addresses
 
HPBASIC
Interpreter
I/O Package BBL
Boot Loader
PBS
Prepare
BASIC System
 
 
Address
Decimal
Address
Octal
Symbolic
Label
Memory
Contents or Use
PBS
Execution
BASIC
Execution
Referenced
from
0 000000 A
000001 B
000002 JMP 3,I PBS start jmp
000003 016333
000004 HLT 4,C (power fail) link area begin
000005 HLT 5 (parity fault) ..
000006 0 ..
.. 0 .. ..
000027 0 ..
.. ..
63 000077 HLT 077 .. BASIC begin
64 000100 JMP START,I .. ..
000101 PREAD addr of .HSPR [P] .. ..
000102 WRITE addr of TTY.P [P] .. ..
000103 PUNCH addr of .PUNCH [P] .. ..
000104 REED addr of TTY.I [P] .. ..
000105 addr of stop routine [S] .. ..
000106 LWBM LWAM for BOSS [B1] .. ..
000107 BOSS linkage [B2] .. ..
000110 FWAM ptr to first avail. word .. ..
000111 LWAM ptr to last avail. word .. ..
000112 PBUFF * .. ..
000113 PBPTR * .. ..
000114 FWABP * .. ..
000115 FCORE * .. ..
000116 SYMTF * .. ..
000117 SYMTA * .. ..
000120 LSTAK * .. ..
000121 ASBTB addr of CALL subr tbl .. ..
000122 SBTBE addr+1 of CALL subr tbl end .. ..
000123 IMOFF kbd intr disb [P] .. ..
000124 IMON kbd intr enb [P] .. ..
000125 TLINK tty intr [P] .. ..
000126 PLSTR plist addr .. ..
000127 LISTR list dev .. ..
000130 TLSTR list output addr .. ..
000131 .BUFA * .. ..
000132 BADDR * .. ..
000133 CCNT * .. ..
000134 SBUFA * link area end ..
000135 SBPTR * .. <-- FWAM (I/O Pkg)
.. ..
000201 START ptr to ENTRY ..
.. ..
1023 001777 base-page end ..
.. ..
002010 ENTRY BASIC start entry .. <-- jmp from 100
.. ..
4096 010000   ..
.. ..
5729 013141 * BASIC end
013142   user/runtime begin <-- FWAM (BASIC)
.. ..
015073 * I/O 'serial' begin ..
.. .. ..
015677 * I/O 'serial' end ..
.. ..
016333 PBS start entry PBS begin .. <-- jmp from 2,3
.. .. ..
017324 * PBS end ..
.. ..
017346 LWAMP   user/runtime end <-- LWAM
7911 017347 .PNCH PT punch routine I/O 'bufferred' beginI/O Package begin
.. .. ..
017367 LWAMR   .. .. <-- LWAM
017370 .HSPR HS PT read routine .. ..
.. .. ..
017425   .. .. <-- LWAM
017426 TTY.I TTY read routine .. ..
.. .. ..
017445 TTY.P TTY print/punch routine .. ..
.. .. ..
8127 017677 * I/O 'bufferred' end I/O Package end <-- LWM
8128 017700 BBL start entry BBL begin BBL begin
.. .. ..
017777 * BBL end BBL end
8192 020000  
..
16384 040000  
..
24576 060000  
..
32768 100000  
The table presents the layout in memory of the four program elements at play:

Two template TTY I/O drivers are included and initially loaded with PBS, one for the 'serial' and one for the 'bufferred' teletype options. Only one of these will be included in the configured I/O Package. When HPBASIC is running, the I/O Package will reside near the top of memory, just below the Basic Binary Loader. The bufferred driver is initially loaded right where it should be for an 8KW system (as shown). If more core is available, PBS will specify it be relocated to appropriately higher memory. The serial (bit-banged) driver will similarly be relocated as necessary, in an 8KW system it will be relocated to overwrite the initially-loaded bufferred routines.

The HPBASIC interpreter resides near the beginning of memory. When HPBASIC is running, memory between the end of the interpreter and the beginning of the I/O Package - identified respectively as FWAM and LWAM (First and Last Words of Available Memory) - is available for the user BASIC program and runtime needs. PBS configures LWAM to one of several locations depending on which I/O devices were specified as available.

When PBS is loaded, FWAM points to a low address, just enough to include the link area. If the interpreter is to be included in the absolute tape punched by PBS (workflow step 5b), PBS must be loaded before the interpreter. When the interpreter is loaded FWAM is overwritten with a higher value pointing to the first word after the interpreter.

Table Notes:

The colored areas in the execution columns of the table indicate memory locations which are loaded as part of the according PBS, I/O Package or HPBASIC interpreter.

(Note the table areas are not proportionate relative to actual address range.)

[P] These are the links for the interpreter to invoke routines in the I/O Package. They are prepared by PBS and loaded as part of the I/O Package.

[S] This is a link for I/O routines to callback to a stop routine in the interpreter. It is prepared by the interpreter.

[B1] The sources make several references to BOSS. BOSS seems to be some sort of executive. BOSS involvement seems to be limited to starting and quitting HPBASIC. The I/O Package sets LWBM to the same as LWAM. BOSS may adjust LWBM. When the interpreter runs it sets LWAM to the same as LWBM if they differ.

[B2] Not explained.


  Memory Map | Operation Examples
HP BASIC
CTµL | 2116 | I/O Interfaces | Programming Ref | Software | 2116C Refurb
HP 21xx Series
bhilpert
2014 Sep