Yellow Pig's BBC Computer Pages

MOS Memory Usage on the Master

Index | Native | Master 512 | Home

Memory Locations used by MOS Vn. 3.20

The following is a list of the locations used by the Master MOS. The information is (I believe) correct for Version 3.20 of the MOS, ie the most common version. I suspect that it will not be very different for other versions of the Master MOS. Some locations certainly are different in the MOS versions used by the Model B and B+.

(All addresses in the following are in hex.)

0 - 8F    Zero-page workspace for the current language, or for the Tube host code if the Tube is active. (When BASIC is the current language it only uses locations 0 to 6F, leaving 70 to 8F available for user programs.)
                                            
90 - 9F   Econet workspace. (Available to user programs on non-Econet machines.)
         
A0 - A7   NMI workspace. Usable only by filing systems which can claim NMIs
         
A8 - AF   General "*" command workspace.
         
B0 - CF   Filing system workspace. The locations between C0 and CF must be preserved between filing system calls.
         
D0 - FF   MOS zero page space:
         
    D0   VDU status byte (see documentation for OSBYTE &75)
    D1   Byte mask for current graphics point
    D2   Text colour "or" mask
    D3   Text colour "eor" mask
    D4   Graphics colour "or" mask
    D5   Graphics colour "eor" mask
    D6,D7   Address of graphics character cell
    D8,D9   Address of text character cell
    DA-E1   Temporary workspace for VDU driver
    E2   CFS status byte
    E3   CFS *OPT byte
    E4-E6   Miscellaneous workspace
    E7   Keyboard auto-repeat countdown timer
    E8,E9   Address of input buffer being used by OSWORD 0
    EA   Serial port timeout counter
    EB   CFS "critical" flag
    EC   Internal key number of last key-press
    ED   Internal key number of last-but-one key-press
    EE   RAM copy of 1MHz bus paging register
    EF   OSBYTE / OSWORD A value
    F0   OSBYTE / OSWORD X value
    F1   OSBYTE / OSWORD Y value
    F2,F3   Address pointer (with Y register) of rest of entered command line
    F4   RAM copy of ROMSEL register
    F5-F7   ROM Filing System 3-byte pointer
    F8,F9   Unused
    FA,FB   General workspace
    FC   Stored value of A-register during interrupts
    FD,FE   Address of byte after last BRK instruction encountered
    FF    Escape flag
         
100 - 1FF   Error message buffer, Tube OS call control block and CPU stack. (The lower part from location 100 upwards is used for error messages by programs in Sideways memory. The middle part (from location 128) is used if the Tube is active as a host control block for OS calls. The upper part is the CPU stack, growing down from location 1FF.)
         
200 - 235   Main vectors:
         
    200,201   USERV – User vector, used with *CODE and *LINE
    202,203   BRKV – BRK vector
    204,205   IRQ1V – Main interrupt vector
    206,207   IRQ2V – Secondary interrupt vector
    208,209   CLIV – OSCLI indirection
    20A,20B   BYTEV – OSBYTE indirection
    20C,20D   WORDV – OSWORD indirection
    20E,20F   WRCHV – OSWRCH indirection
    210,211   RDCHV – OSRDCH indirection
    212,213   FILEV – OSFILE indirection
    214,215   ARGSV – OSARGS indirection
    216,217   BGETV – OSBGET indirection
    218,219   BPUTV – OSBPUT indirection
    21A,21B   GBPBV – OSGBPB indirection
    21C,21D   FINDV – OSFIND indirection
    21E,21F   FSCV – Filing System Control Vector
    220,221   EVENTV – Event vector
    222,223   UPTV – User printer vector
    224,225   NETV – Econet vector
    226,227   VDUV – VDU vector
    228,229   KEYV – Keyboard access vector
    22A,22B   INSV – Buffer insert vector
    22C,22D   REMV – Buffer remove vector
    22E,22F   CNPV – Buffer count / purge vector
    230,231   IND1V – Spare vector 1
    232,233   IND2V – Spare vector 2
    234,235   IND3V – Spare vector 3
         
236 - 28F   Main MOS Variables (as accessed by Osbytes A6 to FF):
         
    236,237   Start address of MOS variables
    238,239   Address of ROM pointer table
    23A,23B   Address of ROM information table
    23C,23D   Address of keyboard translation table
    23E,23F   Address of VDU variables origin
    240   CFS timeout counter
    241   Input source (0 - keyboard, 1 - RS423)
    242   Keyboard semaphore (0 - disabled, FF - enabled)
    243   ROM polling semaphore
    244   OSHWM (MSB only)
    245   RS423 interpretation status (0 - as keyboard, 1 - default)
    246   NOIGNORE status (bit 7 set if no ignore character)
    247   CFS/ROM filing system switch (0 - CFS, 1 - ROM)
    248   RAM copy of video ULA control register
    249   RAM copy of video ULA palette register
    24A   Sideways memory slot active at last BRK
    24B   Sideways memory slot containing BASIC
    24C   Current ADC channel number
    24D   Maximum ADC channel number
    24E   ADC conversion type (0 or C - 12 bits, 8 - 8 bits)
    24F   RS423 busy flag (bit 7 set if busy)
    250   RAM copy of serial ACIA control register
    251   Flash counter
    252   First colour duration
    253   Second colour duration
    254   Keyboard auto-repeat delay (0 for no repeat)
    255   Keyboard auto-repeat rate
    256   *EXEC file handle
    257   *SPOOL file handle
    258   Break and Escape effect (bit 0 set - Escape disabled, bit 1 set - memory will be cleared on Break)
    259   Keyboard status (0 - enabled, non-0 - disabled)
    25A   Keyboard shift/ctrl status byte (see documentation for OSBYTE &CA)
    25B   RS423 input buffer minimum space
    25C   RS423 ignore flag (0 - input enabled, non-0 - disabled)
    25D   RS423 destination (0 - to RS423, 1 - to cassette)
    25E   Econet OS call interception status
    25F   Econet input interpretation status
    260   Econet output interpretation status
    261   Reserved (This location was used for speech suppression status on Model B)
    262   Sound suppression status (0 - sound enabled, non-0 - disabled)
    263-266   Bell (VDU 7) information (channel, ampl/env., frequency, duration)
    267   Startup message and !BOOT error action status. Note: There is an error in the description of OSBYTE D7 in the Reference Manual.
   bit 0    !BOOT error status. 0 - lock up on ROM error; 1 - lock up on disk error
  bit 7   Start up message status. 0 - suppress message; 1 - normal message
    268   Length of soft key string
    269   Paged mode line count
    26A   Length of VDU queue
    26B   Tab key code
    26C   Escape character
    26D-270   Interpretation of input values C0 to FF (values not normally generated by keypresses). Each byte controls a block of &10 values. Meanings: 0 - ignore; 1 - use soft key expansion; 2 and above - return values from this number upwards.
    271-274   Interpretation of soft keys (alone, with Shift, with Ctrl and with both). Meaning as for previous
    275   Escape key status (0 - escape enabled, non-0 - key gives ASCII value)
    276   Escape side-effects status (0 - enabled, non-0 - disabled). See documentation of OSBYTE &E6 for what the effects are.
    277-279   IRQ bit masks for user 6522, 6850, system 6522
    27A   Tube presence flag (0 - no tube, FF - tube present)
    27B   Reserved for speech system (Speech system presence flag)
    27C   Character destination status (as set by *FX 3)
    27D   Cursor editing status (as set by *FX 4)
    27E   Numeric keypad interpretation base number (This is the value returned by keypad 0. Other keypad keys return values fixed relative to this.)
    27F   *SHADOW state (0 - shadow on, non-0 - as specified by entered mode number)
    280   Country flag (0 - UK; 1 - USA)
    281   User flag (as used by *FX 1)
    282   RAM copy of serial ULA register
    283   Timer switch state (swapped between 5 and A)
    284   Soft key consistency flag
    285   Printer type (as set by *FX 5)
    286   Printer ignore character
    287-289   Break intercept vector
    28A   Memory written to by VDU driver (shadow or main)
    28B   Memory displayed (shadow or main)
    28C   Sideways memory slot of current language
    28D   Last Break type (0 - soft, 1 - power on, 2 - hard)
    28E   Effect of Shift on numeric keypad (0 - enabled, non-0 - disabled)
    28F   Startup options
         
290 - 2FF   Miscellaneous MOS variables, etc.:
         
    290,291   *TV values
    292-296   Main timer value (1st copy)
    297-29B   Main timer value (2nd copy)
    29C-2A0   Interval timer value
    2A1-2B0   Paged Sideways memory type table
    2B1,2B2   Inkey countdown counter
    2B3-2B5   OSWORD 0 workspace
    2B6-2B9   Last ADC values (LSBs)
    2BA-2BD   Last ADC values (MSBs)
    2BE   Last ADC channel to finish conversion
    2BF-2C8   Event enable flags (as set by *FX 14)
    2C9   Auto-repeat count for next key
    2CA-2CC   Two-key rollover workspace
    2CD   Sound semaphore (0 means that an envelope is being processed)
    2CE-2D6   Buffer busy flags (bit 7 set if corresponding buffer empty)
    2D7-2DF   Buffer removal pointers
    2E0-2E8   Buffer insertion pointers
    2E9,2EA   Block size of CFS open input file
    2EB   Block flag for current CFS open input file
    2EC   Last character of current block of CFS open input file
    2ED   Unused
    2EE-2FF   OSFILE control block for *LOAD and *SAVE
         
300 - 37F   VDU variables:
         
    300-307   Graphics window (internal co-ordinates)
    308-30B   Text window
    30C-30F   Graphics origin (external co-ordinates)
    310-313   Graphics cursor position (external co-ordinates)
    314-317   Previous graphics cursor (internal co-ordinates)
    318,319   Text cursor position
    31A   Line within current graphics character of current graphics point
    31B-323   VDU queue
    324-327   Graphics cursor position (internal co-ordinates)
    328-349   General graphics co-ordinate workspace
    34A,34B   Address of text cursor (as seen by 6845)
    34C,34D   Number of bytes in character row of text window
    34E   Address of bottom of screen memory (MSB)
    34F   Number of bytes used by a single character
    350,351   Address of top left of screen display
    352,353   Number of bytes in character row of whole screen
    354   Size of screen memory (MSB)
    355   Current screen mode (0 to 7 only – no "shadow" component)
    356   Screen memory map type (0 - 20kb modes; 1 - 16kb; 2 - 10kb; 3 - 8kb; 4 - teletext)
    357,358   Foreground and background text colour masks
    359   Foreground/background flag for graphics plotting (0 - foreground; 8 - background)
    35A   Current graphics plot mode
    35B   Current graphics foreground plot mode
    35C   Current graphics background plot mode
    35D,35E   Jump vector containing address of routine for processing current VDU sequence
    35F   Setting of 6845 cursor start register
    360   Number of logical colours (less 1)
    361   Pixels per byte (less 1)
    362,363   Masks for leftmost and rightmost pixels in a byte
    364,365   Output cursor position when cursor editing
    366   Cursor control flags (as set by VDU 23,16)
    367   Dot pattern for dotted lines
    368   Current state of dot pattern
    369-36B   Flags for solid/ECF ("Extended Colour Fill") plotting
    36C   "Column 81" flag
    36D,36E   Graphics foreground and background colours
    36F-37E   RAM copy of current palette
    37F   Reserved
         
380 - 3DF   Cassette filing system workspace
         
3E0 - 3FF   Keyboard input buffer
         
400 - 7FF   Current language main workspace, or principal Tube host code if the Tube is active
         
800 - 87F   Sound processing workspace
         
880 - 8BF   Printer buffer
         
8C0 - 8FF   Storage space for envelopes 1 to 4
         
900 - 9BF   Storage space for envelopes 5 to 16
     or First part of cassette output buffer
     or RS423 output buffer
         
9C0 - 9FF   Rest of cassette output buffer
         
A00 - AFF   Cassette input buffer
     or RS423 input buffer
         
B00 - CFF   Econet workspace
         
D00 - D5F   NMI main routine
         
D60 - D7F   Econet workspace
         
D80 - D91   Unused
         
D92 - D9E   Workspace for Mouse (or Trackerball)
         
D9F - DEF   Extended vectors
         
DF0 - DFF   Paged sideways ROM/RAM workspace. One byte each (usually pointing to private workspace)
         
E00 - 7FFF   Main memory
         

Index | Native | Master 512 | Home