Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
detect AGA example
  • Loading branch information
steffest committed Oct 23, 2017
1 parent 30fe3ba commit acdac49
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
36 changes: 36 additions & 0 deletions detectAGA/detect.c
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <proto/exec.h>
#include <graphics/gfxbase.h>

struct GfxBase *GraphicsBase;

main()
{
int isAGA = 0;

// first AGA Amiga had V39
// V37 is found in kickstart 2.04
// V34 in kickstart 1.3
int version = 39;
GraphicsBase=(struct GfxBase *)OpenLibrary("graphics.library",version);

if (GraphicsBase){
printf("Graphics.library V%d OK \n",version);
isAGA = (GraphicsBase->ChipRevBits0 & GFXF_AA_ALICE) > 0;
printf("has AGA: %d \n",isAGA);
CloseLibrary((struct Library *)GraphicsBase);
}else{
printf("No AGA \n");
version = 37;
GraphicsBase=(struct GfxBase *)OpenLibrary("graphics.library",version);
if (GraphicsBase){
printf("Graphics.library V%d OK \n",version);
CloseLibrary((struct Library *)GraphicsBase);
}else{
printf("Graphics.library Version lower then 37 \n");
}
}

return 0;

}
23 changes: 23 additions & 0 deletions helloWorld/hello.c
@@ -0,0 +1,23 @@
/*
* Hello world using AmigaOS API.
*/

#include <proto/exec.h>
#include <proto/dos.h>
#include <string.h>

main(int argc, void *argv[])
{
struct Library *SysBase;
struct Library *DOSBase;

SysBase = *((struct Library **)4UL);
DOSBase = OpenLibrary("dos.library",0);

if (DOSBase) {
Write(Output(),"Hello world !\n",13);
CloseLibrary(DOSBase);
}

return(0);
}

0 comments on commit acdac49

Please sign in to comment.