Skip to main content
© Chaos

UNDOCUMENTED VARIABLES by Richard Karsmakers

Several months back,  Frank and myself already went digging  into 
the ST's ROM and came up with some interesting  things.  Now,  we 
have done some more investigating and again want to offer you  an 
even larger list of undocumented system variables.

Warning:  Since  Atari has made significant changes to the OS  of 
the new MEGA ST (stupid,  stupid),  many of these locations  will 
probably  have changed now.  The MEGA ST is not very much  enough 
compatible  and all entertainment software will still be  written 
for  the ST,  so I advise you only to use these system  variables 
when necessary (and if possible not in programs that also need to 
work on MEGA ST).

$502           Hardcopy (hardcopy routine vector)      L
$506           listin (parallel port status routine)   L
$50A           Lstout/Prt_vec
               (output char. to parallel port routine) L
$50E           Auxostat (RS-232 output status routine) L
$512           Auxout (RS-232 output routine)          L

$840*          Pathname buffer
$93A           Return address of the auto files        L
$93E           Pathname address (/auto/*.prg)          L
$942           Filename address (/*.prg)               L
$946           DMA address                             L
$964*          Filename in autofolder buffer
$972*          Whole name buffer
 
HARDCOPY ROUTINE VARIABLES

$992           Buffer for "_v_bas_ad" when hardcopy    L
$996           Offset                                  W
$998           Screen width                            W
$99A           Screen height                           W
$99C           Left margin                             W
$99E           Right margin                            W
$9A0           Buffer for "sshiftmd"                   W
$9A2           Quality mode                            W
$9A4           Color palette address                   L
$9A8           Printer table                           W
$9AA           Parallel/serial mode flag               W
$9AC           Mask pointer                            W
MEMORY USED BY THE FLOPPIES

$9B0           Retrycnt (Retry count)                  W
$9B2           Write protect status                    W
$9B4           Wplatch (Status unsure?)                W
$9B6           Acctim (Access time)                    L
$9BE           Motor on flag                           B
$9C0           Deslflg (Deselect flag)                 W
$9C2           Cdev (Device number)                    W
$9C4           Ctrack (Track number)                   W
$9C6           Csect (Sector number)                   W
$9C8           Cside (Side number)                     W
$9CA           Ccount (Sector number)                  W
$9CC           CDMA (DMA buffer for bad sector list)   B
$9CD           DMA high                                B
$9CE           DMA mid                                 B
$9CF           DMA low                                 B
$9D0           Edma (End of DMA address)               L
$9D4           Spt (Sectors per Track for format)      W

$9D6           Interlv (Interleave factor for format)  W
$9D8           Virgin (Default fill value for format)  W
$9DB           DMA Address                             B
$9DC           DMA Address                             B
$9DD           DMA Address                             B
$9DE           Default error                           W
$9E0           Currerr (Disk Drive TOS error number)   W

$A06           Address DSB0 (Drive A)                  L
$A0A           Address DSB1 (Drive B)                  L

BUFFERS

$A0E*          RS-232 input buffer

$B0E*          RS-232 output buffer

$C0E*          Keyboard buffer

$D0E*          MIDI buffer

$D8E           Iorec for RS232                         L
$DB0           Iorec for Keyboard                      L
$DBE           Iorec for MIDI                          L
$DCC           Keyboard/MIDI table                     L
$DD0           Pointer to Keyboard error routine       L
$DD4           Pointer to MIDI error routine           L
$DD8           Statvec (IKBD Status package)           L
$DDC           Mousevec (Mouse action)                 L
$DE0           Jdostime (Time vector)                  L
$DE4           Joyvec (Joystick action)                L
$DE8           MIDI sys-vector                         L
$DEC           IKBD sys-vector                         L
$DF0           Keyboard status                         B
$DF1           IKBD index                              B
$DFE           Mouse position                          B

$E01           Pointer to clock time buffer            L
$E07           Joystick data                           B
$E0A           New time                                L
$E0E           Time to be converted                    L
$E18           Pointer to end of time buffer/mouse
                emulator buffer                        L
$E1B           Shift status                            B
$E20           Pointer to shifted keyboard table       L
$E28           Mouse buffer
$E39           Repeat flag                             B
$E3C           Keyboard delay #1                       B
$E3D           Keyboard delay #2                       B
$E3E           Last time                               L

$E44           Music data pointer (for Xbios 32 )      L
$E48           Temporary storage register (Xbios 32)   L

$E4A           RS232 printer check flag                B
$E4C           Handshake flag                          B

$167A - $1879  Sector buffer (boot buffer)/also used as
                internal PTSIN array

$16A2          Horizontal Alignment                    W
$16A4          Vertical Alignment                      W

MEMORY USED FOR TEXT OUPUT WITH VDI FUNCTIONS 8 AND 11

$16A6          Text width in pixels                    W
$16A8          Text heigth in pixels                   W
$16AA          X-difference for inter-word spacing     W
$16AC          Y-difference for inter-word spacing     W
$16AE          Rest counter for inter-word spacing     W
$16B0          X-rest for inter-word spacing           W
$16B2          Y-rest for inter-word spacing           W
$16B4          X-diference for inter-character spacing W
$16B6          Y-difference for inter-character spac.  W
$16B8          Rest counter for inter-character spac.  W
$16BA          X-rest for inter-character spacing      W
$16BC          Y-rest for inter-character spacing      W

$16BE          ???                                     W

$197A - $1A7A  Internal copy of PTSIN Array         128W

$25AE          Start angle                             W
$25B0          Current font address                    L
$25B4          Part of circle length                   W
$25BC          End angle                               W
$25BE          Counter                                 W
$25C0          Y-maximum for filled area               W
$25C2          Y-minimum for filled area               W
$25C4                                                  W

$25C8          Begin style                             W
$25CA          End style                               W
$25CC          Color index for polygon fill            W
$25CE          Fill perimeter visibility               W

$25D8          X-coördinate of circle middle           W
$25DA          Radius x                                W
$25DE          Y-coördinate of circle middle           W
$25E0          Radius y                                W

SPRITE DEFINITION BLOCK

$25E2          X-offset action point                   W
$25E4          Y-offset action point                   W
$25E6          Format flag (XOR/VDI)                   W
$25E8          Background color                        W
$25EA          Foreground color                        W
$25EC          Background pattern 0                    W
$25EE          Foreground pattern 0                    W
$25F0          Background pattern 1                    W
$25F2          Foreground pattern 1                    W
$25F4          Background pattern 2                    W
$25F6          Foreground pattern 2                    W
$25F8          Background pattern 3                    W
$25FA          Foreground pattern 3                    W
$25FC          Background pattern 4                    W
$25FE          Foreground pattern 4                    W
$2600          Background pattern 5                    W
$2602          Foreground pattern 5                    W
$2604          Background pattern 6                    W
$2606          Foreground pattern 6                    W
$2608          Background pattern 7                    W
$260A          Foreground pattern 7                    W
$260C          Background pattern 8                    W
$260E          Foreground pattern 8                    W
$2610          Background pattern 9                    W
$2612          Foreground pattern 9                    W
$2614          Background pattern 10                   W
$2616          Foreground pattern 10                   W
$2618          Background pattern 11                   W
$261A          Foreground pattern 11                   W
$261C          Background pattern 12                   W
$261E          Foreground pattern 12                   W
$2620          Background pattern 13                   W
$2622          Foreground pattern 13                   W
$2624          Background pattern 14                   W
$2626          Foreground pattern 14                   W
$2628          Background pattern 15                   W
$262A          Foreground pattern 15                   W

EXTENDED WORKSTATION INFORMATION

$262C          Screen type                             W
$262E          Number of background colors in colpal   W
$2630          Supported text effects                  W
$2632          Raster scaling                          W
$2634          Number of bit planes                    W
$2636          Lookup table support                    W
$2638          Performance factor                      W
$263A          Contour fill possibility                W
$263C          Text rotation possibility               W
$263E          Number of writing modes                 W
$2640          Level input possibility                 W

$2642          Text alignment possibility              W
$2644          Inking possibility                      W
$2646          Rubberbanding possibility               W
$2648          Maximal number of coördinates for
                polyline, polymarker and fill          W
$264A          Maximal size of INTIN                   W
$264C          Number of mouse buttons                 W
$264E          Style for wide lines                    W
$2650          Writing modes for wide lines            W
$2652 - $2684  Reserved                              26W

WORKSTATION INFORMATION

$2686          Screen width in pixels                  W
$2688          Screen height in pixels                 W
$268A          Exact scaling possibility               W
$268C          Width of a pixel in micrometer          W
$268E          Height of a pixel in micrometer         W
$2690          Number of characters heights            W
$2692          Number of line types                    W
$2694          Number of line widths                   W
$2696          Number of marker types                  W
$2698          Number of marker sizes                  W
$269A          Number of textfaces                     W
$299C          Number of patterns                      W
$299E          Number of hatch styles                  W
$26A0          Number of predefined colors             W
$26A2          Number of GDPs                          W
$26A4          GDP 1 - Rectangle                       W
$26A6          GDP 2 - Part of circle                  W
$26A8          GDP 3 - Piece of pie                    W
$26AA          GDP 4 - Circle                          W
$26AC          GDP 5 - Ellipse                         W
$26AE          GDP 6 - Part of ellipse                 W
$26B0          GDP 7 - Part of elliptical pie          W
$26B2          GDP 8 - Rounded rectangle               W
$26B4          GDP 9 - Filled rounded rectangle        W
$26B6          GDP 10 - Specified graphics text        W
$26B8          GDP 1 attribute                         W
$26BA          GDP 2 attribute                         W
$26BC          GDP 3 attribute                         W
$26BE          GDP 4 attribute                         W
$26C0          GDP 5 attribute                         W
$26C2          GDP 6 attribute                         W
$26C4          GDP 7 attribute                         W
$26C6          GDP 8 attribute                         W
$26C8          GDP 9 attribute                         W
$26CA          GDP 10 attribute                        W
$26CC          Color possibility                       W
$26CE          Text rotation possibility               W
$26D0          Area fill possibility                   W

$26D2          Cell array possibility                  W
$26D4          Number of colors obtainable             W

$26D6          Number of locator devices               W
$26D8          Number of valuator devices              W
$26DA          Number oh choice devices                W
$26DC          Number of string devices                W
$26DE          Workstation type                        W

MOUSE DATA

$26E0          Mouse X-position                        W
$26E2          Mouse Y-position                        W
$26E4          Mouse show/hide flag                    W
$26E6          Mouse button status                     W

RGB INTENSITIES FOR COLORS 0-15

$26E8          Red 0                                   W
$26EA          Green 0                                 W
$26EC          Blue 0                                  W
$26EF          Red 1                                   W
$26F0          Green 1                                 W
$26F2          Blue 1                                  W
$26F4          Red 2                                   W
$26F6          Green 2                                 W
$26F8          Blue 2                                  W
$26FA          Red 3                                   W
$26FC          Green 3                                 W
$26FE          Blue 3                                  W
$2700          Red 4                                   W
$2702          Green 4                                 W
$2704          Blue 4                                  W
$2706          Red 5                                   W
$2708          Green 5                                 W
$270A          Blue 5                                  W
$270C          Red 6                                   W
$270E          Green 6                                 W
$2710          Blue 6                                  W
$2712          Red 7                                   W
$2714          Green 7                                 W
$2716          Blue 7                                  W
$2718          Red 8                                   W
$271A          Green 8                                 W
$271C          Blue 8                                  W
$271E          Red 9                                   W
$2720          Green 9                                 W
$2722          Blue 9                                  W
$2724          Red 10                                  W
$2726          Green 10                                W
$2728          Blue 10                                 W
$272A          Red 11                                  W
$272C          Green 11                                W
$272E          Blue 11                                 W
$2730          Red 12                                  W
$2732          Green 12                                W
$2734          Blue 12                                 W
$2736          Red 13                                  W
$2738          Green 13                                W
$273A          Blue 13                                 W
$273C          Red 14                                  W
$273E          Green 14                                W
$2740          Blue 14                                 W
$2742          Red 15                                  W
$2744          Green 15                                W
$2746          Blue 15                                 W
WORKSTRATION PTSOUT INFO

$2748          Minimal character width                 W
$274A          Minimal character heigth                W
$274C          Maximal character width                 W
$274E          Maximal character heigth                W
$2750          Minimal line width                      W
$2752          0                                       W
$2754          Maximal line width                      W
$2756          0                                       W
$2758          Minimal marker width                    W
$275A          Minimal marker height                   W
$275C          Maximal marker width                    W
$275E          Maximal marker height                   W

$2766          ASCII-and scan code of pressed key      W
$2768          Input mode, choice                      W
$276A          Virtual workstation parameter address   L
$276E          Fontaddress of default system font face
                table                                  L
$2772          Address of 6*6 font in RAM              L
$2776          Address of 8*8 font in RAM              L
$277A          Font address of loaded font             L
$277E          Font address                            L
$2782          Number of (system) text faces           W

$2786          Input mode, locator                     W

$27DA          Input mode, string                      W
$27DC          Input mode, valuator                    W
$27DE          Mouse flag (mousebutton pressed, mouse
                move)                                  W
$27E0          Cursor on flag                          W
$27E2          Address of mouse coördinates            L

$27E7          Mouse update flag                       B
$27E8          Return address of GEMDOS call           L
$27EC          Address of save area for cursor pos.    L

SPRITE SAVE BUFFER

$28F8          Timer Interrupt                         L
$28FC          Old vector timer interrupt              L
$2900          Button change vector (from mouse)       L
$2904          Cursor change vector                    L
$2908          Mouse movement vector                   L

VDI ESC_VARIABLES

$290C          Character height                        W
$290E          Maximal cursor column                   W
$2910          Maximal cursor line                     W
$2912          Bytes per character line                W
$2914          Background color                        W
$2916          Character color                         W
$2918          Screen address of cursor                L
$291C          Offset in bytes                         W
$291E          Current cursor column                   W
$2920          Current cursor line                     W
$2922          Load cursor flash rate flag             B
$2923          Cursor flash counter                    B
$2924          Pointer to font data                    L
$2928          Largest ASCII code in font              W
$292A          Lowest ASCII code in font               W
$292C          Form_width (width of a font)            W
$292E          Screen width in bits                    W
$2930          Pointer to font offset data             L
$2934          Cursor flag                             B
                Bit 0 = cursor flash on/off
                Bit 1 = cursor phase
                Bit 2 = Cursor on/off
                Bit 3 = line wrap on/off
                Bit 4 = reverse on/off
                Bit 5 = position saved yes/no
                Bit 6 = update flag
$2936          Screen height in bits                   W
$2938          Bytes per screen line                   W

LINE A VARIABLES (This might be the notorious VDIBASE)

$293A          V_planes (Number of bit planes)         W
$293C          V_lin_wr (Bytes per screen line)        W
$293E          Address of CONTRL array                 L
$2942          Address of INTIN array                  L
$2946          Address of PTSIN array                  L
$294A          Address of INTOUT array                 L
$294E          Address of PSTOUT array                 L
$2952          _Fg_bp_1                                W
$2954          _Fg_bp_2                                W
$2956          _Fg_bp_3                                W
$2958          _Fg_bp_4                                W
$295A          _Lst_lin                                W
$295C          _Ln_mask (VDI line style)               W
$295E          _Wrt_mode (writing mode)                W
$2960          _X1                                     W
$2962          _Y1                                     W
$2964          _X2                                     W
$2966          _Y2                                     W
$2968          _Patptr (pointer to fill pattern)       L
$296C          _Patmsk (fill pattern mask)             W
$296E          _Multifill (multi-plane fill flag)      W
$2970          _Clip (clipping flag)                   W
$2972          _Xmn_clip                               W
$2974          _Ymn_clip                               W
$2976          _Xmx_clip                               W
$2978          _Ymx_clip                               W
$297A          _Xacc_dda                               W
$297C          _Dda_inc                                W
$297E          _T_sclsts                               W
$2980          _Mono_status                            W
$2982          _Sourcex                                W
$2984          _Sourcey                                W
$2986          _Destx                                  W
$2988          _Desty                                  W
$298A          _Delx                                   W
$298C          _Dely                                   W
$298E          _Fbase                                  L
$2992          _Fwidth                                 W
$2994          _Style                                  W
$2996          _Litemask                               W
$2998          _Skewmask                               W
$299A          _Weight                                 W
$299C          _R_off                                  W
$299E          _L_off                                  W
$29A0          _Scale                                  W
$29A2          _Chup                                   W
$29A4          _Text_fg                                W
$29A6          _Scrtchp                                L
$29AA          _Scrpt2                                 W
$29AC          _Text_bg                                W
$29AE          _Copytran                               W
$29B0          Address of a routine for contour fill   L

$29B4          Maximum access time (*20 Ms)            L
$29B8          Last random number                      L

USED WITH HARDCOPY

$29BC          Printer port flag                       B
$29BE          P_blkptr (Pointer to buffer memory for
                hardcopy)                              L
$29C2          P_offset                                W
$29C4          P_width                                 W
$29C6          P_height                                W
$29C8          P_left                                  W

$29CA          P_write                                 W
$29CC          P_srcres (Screen resolution)            W
$29CE          P_destres (Printer resolution)          W
$29D0          P_colpal (pointer to color palette)     L
$29D4          P_type                                  W
$29D6          P_port                                  W
$29D8          P_masks (default mask)                  L

$4150          Blue level for color printer (hardcopy) W
$415C - $4147  8*8 font header
$4DB8          Address of BPB                          L
$4DBA          ????
$5220*         Directory buffer

$5622          Mark diskette number                    W
$5624          Red level for color printer (hardcopy)  W

$575E          Atari Color Matrix Printer flag         B

$5780          Epson B/W Matrix Printer flag           B
$578C*         Workstation Parameter buffer
$5FE4          Medium resolution indicator (f. hardcop)B
$5FE6          High resolution indicator (for hardcopy)B
$5FE8          Green level for color printer (hardcopy)W
$5FFE          Quality mode flag (for hardcopy)        B

$6032 - $6079  8*16 System Font header
$609A          Low resolution indicator (for hardcopy) B

$609C          Atari Daisywheel Printer flag           B

The  following conventions were used in this  table:  First,  the 
address  is given in hexadecimal notation.  When a '*'  is  added 
after the address,  this means that it is no numeric variable but 
a piece of memory (often used to store a lot of numeric variables 
or  strings).  In  the middle column,  you'll find a  very  brief 
description.  The  rightmost column beholds the  variable  length 
character: B means byte, W means word and L means longword.

The  information  displayed  in this article was  taken  from  ST 
Intern  and Atari ST Gem,  both from Data Becker,  as well as  my 
personal digging in the operating system (sometime together  with 
Frank).

Now  for  some practical use of some  of  these  variables.  When 
checking the variables that are used by the floppies,  is is very 
handy  to  use $9C2 to $9C8.  If you can  check  these  variables 
constantly  (using an interrupt routine) you can always  keep  an 
eye on which drive,  side, track and sector the drive is working. 

In your own programs,  you might just want to check if the  write 
protect  notch is closed or not (so that you can or cannot  write 
on a disk).  These are the possible values of the WP Status  flag 
at $9B2 (which is a word):

 %0000000000000000          Write on A as well as B
 %1111111100000000          Write possible only on B
 %0000000011111111          Write possible only on A
 %1111111111111111          No writing possible at all

This is a 'read-only' variable. You cannot simply POKE a value in 
it  so that you can write on write-protected disks,  for  example 
(that would have been nice, wouldn't it?). This variable is handy 
to use in a copy program or something like that.

When you're writing a game, you'll undoubtedly want to know where 
to get joystick data.  On location 3593 (decimal),  you'll find a 
byte with the following bits:

 %00000000
      ^^^^
      ||||
      |||¯¯¯¯¯¯¯¯¯¯¯¯¯ Up
      ||¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Down
      |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Left
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Right

Combinations  are also possible - in that case several bits  will 
be  set.  The  firebutton  data can be fetched  from  0  of  3582 
(decimal). That location will give the following values:

 %11111000             No buttons pressed
 %11111001             Joystick port 1 button pressed
 %11111010             Joystick port 0/mouse button pressed

These  methods only work to read joystick port 1 (the back  one). 
Do not use this variable to check the mouse key!
We were talking about the mouse, weren't we? Somewhere in memory, 
you  can easily PEEK the values of the mouse  position,  and  the 
nice thing is: These variables are READ and WRITE variables (that 
means  that  you can also change the mouse  position  using  this 
piece of memory!).

The interesting locations are:

 $26E0                 Mouse X position (word)
 $26E2                 Mouse Y position (word)
 $26E6                 Mouse button status (word)

As these locations are old a word long,  you'll have to use DPEEK 
in  GfA  Basic or PEEK in ST Basic (PEEK in GfA always  works  on 
only  one byte,  which unfortunately happens to be no  more  than 
half a word).

This   following  small  GfA  Basic  programs  demonstrates   the 
possibilities of these POKEs and PEEKs.  It simply prints all the 
contents of the appropriate mouse addresses,  and when you hit  a 
key it puts the mouse in the right top corner.

Do
  Print At(10,12);Dpeek(&H26E0)
  Print At(10,14);Dpeek(&H26E2)
  Print At(10,18);Dpeek(&H26E6)
  If Inp?(2)
    Dpoke (&H26E0),0
    Dpoke (&H26E2),0
    A=Inp(2)
  Endif
Loop

There  are  also two locations that contain the line  and  column 
that the cursor is on (also possible to READ as well as WRITE):

 $291E                 Cursor Column
 $2920                 Cursor Line

These  are  both  words (16 bits) and you can  PEEK  the  current 
cursor position as well as POKEing is somewhere on the screen.

Then  there's a last useful location:  The shift status  byte  at 
$E1B  (which is actually present at $E61 in the MEGA  ST!).  This 
location  is also used by GfA Basic to check if  the  ALT-CONTRL-
SHIFT keys are pressed. This doesn't work on the MEGA ST anymore, 
but if you run the following program with your GfA Basic disk  in 
the drive,  it will modify the GfA Basic (only version 2.0!!). It 
was found out and written originally by Claud Brod and  published 
in September's "ST Computer" magazine.

Open "U",#1,"\GFABASIC.PRG"
Seek #1,&H63AD
Out #1,&H61
Close #1

And what about the actual values that this variable can get?  The 
individual  bits  in  this  byte each  have  their  own  specific 
meaning:
 Bit 0                 Right Shift                     (1)
 Bit 1                 Left Shift                      (2)
 Bit 2                 Control                         (4)
 Bit 3                 Alternate                       (8)
 Bit 4                 Caps Lock                       (16)
If  you'd  PEEK this address and you'd get a value  of  31,  this 
would mean that all the special keys are pressed.

Disclaimer
The text of the articles is identical to the originals like they appeared in old ST NEWS issues. Please take into consideration that the author(s) was (were) a lot younger and less responsible back then. So bad jokes, bad English, youthful arrogance, insults, bravura, over-crediting and tastelessness should be taken with at least a grain of salt. Any contact and/or payment information, as well as deadlines/release dates of any kind should be regarded as outdated. Due to the fact that these pages are not actually contained in an Atari executable here, references to scroll texts, featured demo screens and hidden articles may also be irrelevant.