ALL ABOUT SYSTEM VARIABLES by Richard Karsmakers
Originally Published in ST NEWS Volume 1 Issue 2, launched on
August 9th, 1986.
Like any computer system, the ST has certain variables somewhere
in memory for use by the operating system. It is possible to
manipulate these variables, or to look at them to determine
certain values, pointers or vectors in your system.
But to do that, you'll have to know which variables are on which
memory address. Therefore, I decided to write this article in ST
NEWS, that includes a list of system variables with their
functions.
This list of ST BIOS system variables, together with their
functions, are based on the chapter about system variables in the
booklet "Hitchhiker's Guide to the BIOS" .
etv_timer (long) $400
Timer handoff vector (logical vector $100)
etv_critic (long) $404
Critical error handoff vector (logical vector $101)
etv_term (long) $408
Process-terminate handoff vector (logical vector $102)
etv_xtra (long) $40c
Space for logical vectors $103 through $107
memvalid (long) $420
Contains the magic number $752019f3, which (together with
'memval2') validates 'memcntlr' and indicates a successful
coldstart
memcntlr (byte) $424
Contains the memory controller configuration nibble (the low
nibble). Some popular values are:
Memory Size Value
128K 0
512K 4
256K (2 banks) 0
1MB (2 banks) 5
resvalid (long) $426
If 'resvalid' is the magic number $31415926 on system RESET,
the system will jump through 'resvector'
resvector (long) $42a
System RESET bailout vector, valid if 'resvalid' is a magic
number. Called early-on in system initialization (before any
hardware registers, including the memory controller configu-
ration register, have been touched). A return address will be
loaded into A6. Both stacks pointers will contain garbage
phystop (long) $42e
Physical top of RAM. Contains a pointer to the first unusable
byte (i.e. $80000 on a 512K machine)
_membot (long) $432
Bottom of available memory. The 'getmpb' BIOS function uses
this value as the start of the GEMDOS TPA
_memtop (long) $436
Top of available memory. The 'getmpb' BIOS function uses this
value as the end of the GEMDOS TPA
memval2 (long) $43a
Contains the magic number $23769aa which (together with 'mem-
valid') validates 'memcntlr' and indicates a successful cold-
start
flock (word) 43e
Used to lock usage of the DMA chip. Should be nonzero to ensu-
re that the OS does not touch the DMA chip registers during
vertical blank. Device-driver writers TAKE NOTE: this variable
MUST be nonzero in order to make use of the DMA bus
seekrate (word) $440
Default floppy seek rate. Bits zero and one contains the de-
fault floppy disk seek rate for both drives:
00 6ms
01 12ms
10 2ms
11 3ms (default)
_timr_ms (word) $442
Sytem timer calibration (in ms). Should be $14 (20 decimal),
since the timer handoff vector is called at 50hz. Returned by
BIOS function 'tickcal', and passed on the stack to the timer
handoff vector
_fverify (word) $444
Floppy verify flag. When nonzero, all writes to floppies are
read-verified. When zero, no write-verifies take place. The
default state (after system-RESET) is to verify
_bootdev (word) $446
Contains the device number the system was booted from. The
BIOS constructs an environment string from this variable be-
fore bringing up the desktop
palmode (word) $448
When nonzero, indicates the system is in PAL (50hz video)
mode. When zero, indicates the system is in NTSC (60hz video)
mode
defshiftmd (byte) $44a
Default video resolution. If the system is forced to change
from monochrome to a color resolution, 'defshiftmd' will con-
tain the resolution the system will switch to
sshiftmd (word) $44c
Contains shadow for 'shiftmd' hardware register:
0 320x200x4 (low resolution)
1 640x200x2 (medium resolution)
2 640x400x1 (high resolution)
_v_bas_ad (long) $44e
Pointer to base of screen memory. Always on a 512 byte boun-
dary. Always points to 32K of contiguous memory
vblsem (word) $452
Semaphore to enforce mutual exclusion in vertical-blank
interrupt handler. Should be "1" to enable vblank processing
nvbls (word) $454
Number of longwords that '_vblsqeue' points to (on RESET,
this value is 8)
_vblsgeue (long) $456
Pointer to a vector of pointers to vblank handlers
colorptr (long) $45a
Pointer to a vector of 16 words to load into the hardware
palette registers on the next vblank. If NULL, the palettes
are not loaded. 'colorptr' is zeroed after the palettes are
loaded
screenpnt (long) $45e
Pointer to the base of screen memory, to be setup on the next
vblank. If NULL, the screen base is not changed
_vbclock (long) $462
Count of vertical-blank interrupts
_frclock (long) $466
Count of vertical-blank interrupts that were processed (not
blocked by 'vblsem')
hdv_init (long) $46a
Vector to hard disk initialization. NULL if unused
swv_vec (long) $46e
The system follows this vector when it detects a transition
on the "monochrome monitor detect" input (from low to high
resolution or visa-versa). 'swv_vec' initially points to the
system RESET handler; therefore the system will RESET if the
user changes monitors
hdv_bpb (long) $472
Vector to routine to return a hard disk's BIOS Parameter
Block (BPB). Same calling conventions as the BIOS function
for GETBPB. NULL if unused
hdv_rw (long) $476
Vector to routine to read or write on a hard disk. Same cal-
ling conventions as the BIOS function for RWABS. NULL if un-
used
hdv_boot (long) $47a
Vector to routine to boot from hard disk. NULL if unused
hdv_mediach (long) $47e
Vector to routine to return a hard disk's media change mode.
Same as BIOS binding for floppies. NULL if unused
_cmdload (word) $482
When nonzero an attempt is made to load and execute
COMMAND.PRG from the boot device (load a shell or an appli-
cation instead of the desktop). Can be set to nonzero by a
boot sector
conterm (byte) $484
Contains attribute bits for the console system:
Bit: Function:
0 nonzero: enable bell when ^G is
written to CON:
1 nonzero: enable key-repeat
2 nonzero: enable key-click
3 nonzero: on BIOS conin() function,
return the current value of
'kbdshift' in bits 24..31 of
D0.L
zero: leave bits 24..31 alone...
themd (long) $48e
Filled in by the BIOS on a 'getmpb' call; indicates to
GEMDOS the limits of the TPA. The structure is:
struct MD
{
MD *m_link; /* ->next MD [NULL]
long m_start; /* start of TPA */
long m_length; /* size of TPA (bytes) */
PD *m_own; /* ->MD's owner [NULL] */
} ;
The structure may NOT be changed once GEMDOS has been initia-
lized. In addition, there may be only ONE of these suckers
(you can't use the 'm_link' filed in the first MD). Someday
(with a better GEMDOS) these limitations may be lifted
savptr (long) $4a2
Pointer to register save area for BIOS functions
_nflops (word) $4a6
Number of floppy disks actually attached to the system (0,1,
or 2)
sav_context (long) $4ae
Pointer to saved processor context
_bufl (long) $4b4
Two (GEMDOS) buffer-list headers. The first list buffers data
sectors, the second list buffers FAT and directory sectors.
Each of these pointers points to a Buffer Control Block (BCB)
that looks like:
struct BCB
{
BCB *b_link; /* next BCB */
int b_bufdrv; /* drive#, or -1 */
int b_buftyp; /* buffer type */
int b_bufrec; /* record# cached here */
int b_dirty; /* dirty flag */
DMD *b_dm; /* -> Drive Media Descriptor */
char *b_bufr; /* -> buffer itself */
} ;
_hz_200 (long) $4bc
Raw 200hz system timer tick. Used to divide-by-four for a
50hz system timer
the_env (byte[4]) $4be
The default environment string. Four bytes of $00....
_drvbits (long) $4c4
32-bit vector, returned by the 'drivemap' BIOS function (#10)
of 'live' block devices. If any floppies are attached, this
value is 3
_dskbufp (long) $4c6
Points to a 1024 byte disk buffer somewhere in the system's
BSS. The buffer is also used for some GSX graphics operations
and should not be used by interrupt routines
_prt_cnt (word) $4ee
Initialized to -1. Pressing the ALT-HELP key increments this.
The screen dump code checks for $0000 to start imaging the
screen to the printer, and checks for nonzero to abort it
_sysbase (long) $4f2
Points to the base of the OS (in ROM or RAM)
_shell_p (long) $4f6
Points to shell-specific context
end_os (long) $4fa
Points just past the last byte of low RAM used by the OS.
This is used as the start of the TPA (end_os is copied
into _membot)
exec_os (long) $4fe
This points to the shell that gets executed by the BIOS
after system initialization is complete. Normally, this
points to the first byte of the AES' text segment
We hope to have supplied you with usefull information in this
article. The system variables that are not mentioned are not
certain yet, but as we get to know these, we will undoubtedly
publish them in a future issue of ST NEWS.
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.