Saturday, September 28, 2019

Guru Meditation

Way back in 1982 or 1983, a small company named Amiga designed and built a peripheral for computers known as the 'joy board'. Imagine a very early Wii Balance Board and you wouldn't be too far wrong.

Amiga Joyboard
The developers of the Amiga took to sitting on one of these boards and playing a simple game that required the user to sit as still as possible to achieve maximum zen and attain a state of nirvana. This normally occurred after a programming session had resulted in another inevitable crash. And thus the Amiga's famous 'Guru Meditation' error was born.

A flashing red box with unhelpfully cryptic text would appear when the software on the Amiga crashed. More useful than the PCs dead black screen (this is prior to Windows and its blue screen of death) and it was inspired by the Apple Mac which, when it crashed, would display a picture of a bomb i.e. the software bombed...

A Classic Guru

But the code in the box can be more helpful than you'd think. It gives some clue as to what the heck happened. Below is a compilation of information that I gathered from the internet after I had problems with my A500++. I realised that there is no easy description of the codes I was encountering. So here it is. No warranty implied yadda, yadda, yadda etc.

For information the Guru I kept getting was one of the following:

     80000003.0000xxxx
     80000004.00003E78

Guru numbers are made up of two 8 digit numbers where the numbers are hex values. The first part is most useful as it contains information on the actual error. The second part is usually the address in memory of the task where the problem occurred.


      Specific error code -----+         +--- Task Address
                               |         |
                       02 01 0008 . 00007250      
                        |  |
      Subsystem number -+  +--- General error code

Guru - General Format


The first part of the number can be grouped by splitting up the first eight hexadecimal digits. Each digit is made of four bits allowing up to 16 values (0 to 9 and A to F). The first two digits show the part of the operating system that caused the error (or subsystem ID), the next two digits the general error codes and the final four digits the specific error code.

If the first digit, reading left to right, has it's most significant bit set i.e. binary '1xxx', this is the value 8. This means that this is a 'Dead End' error and that there is no way back for the task to recover. Those 'dead end' errors detected by the CPU have '80' as their first two digits. See more details of this later on in the post.

Note that the most significant bit being set can apply to any of the subsystem IDs so, for example, an error in the Graphics Library which is subsystem ID '02' would be indicated as 'dead end' by being set to '82'. (But, let's be honest. If the system has reached the point that it is displaying the red alert box then you're not really going back from that!)

If it so happens that the first digit of the Guru is greater than 7 (in hex) then simply subtract 8 from it. For example, if the first two digits are A1 then take 8 away from the first digit i.e. A - 8 = 2 so the error would be on subsystem ID 21 or Disk Resource.

Just a note that at the bottom of this list of codes I talk about CPU traps. It's important so don't think you've reached the end just because of the lists!

Subsystem ID Codes

Exec Library        01     Console Device      11
Graphics Library    02     GamePort Device     12
Layers Library      03     Keyboard Device     13
Intuition Library   04     TrackDisk Device    14
Maths Library       05     Timer Device        15
CList Library       06     CIA Resource        20
DOS Library         07     Disk Resource       21
RAM Library         08     Misc Resource       22
Icon Library        09     BootStrap           30
Audio Device        10     Workbench           31

Following on from the subsystem ID is the 'general' error code. For many cases this is a simple '00' as the final four digits will give more 'specialised' information. General error codes are:

Insufficient memory   01    OpenDevice error    04
MakeLibrary error     02    OpenResource error  05
OpenLibrary error     03    I/O error           06

The final four digits describe the specific error code relating to the subsystem which encountered the error. Shown below are some of the specific error codes for the different subsystems:

Exec Library
ExcptVect      0001    CPU trap vector checksum
BaseChkSum     0002    ExecBase checksum error
LibChkSum      0003    library checksum failure
LibMem         0004    no memory to make library
MemCorrupt     0005    corrupted free memory list
IntrMem        0006    no memory for interrupt servers
               0009    attempt to free already free memory
               000C    total memory mismatch free space plus used

Graphics Library
CopDisplay     0001    copper display list, no memory
CopInstr       0002    copper instruction list, no mem.
CopListOver    0003    copper list too long
CopIListOver   0004    copper intermediate list too long
CopListHead    0005    copper list head, no memory
LongFrame      0006    long frame, no memory
ShortFrame     0007    short frame, no memory
FloodFill      0008    flood fill, no memory
TextTmpRas     0009    text, no memory for TmpRas
BltBitMap      000A    BltBitMap, no memory

Intuition Library
GadgetType     0001    unknown gadet type
CreatePort     0002    create port, no memory
ItemAlloc      0003    item plane alloc, no memory
SubAlloc       0004    sub alloc, no memory
PlaneAlloc     0005    plane alloc, no memory
ItemBoxTop     0006    item box top < RelZero
OpenScreen     0007    open screen, no memory
OpenScrnRast   0008    OpenScreen's AllocRast, no mem.
SysScrnType    0009    open sys screen, unknown type
AddSWGadget    000A    add SW gadgets, no memory
OpenWindow     000B    open window, no memory
BadState       000C    Bad State Return entering Int.
BadMessage     000D    Bad Message received by IDCMP
WeirdEcho      000E    Weird echo causing problem
NoConsole      000F    couldn't open the Console Device

DOS Library
StartMem       0001    no memory at startup
EndTask        0002    EndTask didn't
QPktFail       0003    Qpkt failure
AsyncPkt       0004    Unexpected message received
FreeVec        0005    Freevec failed
DiskBlkSeq     0006    Disk block sequence error
BitMap         0007    Bitmap corrupt
KeyFree        0008    Key already free
BadChkSum      0009    Invalid checksum
DiskError      000A    Disk Error
KeyRange       000B    Key out of range
BadOverlay     000C    Bad overlay

TrackDisk Device
TDCalibSeek    0001    calibrate: seek error
TDDelay        0002    delay: error on timer wait

Timer Device
TMBadReq       0001    bad request
Disk Resource
DRHasDisk      0001    get unit: already has disk
DRIntNoAct     0002    interrupt: no active unit

BootStrap
BootError      0001    boot code returned an error


There is a 'special' type of Guru that is not caused by the operating system (or more accurately the ROM Kernel) but is as a result of the CPU trapping an error. When these happen, the subsystem ID and general error code will both be set to zero (but bear in mind the '8' indicating a 'dead end' error!). The 'specific' error describes the error that has been trapped by the CPU. It's worth remembering that the error numbers here are part of the 68000 CPU and are not assigned by the ROM Kernel.

The possible CPU traps are:

80000002 - Bus error - accessing non-existent RAM or hardware
80000003 - Address error - word stored on odd memory boundary
80000004 - Illegal Instruction 
80000005 - Division by zero - a bad idea
80000006 - CHK instruction
80000007 - TRAPV (overflow)
80000008 - Privilege violation
80000009 - Instruction trace
8000000A - Line A Exception (4096 opcodes not used in Amiga)
8000000B - Line F Exception - inappropriate FPU or MMU opcode


So, going right back to my initial problem, the two Guru codes I keep getting are telling me that in the case of 80000003 there is an address error, in that data is being written across an inappropriate memory boundary and that in the case of 80000004 an illegal instruction has been detected which is possibly the CPU attempting to execute data. This points to a potential memory problem, either in the memory chips themselves or in the configuration of the memory at startup.


My Guru.

My Guru Generator...

I need to go and meditate on what exactly my problem is. Anyone got a Joy Board spare?

No comments: