Skip to main content

Memory map



Overview #

The following memory map describes the addresses used by peek and poke.

From To Description
0000 0879 Data registers — 8 bytes each, in following order: 00-09,F,10-19,1F,…
0880 2046 Used by system routines
2047 8191 Program memory. Programs are sorted in memory by creation time and are not fragmented.
8192 9979 Unused.
9980 9998 Pseudo addresses used for system tests - will delete memory of addressed.
9999 9999 Centronics output port. Anything written here will be send to the Centronics port.

Data registers #

Numbers are stored in data memory in BCD (binary-coded decimal) form: each decimal digit is stored as hexadecimal digit. First byte of each register is unsigned exponent. If first byte’s first digit is A, then the register contains number in fraction form (integer part, numerator and denominator). Second byte’s second digit contains signs (exponent sign / mantissa sign: “+/+"-1, “−/+"-0, “+/−”-6, “−/−”-5), first digit contains 12th mantissa digit. Note about exponent: if first byte is 97h and second byte’s second digit is 0 or 5, then exponent is “−3”, not “−97”. The order of mantissa digits is following: 1st — 8th byte’s 2nd digit, 2nd — 7th byte 1st digit, etc. If one of the digits is hexadecimal B — it is fraction separator (between integer and numerator or between numerator and denominator).

System Routines #

The following table contains the know addresses of data used by the system routines.

From To Description
0891 0891 Set-up cassette interface speed. See the original manual for details.
0892 0893 Set-up RS232 interface. See the original manual for details.
1241 1242 an address of last byte used by programs, increased by two, is stored here (in HEX, correct decimal result is “PEEK 1241 + PEEK 1242 × 256 =”).
1244 1244 number of currently executed program or subprogram (in BCD: 16 means program number is 10).
1245 1246 address of the first byte of current program’s body (in HEX).
1251 1251 number of items in subroutine stack (BCD).
1252 1384 subroutine stack data: one item uses 7 bytes, with maximum of 19 items; item’s first byte is program number (BCD), second and third — entrance address (address of the first byte of GSB-to-next-program-in-stack command), fifth and sixth — this program’s body first byte address.
1392 1407 Upper Display Line.

Program memory #

Each program’s first byte contains number from 0 to 9 (program number), or 234 (it means that program number is more than ten; in this case program number’s last digit is the following byte).

Next byte may contain 236, which means that program is protected by password (next 4 bytes). The password (if exists) is followed by program body (note: if the program has a password, then addresses 1245 and 1246 contain the address of the byte with 236 in it, so the example of self-modifying program will not work correctly if it is password-protected, because it doesn’t coun’t this address change).

The last byte of the last program is followed by the byte with 255.

Pseudoaddresses #