home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / exceptions / exceptions.txt < prev   
Text File  |  1992-09-03  |  23KB  |  553 lines

  1. MC680x0 exception vectors.
  2.  
  3. Written by Kyzer/CSG, based in parts on material in 'Programming the 68000'
  4. and 'The AMIGA Hardware Reference Manual', both published by Addison-Wesley.
  5.  
  6. COPYRIGHT: The copyright on this work as a whole is retained by the author.
  7. This document is freeware. It may be distributed freely, provided it remains
  8. unedited and no profit ensues. Commercial bodies are permitted to use the
  9. information in here as a reference, but may not use it in an article or
  10. otherwise reproduce the information without the author's permission.
  11. All trademarks should be considered acknowledged. Anyone unsure of the
  12. exact implications of this statement must ask the author for more specific
  13. information. All definitions are decided by the author. You may not attempt
  14. to 'pick legal holes' in this statement in an effort to legally contravene
  15. any of the above. If you want to modify this document do NOT distribute the
  16. modified copy, send a list of the changes to the author and he will ensure
  17. the changes are made himself. You are permitted to translate this document
  18. into another language, but the same rules above still apply.
  19.  
  20. DISCLAIMER: No warranty or guarantee is made for this information, use of the
  21. information is entirely at your own risk. The information herein is correct
  22. to best of the author's knowledge.
  23.  
  24. All that just to stop Americans from making a fast buck, is it worth it?
  25.  
  26. $VER: Exceptions.txt 1.0 (12/03/96)
  27.  
  28. Contents
  29. ~~~~~~~~
  30. 0. Conventions
  31. 1. What is an exception?
  32. 2. What does the MC680x0 do when there is an exception?
  33. 3. What is in the exception table?
  34. 4. Autovectors - external causes
  35. 5. Traps
  36. 6. Examples of usage
  37. 7. End
  38.  
  39.  
  40. 0. Conventions
  41. ~~~~~~~~~~~~~~
  42. A lowercase "x" will stand for any correct value. Correct values are not
  43. usually given, the "x" simply represents there is more than one value
  44. possible.
  45.  
  46. All numbers beginning with the dollar sign "$" are in hexadecimal.
  47.  
  48. MC680x0 means all the Motorola 68000 series. That is the MC68000, MC68010,
  49. MC68EC020, MC68020, MC68EC030, MC68030, MC68EC040, MC68040 and MC68060.
  50.  
  51. 68000 means the MC68000 alone
  52.  
  53. 680x0 means all of the Motorola 68000 series except the 68000 itself.
  54.  
  55. Assembly mnemonics, registers and hardware pins are given in uppercase.
  56.  
  57. A slash "/" between two assembly mnemonics represents a seperate line.
  58.  
  59.  
  60. 1. What is an exception?
  61. ~~~~~~~~~~~~~~~~~~~~~~~~
  62. An exception is when the processor (which we assume is a MC680x0) is halted
  63. and made to do something else. It can be halted by either the processor
  64. itself, when it errors or a TRAP command is run, or an external force, on
  65. the processor's INTx pins. This is the definition of internal and external
  66. interrupts. External sources do not have to be outside the Amiga! The main
  67. external source is from the Paula chip.
  68.  
  69.  
  70. 2. What does the MC680x0 do when there is an exception?
  71. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  72. First, the MC680x0 finishes processing the instruction it was on, eg if it
  73. was a MOVEQ #1,D0 instruction, then D0 will have 1 in it when the exception
  74. takes place. If it is a JMP $123456 instruction then the program counter will
  75. be at $123456 before the exception starts.
  76.  
  77. Next, the MC680x0 puts sets the supervisor flag in the status register SR.
  78. It is the equivalent of executing the instruction ORI.W #1<<13,SR but it is
  79. a lot faster. This tells another part of the MC680x0 to put A7, the stack
  80. pointer, into a special safe place, then take out the supervisor stack
  81. pointer and put it in A7 instead.
  82.  
  83. Now, the MC680x0 pushes the program counter on the stack, eg MOVE.L PC,-(SP)
  84. and then the status register, eg MOVE.W SR,-(SP).
  85.  
  86. This is now where the 68000 and the 680x0s differ. The next thing that the
  87. the processor must do is get the address of the exception handler. On the
  88. 68000 this is in a page of addresses called zeropage. It is the first 1024
  89. bytes of memory, from $0 to $100, in the Amiga's Chip RAM.
  90.  
  91. === INTERESTED PARTIES ONLY ===
  92. Traditionally, this area of memory is called zeropage, due to the fact 8-bit
  93. processors like the BBC's 6502 could access it with half the address, only 8
  94. bits. The first 256 bytes were very special, as they could be looked up
  95. faster. The 680x0 has the equivalent 'word addressing', eg MOVE.L $4.W,A6 but
  96. this is no fun as the whole first 65536 bytes would be classed as zeropage.
  97. So we call the first 1024 bytes zeropage instead, as this is most important.
  98. === INTERESTED PARTIES ONLY ===
  99.  
  100. Anyway, the 68000 looks up a table in zeropage for an address. The 680x0
  101. (68010, 68020, 68030, 68040, 68060 and so on) is more advanced. It has a
  102. little internal control register called VBR, and this register contains the
  103. base address of the table. It is usually zero and therefore still in zeropage
  104. but with a utility like FastVBR, the base can be shifted out of Chip RAM and
  105. into Fast RAM, for a significant speed-up, about 1%-4%, more if you are using
  106. a program with FPU or 68040 specific instructions.
  107.  
  108. Once the address is got from the table, the processor jumps to it. It only
  109. knows the exception has finished when it gives an RTE - return from exception
  110. command. You should note that 68060 accelerator makers say you should put
  111. one NOP instruction before the RTE, so as not to smash the 060's pipeline.
  112.  
  113. After this, the 680x0 pops the SR and PC off the supervisor stack, switches
  114. back into user mode with user stack, then continues on it's merry way.
  115.  
  116. ONE FINAL WARNING: EXCEPTIONS DO NOT SAVE THE DATA AND ADDRESS REGISTERS!
  117. YOU MUST DO THIS YOURSELF, OTHERWISE YOU WILL TOTALLY CORRUPT THE NORMAL
  118. PROGRAM EXCECUTION!
  119.  
  120.  
  121. 3. What is in the exception table?
  122. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. The table is a list of addresses. It is split into 3 sections:
  124.  
  125. 1. Error exceptions. These occur when the processor can't continue.
  126. 2. Autovectors. These occur when the processor's INTx pins are touched.
  127. 3. Trap vectors. These occur when a TRAP #x command occurs.
  128.  
  129. === INTERESTED PARTIES ONLY ===
  130. You will recognize the error exceptions below as directly corresponding
  131. to software failures $8000000x that the Amiga throws up from time to time.
  132. You may also have got a bus error, or address error on a 680x0. It's not
  133. impossible, as there is actually an entry in ExecBase describing what the
  134. last error was. Any program can write a value to this then reset to 'fake' a
  135. software failure. OK?
  136. === INTERESTED PARTIES ONLY ===
  137.  
  138. The table looks like this:
  139.  
  140. Off. Name
  141. $08  BUS ERROR, when the address bus malfunctions. VERY SERIOUS!
  142.  
  143. $0C  ADDRESS ERROR, when a 68000 tries to access a word or longword
  144.      from an odd address, "odd" meaning "not even", not "queer"! 680x0
  145.      processors don't cause this, they can write to odd addresses, but
  146.      it's a lot slower, about 10 cycles more!
  147.  
  148. $10  ILLEGAL INSTRUCTION, when the ILLEGAL instruction is run. Other non-
  149.      instructions can cause this, but if you are deliberately wanting to
  150.      cause this exception, only the ILLEGAL instruction is supported
  151.      officially by Motorola, others may be turned into an instruction on
  152.      newer processors.
  153.  
  154. $14  DIVIDE BY ZERO, when you try to divide with 0. Try CLR D0 / DIVU D0,D1
  155.  
  156. $18  CHK: OUT OF BOUNDS, when the CHK or CHK2 instruction tests a data
  157.      register against an upper (and a lower in CHK2) boundary in memory
  158.      and finds the data register outwith those bounds. You shouldn't be
  159.      using the CHK instruction anyway. It's not designed for general use
  160.      on multitasking computers like the Amiga. They get upset.
  161.  
  162. $1C  TRAPV: OVERFLOW BIT SET, when you do a TRAPV instruction, and the V
  163.      flag is set. Like BVS, only a bit more serious. Yet again, it's not
  164.      designed for a multitasking operating system.
  165.  
  166. $20  PRIVILLEDGE VIOLATION, when you do a 'privilledged' command, like
  167.      MOVEC, or MOVE.W #$xxxx,SR but you are not in supervisor mode.
  168.  
  169. $24  TRACE: If you set bit 15 of the status register, the TRACE bit, then
  170.      this exception willbe caused after every instruction has been run.
  171.      Great for debugging.
  172.  
  173. $28  LINE A EXCEPTION: Any instruction that is $Axxx will cause this
  174.      exception. It's to allow new instructions, from $Axxx, to be used
  175.      easily. It didn't catch on.
  176.  
  177. $2C  LINE F EXCEPTION: This is the same idea as the line A, but this is
  178.      caused for any $Fxxx instruction. It's used to emulate an FPU, or
  179.      start an external FPU, all of whose instructions start $Fxxx.
  180.      
  181. $30 and $34 are reserved. Leave them as they are.
  182.  
  183. $38  FORMAT ERROR: This occurs on 680x0s only. I don't know why.
  184.  
  185. $3C  UNINITIALISED VECTOR: If the table entry for an exception is not set (ie
  186.      it is $0) then this exception will run instead. If this isn't set either
  187.      then the MC680x0 will come to a complete halt, and requires restarting.
  188.  
  189. $40-5C are reserved. Leave them as they are.
  190.  
  191. $60  UNKNOWN ERROR: If you were to snap the MC680x0 chip in half while it
  192.      was was working, thus halting it, it would be unable to determine what
  193.      went wrong, so it would run this exception. (Possibly you could write
  194.      a function like _GlueProcessorTogether: or something :)
  195.  
  196. $64  Autovector 1 - see below.
  197. $68  Autovector 2 - see below. This handles CIA A.
  198. $6C  Autovector 3 - see below. This handles the display and blitter ints.
  199. $70  Autovector 4 - see below. This handles the audio interrupts.
  200. $74  Autovector 5 - see below.
  201. $78  Autovector 6 - see below. This handles CIA B.
  202. $7C  Autovector 7 - see below. This is the Non Maskable Interrupt.
  203.  
  204. $80  TRAP #0 exception - see below.
  205. $84  TRAP #1 exception - see below.
  206. $88  TRAP #2 exception - see below.
  207. $8C  TRAP #3 exception - see below.
  208. $90  TRAP #4 exception - see below.
  209. $94  TRAP #5 exception - see below.
  210. $98  TRAP #6 exception - see below.
  211. $9C  TRAP #7 exception - see below.
  212. $A0  TRAP #8 exception - see below.
  213. $A4  TRAP #9 exception - see below.
  214. $A8  TRAP #10 exception - see below.
  215. $AC  TRAP #11 exception - see below.
  216. $B0  TRAP #12 exception - see below.
  217. $B4  TRAP #13 exception - see below.
  218. $B8  TRAP #14 exception - see below.
  219. $BC  TRAP #15 exception - see below.
  220.  
  221. $C0 to $FC are reserved. Leave them as they are.
  222.  
  223. $100 to $3FC are designated by Motorola for computer manufacters to use as
  224.         input/output ports. But on the Amiga all they are is more RAM :)
  225.  
  226.  
  227. 4. Autovectors - external causes
  228. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  229. The autovectors are the only source of interrupts external to the MC680x0.
  230. They are prioritised, so if a level 1 interrupt is occuring and a level 2
  231. requires processing in the middle of this, the lev1 is stopped and the lev2
  232. is handled. This can go on up to lev7 - the non maskable interrupt. The lev
  233. 7 cannot be turned off and cannot be stopped once it starts. This is how
  234. the Action Replay works.
  235.  
  236. The autovectors on the MC680x0 can be caused by one of two things. The
  237. first is a hardware hacker banging on the processor's INTx pins. This is
  238. more commonly caused by something like an Action Replay cartridge.
  239.  
  240. === INTERESTED PARTIES ONLY ===
  241. You may like to know that if you disable all interrupts and write code that
  242. doesn't use exception processing at all, then you can place the 68000's
  243. stack pointer on an odd address. If a user uses an Action Replay cartridge,
  244. when they press the button it will generate an exception, so the 68000 will
  245. push the PC and SR onto the stack - except it can't because it's an ODD
  246. stack, so it'll have to generate an address error. Now that is also an
  247. exception, so it'll have to push PC and SR onto the odd stack, which again
  248. it can't do! So the 68000 will just halt and need to be restarted, thus
  249. denying the Action Replay user any chance of halting your code.
  250. === INTERESTED PARTIES ONLY ===
  251.  
  252. The other way autovectors get called is via the Paula chip. Paula is very
  253. clever, and she does some multiplexing to turn the 7 interrupts into 14!
  254. Basically, of the 14 possible system interrupts, anything between 1 and 4 are
  255. handled by a single autovector. The interrupts generated can be set by the
  256. INTENA custom register. An interrupt is started by either hard or software
  257. writing into Paula's INTREQ register. Paula sees this and checks from her
  258. INTENAR register to see if the interrupt is meant to be on. If it is she
  259. causes the correct autovector exception to happen. This autovector should
  260. check which interrupt caused it, then turn off the correct INTREQ flag.
  261. Here is a table of interrupts:
  262.  
  263. Vec. Int. Name     Means this has happened
  264.  1    0   TBE      Generated by the CIA B chip - the serial port's transmit
  265.                    buffer is empty and needs refilling/restarting.
  266.  1    1   DSKBLK   Generated by Paula when the disk hardware has finished
  267.                    reading the specified disk track into memory
  268.  1    2   SOFTINT  Generated by exec - ie in software. Read the RKMs! A
  269.                    software interrupt is used to do lots of work that needs
  270.                    a higher priority than tasks but not interrupts.
  271.  2    3   PORTS    Generated by the CIA A timer chip
  272.  3    4   COPER    Generated by the copper at a specific screen location.
  273.                    This is a cheat - the copper is programmed by the coder
  274.                    to write $10 into INTREQ, but it allows the copper to
  275.                    identify itself as the source of the interrupt.
  276.  3    5   VERTB    Generated by Denise/Lisa when the vertical blank starts.
  277.                    The vertical blank is when the bottom of the screen is
  278.                    reached by the electron beam in the telly and it has to
  279.                    flick back up to the top of the screen.
  280.  3    6   BLIT     Generated by Agnus/Alice when the blitter finishes
  281.                    drawing.
  282.  4    7   AUD0     Generated by Paula when she finishes playing a sound on
  283.                    audio channel 2
  284.  4    8   AUD1     Generated by Paula when she finishes playing a sound on
  285.                    audio channel 0
  286.  4    9   AUD2     Generated by Paula when she finishes playing a sound on
  287.                    audio channel 3
  288.  4   10   AUD3     Generated by Paula when she finishes playing a sound on
  289.                    audio channel 1
  290.  5   11   RBF      Generated by the CIA B chip - the serial port's recieve
  291.                    buffer is full, and you should empty it for more data to
  292.                    get in.
  293.  5   12   DSKSYNC  Generated by Paula, when the disk hardware finds a disk
  294.                    syncword to indicate the start of a track. The reason
  295.                    this is such a high priority if because you only have a
  296.                    few microseconds to start the disk hardware reading or
  297.                    writing data before the disk has spun too far.
  298.  6   13   EXTER    Generated by the CIA B timer chip. This is more precise
  299.                    than the CIA A timer because it is guaranteed not to be
  300.                    preempted by another Amiga interrupt. Only the NMI can
  301.                    stop it, and that's not likely as only external hardware
  302.                    can cause one.
  303.  
  304. The interrupts are set by setting the interrupt flags affected, and the
  305. 15th bit to 1 - SETCLR. This sets the interrupts on. To turn them off,
  306. you must clear to 15th bit to 0. Eg. MOVE.W #INTF_SETCLR!INTF_RBF,intena(A5)
  307.  
  308. There is also a rumour that the master enable bit, bit 14, must also be set
  309. otherwise no interrupts take place. I firmly believe this is only valid in
  310. the Amiga's multitasking environment, where the exec interrupt handler
  311. disallows any interrupts that do not have the 14th bit set in INTENAR.
  312. You, however, may want to err on the side of caution.
  313.  
  314.  
  315. 5. Traps
  316. ~~~~~~~~
  317. Traps aren't really much use in the Amiga's multitasking environment.
  318. In other operating systems, the 16 traps represent up to 16 code libraries.
  319. The Amiga as you know has libraries, called by jumping to a negative offset
  320. from the start of the libraries base. The base is given to you by the exec
  321. function OpenLibrary. The execbase itself is available at $4.w. On the
  322. Apple Macintosh computer, you do a call something like this.
  323.  
  324.     MOVE.W    #0,-(SP)
  325.     MOVE.W    #0,-(SP)
  326.     MOVE.W    #200,-(SP)
  327.     MOVE.W    #128,-(SP)
  328.     MOVE.L    #GFX_DrawLine,-(SP)
  329.     TRAP    #1    ; graphics call
  330.  
  331. === INTERESTED PARTIES ONLY ===
  332. It's main advantage on the Macintosh is that it allows EVERY operating system
  333. call to be in supervisor mode. This is EXTREMELY anti-multitasking, but this
  334. is how the Mac works. This is also how the Acorn RISC machines work, and how
  335. PCs call MS-DOS. I'm not sure about Windows '95, though - it may not work
  336. that way, it _is_ pre-emptively multitasking, even if it does need 4 megs to
  337. do it.
  338. === INTERESTED PARTIES ONLY ===
  339.  
  340. A trap itself is very simple to do. All you do is make an exception handler,
  341. put it's address into the right trapvector (from $80 to $BC) and to call it
  342. you use the TRAP #x command. For example, TRAP #0 calls the $80 handler,
  343. TRAP #1 calls the $84 handler, TRAP #2 calls the $88 handler, etc.
  344.  
  345. The Sanity Operating System uses this method as well as the Amiga style
  346. method, for speed.
  347.  
  348. Did I mention the TRAPV command? It causes the TRAPV exception ($1C) if the
  349. overflow bit is set. I think it's silly, but who cares?
  350.  
  351. === INTERESTED PARTIES ONLY ===
  352. The most popular method in demos to get to supervisor mode is to do this:
  353.  
  354.     MOVE.L    mydemo,$80.W
  355.     TRAP    #0
  356. mydemo    ...
  357.  
  358. Sadly, for reasons that I've already mentioned, this doesn't work on 680x0s
  359. with their VBR moved. Stand up and take a bow BIG TIME SENSUALITY, TURMOIL
  360. ENIGMA, ELYSIUM, DESERT DREAM, MISERY, ALPHA AND OMEGA, VECTORKILLER,
  361. TECHNOLOGICAL DEATH, 242, STATE OF THE ART, JESUS ON E'S, HUMANTARGET,
  362. CLARIVOYANCE, HELIOPOLIS and a million other demos that I haven't had the
  363. misfortune to have a hack at.
  364.  
  365. You might like to know that I have written my own operating system called
  366. CadOS for AGA/020+ demos to use. Amongst other clever stuff like resource
  367. tracking, interrupt checking, fileloading with invisible decompression, iff
  368. viewing and screen making, it has built in code to move the VBR to Fast RAM,
  369. and back again for a speedup. It also allocates chip memory on 64bit
  370. boundaries, has sine and cosine wave creation, has user requesters before it
  371. starts, runs from an icon, deallocates all unfreed memory, has a seperate
  372. stack, has macros to pop from anywhere in the demo, even in an interrupt,
  373. halts the demo and returns safely to the user if you crash, has copper code
  374. creation, makes it easy to write to the AGA chipset, guarantees 100%
  375. detachment from the operating system and various other niceities. It should
  376. be distributed and available on Aminet by about mid-May.
  377. === INTERESTED PARTIES ONLY ===
  378.  
  379. 6. Examples of usage
  380. ~~~~~~~~~~~~~~~~~~~~
  381. This is only for coders who want to get low. The Amiga OS has plenty of good
  382. routines for using traps and interrupts, you don't _have_ to get your hands
  383. dirty if you don't want to. Read the AMIGA ROM Kernal manuals for more
  384. information about this, especially the LIBRARIES volume.
  385.  
  386. First, do this before _any_ low-level work:
  387.  
  388.     include    exec/exec_lib.i
  389.     include    hardware/custom.i
  390.     move.l    $4.w,a6
  391.     jsr    _LVOForbid(a6)
  392.     jsr    _LVODisable(a6)
  393.     lea    super(pc),a5
  394.     jsr    _LVOSupervisor(a6)
  395.     move.l    $4.w,a6
  396.     jsr    _LVOEnable(a6)
  397.     jsr    _LVOPermit(a6)
  398.     rts
  399. super    lea    _custom,a5
  400.     move.w    intenar(a5),-(sp)
  401.     or.w    #$c000,(sp)
  402.     move.w    dmaconr(a5),-(sp)
  403.     or.w    #$8200,(sp)
  404.     move.w    #$7fff,d0
  405.     move.w    d0,intena(a5)
  406.     move.w    d0,dmacon(a5)
  407.  
  408.     jsr    GetVBR
  409.     move.l    a0,vbrbase
  410.     moveq    #$100/4-1,d0
  411. .copy    move.l    (a0)+,-(sp)
  412.     dbra    d0,.copy
  413.  
  414.     jsr    begin
  415.  
  416.     lea    _custom,a5
  417.     move.w    #$7fff,d0
  418.     move.w    d0,dmacon(a5)
  419.     move.w    d0,intena(a5)
  420.  
  421.     move.l    vbrbase,a0
  422.     moveq    #$100/4-1,d0
  423. .copy2    move.l    (sp)+,(a0)+
  424.     dbra    d0,.copy2
  425.  
  426.     move.w    (sp)+,dmacon(a5)
  427.     move.w    (sp)+,intena(a5)
  428.     rte
  429. vbrbase    dc.l    0
  430.  
  431. begin    ...
  432.  
  433. This protects you from most things, but if you want REAL compatibility then
  434. get hold of my demo operating system, called CadOS. It's on Aminet as
  435. dev/asm/CadOS1_0.lha, and it contains a million beautiful things, including
  436. 100% compatibility with any AGA machine. It needs a 68020 or better.
  437. Anyway...
  438.  
  439. First, test ExecBase's AttnFlags to see if you are running on a 68010 or
  440. higher. If so, get the VBR. Otherwise, just use a pointer to $0.
  441.  
  442. GetVBR    ;returns VBR in a0
  443.     lea    $0.w,a0
  444.     move.l    4.w,a6
  445.     move.w    296(a6),d0
  446.     btst    #1,d0
  447.     beq.s    is68000
  448.     movec    VBR,a0
  449. is68000    rts
  450.  
  451. This next routine divides by any number, including zero. For zero, it returns
  452. near infinity, the biggest positive word-sized number the MC680x0 can handle.
  453.  
  454. Divide    ; does x/y where d0.w=x, d1.w=y
  455.     move.l    vbrbase,a0
  456.     lea    mydiv(pc),a1
  457.     move.l    a1,$14(a0)
  458.     divu    d1,d0
  459.     rts
  460. mydiv    move.l    #$7fff,d0    ; 65535, no remainder.
  461.     nop
  462.     rte
  463.  
  464. This next routine show how to multiplex a vertical blank based protracker
  465. routine, an interrupt queued blitter list and CIA A keyboard routine.
  466. (The routines for blitting, keyboard reading and protracker are not
  467. given themselves, they're just examples!)
  468. All the while the main processor task is waiting for the mouse button.
  469.  
  470.     include    hardware/intbits.i
  471.     include    hardware/dmabits.i
  472. main    jsr    pt_init
  473.     jsr    keyb_init
  474.     jsr    setup_blitterlist
  475.  
  476.     move.l    vbrbase(pc),a0
  477.     lea    lev2(pc),a1
  478.     move.l    a1,$68(a0)
  479.     lea    lev3(pc),a1
  480.     move.l    a1,$6C(a0)    ; install interrupt routines
  481.  
  482.     lea    _custom,a5
  483.     move.w    #INTF_SETCLR!INTF_INTEN!INTF_BLIT!INTF_VERTB!INTF_PORTS,intena(a5)
  484.     move.w    #DMAF_SETCLR!DMAF_MASTER!DMAF_BLITTER!DMAF_RASTER!DMAF_COPPER,dmacon(a5)
  485.  
  486.     jsr    otherinitstuff    ; like the screen
  487. waitmb    btst.b    #6,$bfe001
  488.     bne.s    waitmb
  489.  
  490.     move.w    #INTF_BLIT!INTF_VERTB!INTF_PORTS,intena(a5)
  491.     move.w    #DMAF_BLITTER!DMAF_RASTER!DMAF_COPPER,dmacon(a5)
  492.  
  493.     jsr    pt_end
  494.     jsr    blit_stop
  495.     jsr    keyb_stop
  496.  
  497.     rts
  498.  
  499. lev2    jsr    keyb_routine
  500.     move.w    #INTF_PORTS,intreq(a5)
  501.     nop
  502.     rte
  503.  
  504. lev3    move.l    d0,-(sp)
  505.     move.w    intreqr(a5),d0
  506.     btst    #INTB_VERTB,d0
  507.     beq.s    .notvb
  508.     jsr    pt_play
  509.     move.w    #INTF_VERTB,intreq(a5)
  510.     bra.s    .exit
  511. .notvb    ;btst    #INTB_BLIT,d0    ; we know inherently that it is a blitter
  512.     ;beq.s    .exit    ; interrupt, because only 2 sources cause us
  513.     jsr    next_blit
  514.     move.w    #INTF_BLIT,intreq(a5)
  515. .exit    move.l    (sp)+,d0
  516.     rte
  517.  
  518. Finally, to forcefully cause a blitter interrupt
  519.  
  520.     move.w    #INTF_SETCLR!INTF_BLIT,intreq(a5)
  521.  
  522.  
  523. 7. End
  524. ~~~~~~
  525. This document could do with more information about the alledged extra
  526. exceptions handled by the 68040 and others. I'm hoping this document will
  527. become the definitive resource for exception programming, like asp68k is
  528. for optimising. Contact Kyzer/CSG at 49 Fairview Road, AB22 8ZG, Scotland.
  529. Or phone (01224) 704117 in the UK after 7pm GMT. I am available for Amiga
  530. programming. EMail available in September. CSG's first AGA demo available
  531. eventually! Titled "Interesting Perversion". Also being written is the
  532. ultimate in Tetris experiences - Tertis v1.0!
  533.  
  534. Modules on Aminet by Kyzer/CSG:
  535. mods/rock/Magnetism.lha
  536. mods/techn/DivineFruits.lha
  537. mods/chip/KyzerzTchyppaz.lha
  538. mods/pro/RentShopBoys.lha
  539. mods/voice/sad-trod_remix.lha
  540.  
  541. I also upload a lot of other stuff, not by me. Examples include Owlz/CSG's
  542. saddistic collection. Give it a try!
  543.  
  544. mods/voice/sad-song.lha
  545. mods/voice/sad-tech.lha
  546. mods/voice/sad-frog.lha
  547. mods/voice/sad-trod.lha
  548.  
  549. |)/-\ |<¥z/-\ | A12002MbChip+0MbFast/NoHD/1DiskDrive/FuckedPRT | Swap/Code |
  550. Awesome coder | 600MbWarezClxn/250disk/LhA/DiskSpare/CøølIndex | Mus/Arcs/ |
  551. #1 CSG memba! | 49FairviewRoad/AB228ZG/SCOTLAND./(01224)704117 | Demos!!!! |
  552.  
  553.