------------------------------------------ 68000 architecture by John 'Boil' van Dijk ------------------------------------------ As you all may know are the Amiga and Atari computers based on the same processor, the Motorola 68000, introduced late 70's and in 1989 still one of the most used ones. Motorola didn't sat back and cashed in but made the 68010,20,30 series. There are two different versions of the 68000 chip, a dual-in-line and a pin-grid casing. The first one is in your Amiga and has 64 pins, 32 on both sides. The pin-grid is more compact and just like the word says it looks like a square that has a grid with 64 pins on it. The advantage of the 68000 is that it can run on different clockspeeds 4,6,8,10,12.5 MHz or 7,16 like the Amiga. This clockfrequency is responsible for the speed machine-code is carried out and so setting the speed of a computer. In fact the Amiga is slower than the Atari because that 68000 runs on 8 MHz, only the special chips in the Amiga make the computer special. The 68000 is a 16-bit based processor that takes 1,5 Watt from your powersupply, quite high when you know that the 5 Volts must take 300 mA for such a little thing. For addressing the 68000 has 24 lines so a simple sum (2^24) says that you can address 16 Megabytes. Wrong ! Amiga needs so much memory (e.g. extra copys of the kickstart and lots of CIA and hardware copies in memory) and doesn't use certain parts so 8 Mbytes is tops. Haha, I lied, there are no 24 lines only 23 (I needed that for my 8 Megabytes floating around explenation) because line A0 doesn't exist, that is the reason why odd addresses are forbidden for wordintruction and will cause an address exception, more about that later. Remember the C64 old 8 bits registers (only 3)? The 68000 has 8 dataregisters all 32 bits and 8 address registers also 32 bits called d0-d7 and a0-a7. Unlike most people think there are 2 stackpointers, one called SP or addressregister A7 and the USP (UserStackPointer) or A7'. These are ofcourse NOT the same. The Programcounter (PC) keeps the address of the next instruction that has to be carried out. Last the Statusregister (SR), 16 bits, Bits 0-7 for user and 8-15 for the supervisor. There are two different workmodes, the Supervisor and the Usermode. This explains the two stackpointers. In the Usermode (normal) you only can use the Userbyte, which holds the different flags for the Branch and Set instructions (you know like BEQ, SCC) which will be set or reset during math-instructions. The 68000 has special a facility that can react on errors called exceptions, exceptions are errorreports of the processor (e.g. an odd address) and are only from the 68000 and not from the Amiga (so an Atari has the same) For these exceptions are vectors situated in the first 1024 bytes of RAM memory. That makes 256 vectors, the first 64 for the 68000 and the rest for you. (256-64=192) So the lowest startaddress of your programs can be $400 or even lower when you know the program has no bugs ! This is ofcourse only when you don't use Amiga kickstart libraries and structures but pure hardware coding (Do I hear somebody swear ?) When you handle these exceptions right you could prevent the computer from crashing, Kickstart 1.4 will do this (finally) because the errorhandling in the current kickstarts still isn't optimal. A lot of software failures could be handled without crashing the computer like it is now. You have an exception when the guru is 00000002 until 0000000B. This is what happens then ; Important information is saved on the stack (like SR and returnaddress or PC) and the 68000 goes into supervisor mode, the corresponding vector will be loaded and the subroutine called. It is also possible to create exceptions of your own by using the TRAP command e.g. 'TRAP #0', you can have 16 of these things and the vectors are located from $80. Just load the vector with an jumpaddress and give the corresponding trap whenever you want. A lot Atari routines are called like this. Did you ever come across the INTREQ and INTENA hardware registers ? Well it says 14 interrupts, but the documentation of 68000 processor says only 7 possible ? The answer is that some of the Amiga interrupts are using the same interrupt (e.g. the AUDIO channels all use level 4), but still can cause their own interrupt. Every interrupt level has it's own interrupt vector from $64 (1) 'till the NMI $7c (7). The masterinterrupt, the one with the highest level called Non- Maskable-Interrupt which means that you can't influence it (unlike the 64) has absolute priority. After that comes level 6 ($78) and the row down. If you follow the level 4 interrupt ($70) you can clearly see the routine checking for which channel and then jumping to the right address to execute. Once again you can generate an interrupt of your own by setting the right bits in $dff09a and $dff09c. Take care that not all interrupts are generated 50 times a second but you will think of a solution for that won't you ? To exchange datas faster the 68000 has Direct Memory Access or DMA for short. These are seperate lines for datatransfer without bothering the 68000 processor. DMA makes it possible for the Amiga to play samples and using almost no processortime, it can speed a computer up incredibly. On the transputerboards (multiple processor technique) they use a lot of DMA channels to exchange processor information. To get back to the level 4 interrupt (you know the samples), located in the hardware register from $dff0a0 are the special soundregister of the 4 channels, four identical ones, ADKCON has some special features to influence playing the samples. The DMA gets the startaddress, lenght, speed and volume and can play the play the sample forever, only stealing some cycles to wrap the sample again. Happy programming and may the guru with you until KickStart V1.4, John.