Can anyone post some source code that, when compiled (if necessary) and run, will produce a 'Guru Meditation Error' on an Amiga.
Assembler, C or ARexx will do.
Thanks.
Can anyone post some source code that, when compiled (if necessary) and run, will produce a 'Guru Meditation Error' on an Amiga.
Assembler, C or ARexx will do.
Thanks.
Try the Alert()
function of the exec.library
: http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_3._guide/node01E3.html
For instance (in C):
#include <exec/execbase.h>
#include <exec/alerts.h>
#include <clib/exec_protos.h>
void main(void) {
Alert(ACPU_InstErr); /* or use 0x80000004 if you don't have alerts.h */
/* might not return if it was a dead end (non-recoverable) alert */
}
A good old division by zero can do the job.
#include <stdio.h>
void main() {
printf("%d", 1/0);
};
I'm not sure the divide by zero
method is the most direct one to invoke a Guru Mediation.
I tried on the actual AmigaOS3.1 and the divide by zero
error is caught by the OS before it ends up in the Guru we love :)
To be honest, I was even surprised that SAS/C would accept to compile this code. GCC is less tolerant:
astrofra@ubuntu: ~$ gcc main.c
main.c:3:17: warning: division by zero [-Wdiv-by-zero]
printf("%d", 1/0);
The AmigaOS Alert()
function is indeed recommended. I used it extensively at debugging stage when working on Athanor 2.