Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Detecting Kickstart version from AMOS Pro  (Read 4921 times)

0 Members and 2 Guests are viewing this topic.

woody.cool

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 9
Detecting Kickstart version from AMOS Pro
« on: February 02, 2014, 09:22:34 PM »

Hi all,

It's been a long time since I looked on here, but I went to a recent retro meetup Hungry Horace reminded me of AMOS Factory.

Anyway, getting to the point, I was wondering if it's possible to detect/check version of Kickstart that AMOS or compiled program is running under?

I've tried using Trap Lib Open("exec.library",37) which is fine under 2.0 or above but gurus on 1.3 - I'm looking for a 'clean' way to do this.

I've got AMCAF, AMOS Explode library (see here) and Easylife extensions installed - I'm using AMOS Pro v2.0

Cheers
woody.cool
Logged

woody.cool

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 9
Re: Detecting Kickstart version from AMOS Pro
« Reply #1 on: February 04, 2014, 06:31:11 PM »

Anybody?
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Detecting Kickstart version from AMOS Pro
« Reply #2 on: February 04, 2014, 08:43:17 PM »

You might be able to use Deek in AMOS to find out the kickstart version.
A quick search found this ASM code:

Code: [Select]
   move.l   $4.w,a6         ; get execbase
   moveq   #0,d1
   move.w   $14(a6),d1      ; KS version (1.3 = version 34)

So in AMOS you might be able to use KICKSTART=Deek($18). You'd have to know which Kickstart's the returned number/s represent to interpret them properly.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Detecting Kickstart version from AMOS Pro
« Reply #3 on: February 05, 2014, 02:05:09 AM »

You might be able to use Deek in AMOS to find out the kickstart version.
A quick search found this ASM code:

Code: [Select]
   move.l   $4.w,a6         ; get execbase
   moveq   #0,d1
   move.w   $14(a6),d1      ; KS version (1.3 = version 34)

So in AMOS you might be able to use KICKSTART=Deek($18). You'd have to know which Kickstart's the returned number/s represent to interpret them properly.

Not quite right!  It's offset $14 from the address stored in address $00000004.  So:
Code: [Select]
G_KICKSTART=Deek(Leek($4)+$14))
In answer to the question:  I would recommend checking for WB1.3 first.  If it's WB1.3 or less, forget doing anything using the OS.  If it's V2.0 or above, only then attempting to use the OS library calls.

I usually hesitate to get involved with questions like this from lack of experience and the thought that everyone else must surely know a lot more about theses things than me.  However, from documenting and bug fixing in AMOS Pro, I've gleaned the following stuff.  I would be very pleased if anyone else can supply more info...

AMOS already does all the checking when it starts up and loads and initialises the data areas for amiga.library - the ones pointed to by A5 whilst a program is running.  So the following locations may also be of interest:

Kickstart Version Number
Assembler
move.w     WB2.0(a5),<ea destination>
AMOS
Code: [Select]
G_KICKSTART=Deek(Areg(5)+$414
AMOS uses this to check for WB1.3 versus WB2.0 and above.  If it's zero, you're in WB1.3 land and need to be very careful what you're calling in the libraries.  It appears to an Amiga OS novice like myself that WB1.3 is really only in existence for old games compatibility and should be avoided for anything "serious"  ;)  Otherwise the location contains the version number.  See also the LoadView flag below.

Check for AA Chipset
Assembler
btst     #WFlag_AA,T_WFlags(a5)
AMOS
Code: [Select]
G_WFLAGS=Deek(Areg(5)-23
GF_AA=Btst(0,G_WFLAGS)

Set if AMOS is running on a machine with the AA chipset.  Note that the code that sets this flag is doing a software check, not a hardware check.  So expect this flag to be cleared if running in anything under WB3.0 even if the machine has the AA chipset in hardware.  In which case you couldn't do anything with the chipset unless you wrote everything yourself and completely disabled the OS.  So I reckon it's a better indicator than checking the hardware (which is always a bit risky!).

Check for LoadView (WB version = 39 or above)
Assembler
btst     #WFlag_LoadView,T_WFlags(a5)
AMOS
Code: [Select]
G_WFLAGS=Deek(Areg(5)-23
GF_LOADVIEW=Btst(4,G_WFLAGS)

Set for a WB version of 39 or over.  AMOS uses a different LoadView routine if running on the later versions.

(Note how I carefully avoided what all those version numbers actually mean as I don't know how to relate them to WB1.3, WB2.x, WB3.x, etc.   ;D   Any references above are just derived from comments in the AMOS sources.  Anyone got a useful list, or knows where that may be found?)

Putting the above all together:

Code: [Select]
'=======================================
' A short demo of some of the system info
' that AMOS can supply:
'
'    Kickstart Version
'    AA Chipset Available? (but false if
'         not running WB 3.0 or above)
'    Kickstart 39 or over? (requires
'         different LoadView routines)
'
' Author: bruceuncle
'   Date: 05/02/2014
'
' Offsets from A5:
'
Global G_WB2_0,G_T_WFLAGS
G_WB2_0=$414
G_T_WFLAGS=-23
'
' Bit positions in G_T_WFLAGS(A5):
'
Global G_WFLAG_AA,G_WFLAG_LOADVIEW
G_WFLAG_AA=0
G_WFLAG_LOADVIEW=4
'
' Results:
'
Global G_KICKSTART,GF_AA,GF_LOADVIEW

A=Leek($4)

G_KICKSTART=Deek(Areg(5)+G_WB2_0)
GF_AA=Btst(G_WFLAG_AA,Areg(5)+G_T_WFLAGS)
GF_LOADVIEW=Btst(G_WFLAG_LOADVIEW,Areg(5)+G_T_WFLAGS)

Print "     Kickstart Version: ";G_KICKSTART
Print "            AA Chipset: ";
If GF_AA Then Print "True" Else Print "False"
Print "V39 or over (Loadview): ";
If GF_LOADVIEW Then Print "True" Else Print "False"

Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

OlafS3

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 7
Re: Detecting Kickstart version from AMOS Pro
« Reply #4 on: February 05, 2014, 09:38:12 AM »

I am building up a "extension" reference here (work in progress :-) )

http://www.aros-platform.de/html/amos_pro_extensions.html

In Intuiextend there is this command:
Sys Kickstart

Not looked in in detail
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Detecting Kickstart version from AMOS Pro
« Reply #5 on: February 05, 2014, 05:12:03 PM »

You might be able to use Deek in AMOS to find out the kickstart version.
A quick search found this ASM code:

Code: [Select]
   move.l   $4.w,a6         ; get execbase
   moveq   #0,d1
   move.w   $14(a6),d1      ; KS version (1.3 = version 34)

So in AMOS you might be able to use KICKSTART=Deek($18). You'd have to know which Kickstart's the returned number/s represent to interpret them properly.

Not quite right!  It's offset $14 from the address stored in address $00000004.  So:
Code: [Select]
G_KICKSTART=Deek(Leek($4)+$14))

Bah!

Thanks for correcting my oversight (only just getting back into ASM after a 6 month break).
Logged

woody.cool

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 9
Re: Detecting Kickstart version from AMOS Pro
« Reply #6 on: February 05, 2014, 06:39:34 PM »

Cheers guys, you've all given me a lot to play with.
I'll provide feedback once I've tried this lot out.
Logged

Hungry Horace

  • Amorphous Blue-Blob Man
  • Site Admin
  • A4000T
  • ******
  • Karma: 307
  • Offline Offline
  • Gender: Male
  • Posts: 3,364
  • Don't forget... Ameboid's need love too!
    • AUW
Re: Detecting Kickstart version from AMOS Pro
« Reply #7 on: February 07, 2014, 04:16:07 PM »

hey woody.cool! Glad to see you back here!

I will get that Horace Goes Skiing code uploaded for you some time soon :)

Logged
Quote from: KillerGorilla
because winuae is made of code and your amiga is made of stuff

Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022