Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!edcastle!hwcs!neil From: neil@cs.hw.ac.uk (Neil Forsyth) Newsgroups: comp.sys.atari.st Subject: Re: Questions on Desktop/Environment Keywords: Desktop Environment Message-ID: <3101@odin.cs.hw.ac.uk> Date: 30 May 91 08:27:36 GMT References: <1991May29.154140.5510@informatik.uni-erlangen.de> Sender: news@cs.hw.ac.uk Reply-To: neil@cs.hw.ac.uk (Neil Forsyth) Distribution: comp.sys.atari.st Organization: Computer Science, Heriot-Watt U., Scotland Lines: 79 In article <1991May29.154140.5510@informatik.uni-erlangen.de> csbrod@immd4.informatik.uni-erlangen.de (Claus Brod) writes: >tnzoerne@faui09.informatik.uni-erlangen.de (Thorsten Zoerner) writes: >>Is there any way to reckognize from out of an Accessory if the >>aktual process is the Desktop (when receiving an acc_open) ? > >No legal way, unfortunately. (Correct me if I'm wrong.) OK :-) BTW: Atari UK say this is 'OK' to talk about. When an accessory is starting up it should get the address of the OS header at $4F2. This usually points to the start of the ROM, wherever it is, but AHDI might change it. Either way what it points to is, or should be, consistant. At $28 offset from the start of the structure $4f2 points to is a pointer to the process ID of the current process. This is actually its basepage. For an accessory that is starting up this will be the PID of the GEM Desktop since accessories are not processes in the true sense, ie. they belong to the AES and Desktop. The accessory can save this PID and compare it to the current value when the accessory is activated from the menu. If it's the same then we are on the desktop. If not then we are in a program. Actually this is quite handy for adding modules to an existing program. Caveat: This PID pointer does not exist in TOS 1.0. For that ROM version its value is 0x602C execpt for the Spanish ROM where it is at 0x873C. The TOS version is found at offset $2 from the start of the OS header and the country is encoded at offset $1C but the lowest bit is screen freq. eg. ; long *get_pid() ; Return PID pointer for any ROM version. ; (Note: Call this in Super mode for access to _sysbase) SPA: EQU 4 ; Spain country code _sysbase: EQU $4F2 _get_pid:: MOVE.L _sysbase,A0 ; A0 -> OS header CMP.W #$0100,2(A0) ; Is this the old TOS? BEQ.S .old MOVE.L $28(A0),D0 ; D0 = PID address in modern ROMs BRA.S .done .old: MOVE.W $1C(A0),D0 ; D0 = Country and screen freq. LSR.W #1,D0 ; D0 = Country code CMP.W #SPA,D0 ; Is it Spain? BNE.S .other MOVE.L #$873C,D0 ; D0 = Spanish PID BRA.S .done .other: MOVE.L #$602C,D0 ; D0 = Rest of the world PID .done: RTS ; return(D0); END Note the complete lack of XBRA usage in the above example! :-) +----------------------------------------------------------------------------+ ! DISCLAIMER:Unless otherwise stated, the above comments are entirely my own ! ! ! ! "I think all right thinking people in this country are sick and tired of ! ! being told that ordinary decent people are fed up in this country with ! ! being sick and tired. I'm certainly not and I'm sick and tired of being ! ! told that I am!" - Monty Python ! ! ! ! Neil Forsyth JANET: neil@uk.ac.hw.cs ! ! Dept. of Computer Science ARPA: neil@cs.hw.ac.uk ! ! Heriot-Watt University UUCP: ..!ukc!cs.hw.ac.uk!neil ! ! Edinburgh, Scotland, UK ! +----------------------------------------------------------------------------+