jpotter@ucs.adelaide.edu.au (Jonathan Potter) (06/14/91)
How do I find out what version of Kickstart is running, in an OS friendly way? Under 1.3, location $fc000c contains it, but this doesn't work under 2.0. Please mail replies if you can help. Thanks. Jon -- | Jon Potter | | I'd really like to | | P.O. Box 289 | jpotter@itd.adelaide.edu.au | change the world... | | Goodwood, SA | FidoNet : 3:680/829 | But they won't give me | | Australia 5034 | | the source code. |
peic@core.north.de (Peter Eichler) (06/16/91)
In article <3646@sirius.ucs.adelaide.edu.au>, Jonathan Potter writes: >How do I find out what version of Kickstart is running, in an OS friendly way? ^^^^^^^^^^^ >Under 1.3, location $fc000c contains it, but this doesn't work under 2.0. ^^^^^^^^^^^^^^^^ This is *definitely* NOT OS friendly, if you look at a particular address to get a version number!!! Remember: Only $00000004, which contains the pointer to SysBase is a fix address; all other locations may vary in future versions! So please: NEVER NEVER peek into RAM or ROM (the old Basic times are over now), otherwise your application won't run (or even worse: it will crash) on different OS versions. The easiest (and IMHO one of the "cleanest") methods is simply to look at the version of ExecBase: #include <stdio.h> #include <exec/types.h> #include <exec/libraries.h> #include <proto/exec.h> /* or "functions.h" for Aztec */ struct Library *ExecBase; UWORD Version, Revision; ExecBase = OpenLibrary("exec.library", 0); if(ExecBase) { Version = ExecBase->lib_Version; Revision = ExecBase->lib_Revision; printf("Version: %ud; Revision: %ud\n", Version, Revision); CloseLibrary(ExecBase); } else printf("Couldn't open ExecBase!!!\n"); >Please mail replies if you can help. Thanks. >Jon Hope, that will help you... Peter Q:What's the problem of being drunk? A:Ask a glass of water. (Hitchhiker) ------------------------------------------------------------------------------ SNAIL:Peter Eichler \ Hegelstrasse 3 \ 2800 Bremen 1 \ Germany Amiga 3000 EMAIL:peic@core.north.de OR peic@skuld.north.de: VOICE:(+)49 421 530642
mks@cbmvax.commodore.com (Michael Sinz) (06/17/91)
In article <3646@sirius.ucs.adelaide.edu.au> jpotter@ucs.adelaide.edu.au (Jonathan Potter) writes: >How do I find out what version of Kickstart is running, in an OS friendly way? >Under 1.3, location $fc000c contains it, but this doesn't work under 2.0. > >Please mail replies if you can help. Thanks. Well, from the source code to workbench, here is what I do: (Oh, it does not work in 1.3 but does in 2.0 so you should check if exec is V36 or better first...) /* * AboutWorkbench * * This routine puts up the requester when About is selected... */ void AboutWorkbench(void) { struct Library *lib; struct EasyStruct es = {sizeof(struct EasyStruct),NULL,SystemWorkbenchName,NULL,NULL}; ULONG args[11]; args[6]=~0; args[7]=0; if (lib = (struct Library *)OPENLIBRARY("version.library", 0)) { args[6] = lib->lib_Version; args[7] = lib->lib_Revision; CLOSELIBRARY(lib); } es.es_TextFormat=VersionFormat; es.es_GadgetFormat=Quote(Q_OK_TEXT); args[0]=(ULONG)KickstartName; args[1]=args[5]=(ULONG)Quote(Q_VERSION_TITLE); args[2]=SysBase->lib_Version; /* Kickstart version */ /* This next line only works if args[2] >= 36 */ args[3]=((struct ExecBase *)SysBase)->SoftVer; /* Kickstart revision */ args[4]=(ULONG)SystemWorkbenchName; /* args[5]=args[1]; */ /* args[6]=version */ /* args[7]=revision */ args[8]=(ULONG)Copyright; args[9]=(ULONG)Copyright2; args[10]=(ULONG)Copyright3; EasyRequestArgs(WbBASE->wb_BackWindow,&es,NULL,args); } -- Mike /----------------------------------------------------------------------\ | /// Michael Sinz - Amiga Software Engineer | | /// Operating System Development Group | | /// BIX: msinz UUNET: rutgers!cbmvax!mks | |\\\/// Programming is like sex: | | \XX/ One mistake and you have to support it for life. | \----------------------------------------------------------------------/