home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / reference / amiga_mail_vol1 / exec / exceptvector < prev    next >
Text File  |  1990-01-26  |  3KB  |  98 lines

  1. (c)  Copyright 1989 Commodore-Amiga, Inc.   All rights reserved.
  2. The information contained herein is subject to change without notice, and 
  3. is provided "as is" without warranty of any kind, either expressed or implied.  
  4. The entire risk as to the use of this information is assumed by the user.
  5.  
  6.  
  7.  
  8.                      Exception Vector Warning
  9.  
  10.                         by Bryce Nesbitt
  11.  
  12.  
  13. If you are currently writing values directly to the exception table
  14. in low memory there are two things you need to know:
  15.  
  16.     1> This is not a supported operation.  Nothing protects you
  17.        from any other tasks that might be in the system.
  18.  
  19.     2> The exception table may move in future versions of the Amiga
  20.        that have a 68020 or other members of the 68000 processor 
  21.        family.  Take steps NOW to be sure your program will continue 
  22.        working with future versions of the operating system.
  23.  
  24. Only a very few programs will be affected.  Debuggers may need to take
  25. over the exceptions to get the control they need.  Take-over-the-machine
  26. games may have bypassed the operating system completely.  Both types
  27. of programs need to be aware that the exception base can move.
  28.  
  29. Under the current system, the 68000's exception vectors start at a fixed
  30. location, $00000000.  This means that any interrupt or exception must first
  31. read an address from CHIP ram.  Depending on display modes and blitter 
  32. activity, this can impose a significant speed penalty.  Tentative plans 
  33. have been made to change this for V1.4 Kickstart.  This article is advance 
  34. warning for developers.
  35.  
  36. Starting with the 68010, all new members of the 68000 family have supported
  37. the "Vector Base Register", or VBR.  This sets the absolute hardware address
  38. used by the chip for the exception table.  With VBR we can locate the 
  39. table into the fastest memory currently installed in the system. 
  40. Serial port and graphic interrupt users will see the most dramatic speed
  41. increases.
  42.  
  43.  
  44. ;------------------------------------------------------------------------
  45. ; The assumption that the exception table is located at $00000000 is
  46. ; invalid.  This ready-to-use function will extract the proper pointer
  47. ; and return it in d0.
  48. ;
  49. ; Remember that writing directly to the exception table is not supported.
  50. ; Where possible you should be using the exception handling defined
  51. ; by Exec.
  52. ;
  53.         INCLUDE "exec/execbase.i"
  54.         INCLUDE "exec/libraries.i"
  55.  
  56. ABSEXECBASE    EQU 4
  57.  
  58.         XDEF    _GetVBR     ;Make this externally visible
  59.         XREF    _LVOSupervisor
  60.  
  61.  
  62. _GetVBR:    movem.l a5/a6,-(sp)
  63.         move.l    ABSEXECBASE,a6
  64.         moveq    #0,d0
  65. ;
  66. ; Check the CPU type.  AFB_68010 indicates a 68010 CPU or better
  67. ;
  68.         btst.b    #AFB_68010,AttnFlags+1(a6)  ;Check CPU type
  69.         beq.s    no_vbr            ;CPU has no VBR register...
  70.  
  71. ; We have the right CPU.  Find out where the exception
  72. ; table REALLY is.
  73.  
  74.         lea.l    GetVBRTrap(pc),a5
  75.         jsr    _LVOSupervisor(a6)
  76.  
  77. no_vbr:
  78.         movem.l  (sp)+,a5/a6
  79.         rts
  80.  
  81.  
  82. ;
  83. ; The Supervisor() function takes the address of a small supervisor mode
  84. ; function in A5, and traps to it at the Supervisor level of privilege.
  85. ; All registers are returned from the Supervisor function.
  86. ;
  87. ; Here we read the Vector Base Register.  The instruction is
  88. ; "MOVEC.L VBR,D0", but is included as a dc.w for assemblers that can't
  89. ; understand 68010 instructions.
  90. ;
  91. GetVBRTrap:
  92.         dc.w    $4e7a,$0801    ;MOVEC.L VBR,D0
  93.         rte
  94.  
  95.         END
  96.  
  97.  
  98.