•  Back 
  •  Assembling Language(s) 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : 
Author      : 
Version     : 
Subject     : 68000 machine code
Nodes       : 74
Index Size  : 2808
HCP-Version : 2
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : 
@help       : 
@options    : -i -s +x
@width      : 75

                    ST Memory Map


        ALL MEMORY FROM $0000 TO $7FF IS PROTECTED MEMORY.
This means that you cannot normally access it without generating a
Privilige error. Have to be in Supervisor mode for legal access.

0000-0008 System power up vector,  actually a copy of the first  8
          bytes of ROM. READ ONLY. Writing causes an exception.
0008      Bus error exception vector.   Trying to access >4 Meg or
                                        writing to $0000
000C      Address error exc vector.     Trying to access a word (or
                                        long word on an odd address
                                        (byte boundary)
0010      Illegal instruction           No such instruction!
0014      Divide by zero                Obvious (points to RTE).
0018      Check instruction             special
001C      TrapV                         special
0020      Privilige violation           Trying to access protected
                                        memory area in user mode.
0024      Trace                         Indicates tracing. Causes the
                                        CPU to finish the instruction
                                        and then jump through here.
0028      Line A                        Line A decoder vector
These line A routines give low level access to the graphics and
blit routines in the ST. Read the VDI manual first though.
002C      line F                        Same for line F access.
                                        These are the guts of VDI.
0030-0038 Reserved
003C      Uninitialised interrupt vector
0040-005F Unassigned
0060      Spurious interrupt vector     Unknown interrupt.
0064-007C levels 1-7 interrupt auto vectors.
          These are used for Hor. blank and Vert blank interrupts.
          Hor blank is not enabled by the system.
0080-00BF Trap instruction vectors
          0080 Trap #0 Not used.
          0084 Trap #1 for Gemdos calls
          0088 Trap #2 for Aes and VDI calls
          008C to 00B0 traps 3 to 12 are not used.
          00B4 Trap #13 calls to Bios (Basic Input/Output System)
          00B8 Trap #14 calls to X-Bios (Extended Bios)
          00BC Trap #15 is not used.
00C0-00FF Reserved for future use!

From $0100 to $03ff are additional interrupt vectors. Only some are
          used, and the system initialises only some of those.
0100      Centronics port interrupt vector (printer)
0104      Data carrier detect interrupt
0108      Clear to send
010C      Graphics processor blit done (we should be so lucky)
0110      System timer D (Baud rate generator)
0114      System timer C (Used for housekeeping duties)
0118      Midi and/or Keyboard interrupt vector
011C      Disk DMA (Direct Memory Access)
0120      System timer B (Horizontal Blank counter)
          Some books show this as being available. Don't believe it!
0124      Transmit error
0128      Transmit buffer empty interrupt
012C      Receive error
0130      Receive buffer full interrupt
0134      Timer A (available).
0138      Ring indicator
013C      monochrome detect
0140-03FF Supposedly reserved, but can be used. Be careful though,
some programs may use them.


              PAGE 4 VECTORS, GUARANTEED TO REMAIN

This  is an area (it actually extends into the 0500  range)  which
contains vectors through which different functions jump,  allowing
interception  (and  replacement if you wish) and  also  containing
system variables.

Location. Name        Description
0400      etv_timer   vector for the event timer. Comes through
                      here 200 times/second. If you need that kind
                      of  speed,  steal this  vector,  FIRST  JSR
                      through the old one, then do what you like.
                      But don't take too long to do it.
0404      etv_critic  vector for the critical error handler
0408      etv_term    process termination vector
040C      etv_xtra    5 long words reserved for system vectors
                      These do not seem to be in use currently.
0420      memvalid    Indicates whether RAM is valid on reset.
                      If valid contains $752019F3
0424      memcntlr    1 nybble shows memory configuration.
0426      resvalid    Shows if a valid rerunnable program. (on reset)
                      Contains $31415926 if valid. Program to set this.
042A      resvector   If  resvalid,  jumps to the  address  stored
                      here.
042E      phystop     Physical  top  of  RAM  memory including screen.
0432      _membot     bottom of USER available memory (end of sys)
0436      _memtop     top of USER avail mem. (below screen)
043A      memval2     ANOTHER  value  to certify  that  memory  is
                      still O.K. Should contain $237698AA.
043E      flock       non-zero means floppy disk active.
0440      seekrate    default (on power up) floppy step rate.
                      Changing this after power up does nothing at all.
0442      _timr_ms    system timer calibration (don't ask)
0444      _fverify    flag, non-zero means write with verify.
                      If off (zero) speeds up disk writes a lot
0446      _bootdev    default boot device. If you change this to B
                      for example, system on reset boots from B.
0448      palmode     flag, if non-zero tells system 50 Herz
044A      defshiftmd  Default resolution (only first byte used)
                      is either 0 (low), 1 (med) or 2 (high)
044C      sshiftmd    shadow for above register used by GEM.
044E      _v_bas_ad   pointer to start of screen memory.  Used  in
                      writing  to  the screen.  (You  can  display
                      another  one  if you  wish.  See  set_screen call
0452      vblsem      flag for V-blank routine.
0454      nvbls       Number of deferred Vblank vectors.  Normally
                      set to 8, although the system uses 1 only.
                      If you change this to more than 8, you also
                      will have to change the pointer to a new area.
0456      _vblqueue   pointer to the list of Vblank routines. This
                      normally points at $04CE,  where there are 8
                      vectors set aside. May be changed.
045A      colorptr    Shove the address of a new palette in  here,
                      and the system will transfer them for you
                      during Vblank. It then resets it to zero. The
                      palette info is transferred to $FF8240 up.
045E      screenpt    Put  the new screen address in here and  the
                      system will flip screens for you during Vblank.
                      DOES NOT get zeroed. Make sure you DO after Vbl.
                      Otherwise if you try and do setscreen, this points
                      it right back again.
0462      _vbclock    count of unblocked vertical blanks (actually
                      executed  vert.  blanks,  as you  CAN  block them
                      either with interrupt level or Vblsem.
0466      _frclock    count of EVERY Vblank, regardless
046A      hdv_init    hard disk initialisation vector. (power up)
046e      swv_vec     change to/from high resolution reset vector
                      Changing  mono/colour causes a jump  through
                      here to the reset routine.
0472      hdv_bpb     vector  for "get BPB" call.  Hard disks  and
                      Ramdisks "steal" this vector for own use.
0476      hdv_rw      For read/write calls, same applies
047A      hdv_boot    vector to the disk boot handler.
047E      hdv_mediach vector to detect disk changes.
Any disk handler needs to intercept $472, $476 and $47E
0482      _cmdload    power up flag (for TOS on disk only?????)
0484      conterm     Various bits indicate what kind of  keyboard
                      or terminal to emulate, and mouse functions.
0486      trp14ret    Trap #14 saves it's return address here (??)
048A      criticret   same for the critical error handler
048E-04A0 themd       memory descriptor list, pointers to lists of
                      pointers which show reserved memory blocks, and
                      where and how much was reserved.
04A2      savptr      System pointer to it's register save area. If you
                      use this pointer, make sure you do it correctly.
04A6      _nflops     how many floppies. (0,1 or 2 only)
04A8      con_state   state of conout parser (You're on your own)
04AC      save_row    saved row address for cursor X/Y pos.
04AE      sav_context pointer to saved processor parameters
04B2      _bufl       2 buffer list headers (I don't know)
04BA      _hz_200     gets incremented 200 times per second, if you
                      want to time something, this is the way. Read
                      this value, do the deed, read it again and the
                      elapsed time is the difference (in 200th sec.)
04BE      _drvbits    bitmap of drives (bit 0=A, bit 1=B etc.)
04C2      _dskbufp    pointer to the (1K) default disk buffer.
04C6      _autopath   points to the default pathname for AUTO
04CA      _vbl_list   8 long words for Vblank vectors.  If any  of
                      these are non-zero, system jumps to address.
04EE      _dumpflg    If  set,  causes  system to dump  screen  to
                      printer.
04F0      _prtabt     if set, causes the printer to abort.
04F2      _sysbase    pointer  to  start  of  ROM  oper. sys($FC0000)
                      One of the more useless ones I'd say.
04F6      _shell_p    Shell info (not used by ROM system??)
04FA      end_os      end of system Ram usage (should be the  same
                      as membot normally.
04FE      exec_os     address of start up shell (meaning GEM)
0502      -------     printer vector (the last point at which  you
                      can intercept printer output.
0506      -------     vector to parellel port status routine
050A      -------     vector to time out routine
050E      -------     vector to routine to check aux port status
0512      -------     vector to auxillary output routine


From here on up to $800, nothing seems ? to be used, but this may change.
System memory extends  normally  to location $a100,  after that  there
is  user memory all the way up to the screen. This does not mean it is
always  free,  the first thing in (from AUTO folder or  Accessory)
will use it. Therefore your programs should ALWAYS be relocatable,
and ALWAYS check to see where memory is free before using it.  E.g
Supermons ramdisk is actually at the TOP of memory,  either before
or after the screen memory.  So check with the system to see  what
you  can  use. You can do this by reserving what you want with a
MALLOC call. It returns the address.  Also use the systems screen pointer,
don't automatically assume the screen is at $78000 or $f8000.
If you make your program comply with the system protocol, you will find
that it can share with other applications (such as accessories), which,
by making your program more versatile, will attract more users! There is
nothing worse than not being able to use your favourite (and sometimes
essential) accessories or utilities with something else.


$78000 or $f8000 (or more on Megas) screen address. (Normally)
The  screen actually takes 32000 bytes,  not 32K so there are  768
bytes available ABOVE the screen. At one time I thought this might
be  ideal to hide small programs,  a bit like page 6 on the 8  bit
machines.  BUT, it would seem that the hard disk driver from Atari
does use part of this at some stage, so LEAVE IT ALONE.


                        THE CARTRIDGE AREA

This  starts at address $FA0000 and goes to $FBFFFF.  A  total  of
128K is therefore available for cartridges. Cartridges can be of 2
types, diagnostic or "normal".
Diagnostic  cartridges can take over control of the  system  right
from  before the point ANYTHING is checked or set up,  till  after
the system variables etc.  have been set up (but before interrupts
are enabled)
Regular cartridges may initialise (or run) from after the enabling
of  interrupts  right up to a point where the  disk  boot  starts.
Alternatively  they can just be run from the desktop as a  PRG  or
TOS type program.
A  normal  cartridge  must  have  the  following  header,   to  be
recognised by the system:
$FA0000   must contain the magic number $ABCDEF42
$Fa0004   CA_NEXT     pointer to next headers (as many as you like)
                      or if zero, no more headers.
$FA0008   CA_INIT     Pointer    to   cartridges    initialisation
                      routine,  or zero if none. Is initialised at
                      a  point during power up depending  on  bits
                      set in the highest byte of CA_INIT.
$FA000C   CA_RUN      Jumps through here when you actually run the
                      program from the desktop.
$FA0010   CA_TIME     Time of creation (like any other program)
$FA0012   CA_DATE     Same for date.
$FA0014   CA_SIZE     Size of application. (displayed but ignored)
$FA0018   CA_NAME     Dos type of name,  8 bytes plus 3  extender,
                      MUST be terminated with 00.

From here on up you may put what you like till $FBFFFF.


                       THE OPERATING SYSTEM

This starts at $FC0000 and goes (currently) up to  $FEFFFF.  This,
as  well  as the hardware registers above it  is  again  protected
memory, to be accessed only in Supervisor mode.
The  first 8 bytes are the reset parameters,  which  are  shadowed
(duplicated)  in  the first 8 bytes of RAM  at  $0000.  Some  more
system values follow.
$FC0000   reseth      branch to the reset routine
$FC0002   version     version number of the OS (0100 or 0102)
$FC0004   reseth      pointer to start of reset routine
$FC0008   os_beg      start of operating sys. ROM ($FC0000) Why?
$FC000C   os_end      end of TOS memory requirements (but not GEM)
$FC0010   os_exec     start of OS again (leftover from Ram ?)
$FC0014   os_magic    tells whether GEM is in ROM or not.
$FC0018   os_date     date on which system was written
$FC001A   os_conf     Now don't you worry about that, young fella.

At $FC0020 on the 1st TOS on ROM release the actual start up  code
begins. In the later versions you will first find a few pointers.
$FC0020   _root       Pointer to base of the OS pool memory (GEM?)
$FC0024   _kbdshft    Pointer to the keyboard shift register
$FC0028   _run        pointer  to a pointer to the base page  address
                      of  the currently running process or application.
Then the start up routine follows.


                 THE DREADED HARDWARE REGISTERS.

All I will do here is give the addresses of the BLOCKS,  for  full
descriptions and/or how to access them, and what they actually do,
you will have to buy yourself some books, such as ST Internals.
In almost every case, access is BYTE only, on ODD boundaries.
Some are read only registers.

$FF8000   Memory configuration.  The MMU uses this to control both
          different  amounts and types of memory.  (64K,  256K  or
          Megabyte type chips)
$FF8200   Video display registers. Pointers to screen position, as
          well as pointers to CURRENT output position on screen.
          Also allows for 50/60 cycles and external sync signals.
$FF8240   Here are the 16 colours of the current palette stored.
          If reading these and storing for later use, remember to
          AND them with $777 to drop off garbage bits.
$FF8600   DMA  chip registers.  Pointers to start and end  of  DMA
          (Direct Memory Access) functions and status.
$FF8800   Sound chip.  A very sordid tale this one!  The sound chip
          has various functions,  looking after part of the floppy
          access as well as the printer port AND the RS232 port.
          In addition, it can even produce sound as well. For a full
          understanding of this, get the manual.
$FFFA00   MFP (Multi Function Peripheral) chip.
          Basically looks after almost all interrupts generated in
          the  system,  and contains timers A to D as well as  the
          RS232 registers for receive and transmit.
$FFFC00   Keyboard  and midi ACIAs.  These transmit (serially)  any
          data from the keyboard and/or Midi port.