MAPPING THE 520 ST
First "legal" memory addresses
by JACK POWELL, Antic Technical EditorEach issue of the Antic ST Section brings you vital technical data about the Atari ST. Last month we presented photos of the inside of the machine, with descriptions of all significant chips and ports. Now we offer the flirt 5205T memory map. You may not own an ST yet and some of this information may seem highly technical. But if you hold onto these issues you will find them invaluable in your future ST programming-ANTIC ED.
A memory map is the chart that any serious programmer needs in order to understand and navigate the hardware level of a computer. It can be presented as a diagram, or as a list of address locations with accompanying descriptions.
Just before press time, Atari sent Antic the following partial map of the 520ST. It's in list form and, while admittedly incomplete, it provides the first locked, legal registers of the new computer. These locations are, in Atari's own words, "cast in concrete."
The individual register descriptions are often cryptic, but sometimes they provide fascinating hints about the ST's design, scope and limitations. For example, address $4A6 tells us the ST will be limited to a maximum of 2 floppy disk drives, but address $424 hints that an ST can be configured for one megabyte of memory.
Keep in mind that this is a 32-bit addressable computer and there are three basic data types. Bytes are 8 bits. Words are 16 bits, or two bytes. Longwords (longs) are 32 bits, or two words. Also, we are no longer dealing with the low/high byte storage order of the 6502. The 68000 stores bytes in high/low order.
MAGIC NUMBERSIn the following table, the address in hexadecimal appears first, followed by the data type (byte, word or long), and label. The label is actually a system variable which can be accessed from C when linked with the proper binding file.
Certain locations mention "magic numbers." These are predetermined specific values which the machine looks for when performing certain functions. Magic numbers are set (sometimes whimsically) by Atari programmers and can be almost anything. The computer doesn't care what the number means, as long as it's the right number. At location $426, for example, the magic number is pi.
Certain locations refer to BIOS and GEM specific information. Antic will cover this data in future issues.
$400 (long) etv_timer Timer handoff vector (logical vector $100). $404 (long) etv_critic Critical error handoff vector (logical vector $101). $408 (long) etv_term Process terminate handoff vector (logical vector $102). $40C (long) etv_xtra Space for logical vectors ($103 through $107). $420 (long) memvalid Contains the magic number $752019F3 which, together with "memval2" validates "memcntlr" and indicates a successful coldstart. $424 (byte) memcntlr Contains memory controller configuration nibble (the low nibble). Some values include: Memory size Value 128K 0 512K 4 256K (2 banks) 0 1MB (2 banks) 5 $426 (long) resvalid If "resvalid" is the magic number, $31415926, on system RESET, the system will jump through "resvector." $42A (long) resvector System RESET bailout vector, valid if "resvalid" is a magic number. Called early in system initialization (before any hardware registers- including memory controller configuration register-have been touched). A return address will be loaded into A6. Both stack pointers will contain garbage. $42E (long) phystop Physical top of RAM. Contains a pointer to the first unusable byte ($80000 on a 512K machine). $432 (long) _membot Bottom of available memory The "getmpb" BIOS function uses this value as the start of the GEMDOS Transient Program Area (TPA). $436 (long) _memtop Top of available memory The "getmpb" BIOS function uses this value as the end of the GEM TPA. $43A (long) memval2 Contains the magic number $237698AA which, together with "memvalid", validates "memcntlr" and indicates a successful coldstart. $440 (word) seekrate Default floppy seek rate. Bits zero and one contain the default floppy disk seek rate for both drives: 00 6ms 01 12ms 10 2ms 11 3ms (default) $442 (word) _timr_ms System 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 to the stack to the timer handoff vector. $444 (word) _fverify Floppy verify flag. When non-zero, all writes to floppies are read- verified. When zero, no write-verifies take place. The default state, after RESET is to verify. $446 (word) _bootdev Contains the device number the system was booted from. $448 (word) palmode When non-zero, indicates the system is in PAL mode (50hz video). When zero, indicates the system is in NTSC mode (60hz video). $44A (byte) defshiftmd Default video resolution. If the system is forced to change from monochrome mode to a color resolution, "defshiftmd" contains the resolution the system will switch to. $44C (word) sshiftmd Contains shadow for "shiftmd" hardware register. 0 320 x 200 x 4 (low resolution) 1 640 x 200 x 2 (medium resolution) 2 640 x 400 x 1 (high res. monochrome) $44E (long) _v_bas_ad Pointer to base of screen memory. Always on a 512-byte boundary. Always points to 32K of contiguous memory. $452 (word) vblsem Semaphore to enforce mutual exclusion in vertical blank interrupt handler. Should be "1" to enable vblank processing. $454 (word) nvbis Number of longwords that "_vblqueue" points to. On RESET, defaults to 8. $456 (long) _vblqueue Pointer to a vector of pointers to vblank handlers. $45A (long) colorptr 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. $45E (long) screenpt Pointer to the base of screen memory; to be set up on the next vblank. If NULL, the screen base is not changed. $462 (long) _vbclock Count of vertical blank interrupts. $466 (long) _frclock Count of vertical blank interrupts that were processed (not blocked by "vblsem"). $46A (long) hdv_init Vector to hard disk initialization. NULL if unused. $46E (long) hdv_dsb Vector to routine to return a hard disk's state block. The WORD device number should be on the stack. NULL if unused $472 (long) hdv_bpb 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. $476 (long) hdv_rw Vector to routine to read or write on a hard disk. Same calling conventions as the BIOS function for RWABS. NULL if unused. $47A (long) hdv_boot Vector to routine to boot from a hard disk. NULL if unused. $47E (long) hdv_mediach Vector to routine to return a hard disk's media change mode. Same as BIOS binding for floppies. NULL if unused. $482 (word) _cmdload When nonzero, an attempt is made to load and execute COMMAND.PRG from the boot disk. (Load a shell or application in place of the desktop.) Can be set to nonzero by a boot sector. $484 (byte) conterm Contains attribute bits for the console system: Bit Function 0 non-zero: enable keyclick 1 non-zero: enable key-repeat 2 non-zero: enable bell on ^G $48E (long) themd MD for GEMDOS. Can be manipulated by boot sectors. $49E (word) ________md More MD for GEMDOS. Can be manipulated by boot sectors. $4A2 (long) savptr Pointer to register save area for BIOS functions. $4A6 (word) _nflops Number of floppy disks attached (0,1, or 2). $454 (long) _bufl Two buffer-list pointers. $45C (long) _hz__200 Raw 200hz system timer tick. Used to divide by four for a 50hz system timer. $4C4 (long) __drvbits 32-bit vector; returned by the "DRIVEMAP" BIOS function, of "live" block devices. If any floppies are attached, this value is 3.