Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!dkuug!imada!micro From: micro@imada.ou.dk (Klaus Pedersen) Newsgroups: comp.sys.atari.st.tech Subject: Re: Force Desktop Res Change? Message-ID: <1991May23.163442.12276@imada.ou.dk> Date: 23 May 91 16:34:42 GMT References: <1991Apr28.014020.3838@lonex.radc.af.mil> <3094.05.91@drdhh.hanse.de> <1991May12.234615.15781@wam.umd.edu> <91133.112834ONM07@DMSWWU1A.BITNET> <1991May13.121912.16552@informatik.uni-erlangen.de> <2941@atari.UUCP> <1991May17.115339.20960@informatik.uni-er Sender: news@imada.ou.dk (USENET News System) Organization: Dept. of Math. & Computer Science, Odense University, Denmark Lines: 183 csbrod@immd4.informatik.uni-erlangen.de (Claus Brod) writes: >>>But this also means that I don't have any chance to do >>>parameter fiddling _before_ AES or VDI do their job unless I wait >>>for AES to come up, and then install my own Trap #2 handler. Yes I follow you now, I thought that the AES was as nice as the VDI. But it isn't - it eats all AES function calls (it don't link to the next in the Gem-vector-chain...). It replaces the trap #2 vector at least 2 times, this surpriced me, and the program that I tried to install. I tried to install a trap#2 routine that would install a AES handler when the AES had initilized itself. The first solution to this problem I thought about was to monitor the trap#2 vector for a non-XBRA routine, but AES unlinked the routines (I had a number of clones, that could be hooked in the vector, and shoot (w. RTS) if they failed). Then I thought that a OpenScreenWorkstation would tell when the AES was init. but a quick check showed that auto-folder programs also can open and close workstations, too - soo :-( Things would be much more easy if there was an exec_aes ;-) or a bit-vector where one could tell which part of the OS that had been init.'ed. (AND a bit-vector called >in_TOS< so that one could use Tos semi-reenterent) At this point I began to doubt that it could be done (legally)... So I tried to look at formdoit, but that did not help. Then I looked through all my docs, AES (see about), VDI (can't be used), Gemdos (likevise), Xbios (do), Bios - now here were something - setexc(), did AES enable it's own trap handler with this? A small program showed that it didn't, but there were something else, yes it enabled the evnt_critic vector with it!!! - heureka! Now - is it legal to assume that it will always be this way? Allan P.? Ken B.? - is it? You have not been very help-full on this subject, so I include a small program that uses the principe. Please flame this Allan and Ken, then tell how we are supposed to do it!! The program Form_Pop makes the dialogs pop-up under the pointer, real usefull for Julians R.'s BigScreen... Comments please! Klaus, micro@imada.ou.dk >Claus Brod, Am Felsenkeller 2, Things. Take. Time. ------ cut here --------- Turbo Ass - Again -------- gemdos EQU 1 Gem EQU 2 Bios EQU 13 Ptermres EQU 49 ; gemdos Cconws EQU 9 ; gemdos xbios EQU 14 Supexec EQU 38 ; xbios Setexc EQU 5 ; bios GemVector EQU $80+4*Gem ; hook into GEM longframe EQU $059E * SOME LINEA VARIABLES * MouseY EQU -$0258 MouseX EQU -$025A v_rez_hz EQU -$0C v_rez_vt EQU -$04 XBRAID EQU 'FPop' first: bra install **** THIS IS A ZOOMBIE THAT INSTALLS THE AES-HANDLER **** ** If when it have done it's job or it fails, it gives ** ** itself a silver bullet through the Heart (RTS) ** ******************' '*********************** ZombTrap EQU Bios DC.B 'XBRA' ; XBRA identifier DC.L XBRAID ; program ID DS.L 1 ; old vector Zoombie: move.l Zoombie-4(PC),-(SP) ; Push the address old routine MyHeart: move USP,A0 btst #5,4(SP) ; called from Supervisor- or User-mode? beq.s tst_funcs ; Parameter is on USER stack lea 6+4(SP),A0 ; Old (small) stack frame. tst.w longframe.w ; Is this running on a CPU beq.s tst_funcs ; with a long stackframe? addq.w #2,A0 ; -then add 2 more bytes. tst_funcs: cmpi.w #Setexc,(A0)+ ; Check the funcion number. bne.s Bullet cmpi.w #$0101,(A0) ; Is the desktop installing ErrorBoxes? bne.s Bullet ; NO -> then wait. lea GemHook-4(PC),A0 move.l GemVector.w,(A0)+ ; Put AES handler in the Chain. move.l A0,GemVector.w move.w Bullet(PC),MyHeart ; Give the Zoombie the silver Bullet Bullet: rts ********* THIS IS THE GEM-HOOK ITSELF ******************************** DC.B 'XBRA' ; XBRA identifier DC.L XBRAID ; program ID DS.L 1 ; old vector GemHook: cmp.w #200,D0 ; is it a call to the AES? bne.s not_AES ; NO -> call next move.l A0,SaveRegs movea.l D1,A0 movea.l (A0),A0 ; get pointer to control[] cmpi.w #54,(A0) ; call to form_center? beq.s FRM_CNTR ; YES -> Replace movea.l SaveRegs(PC),A0 not_AES: move.l GemHook-4(PC),-(SP) ; Push the address old routine rts ********** THIS IS THE NEW FORM CENTER ******************************* FRM_CNTR: movem.l D0-D3/A0-A2,SaveRegs movea.l D1,A0 movea.l 12(A0),A1 ; get int_out pointer. move.w #1,(A1)+ ; fill in fo_cresvd movea.l 16(A0),A0 ; get addr_in pointer movea.l (A0),A0 ; get pointer to the Object lea 16+4(A0),A0 ; get pointer to w,h in object movea.l LineA(PC),A2 move.w MouseX(A2),D0 ; Get x-pos of the pointer move.w v_rez_hz(A2),D2 ; Get width of screen moveq #4,D3 bsr.s CenterAndLimit move.w MouseY(A2),D0 ; Get y-pos of the pointer move.w v_rez_vt(A2),D2 ; Get height of screen moveq #21,D3 bsr.s CenterAndLimit movem.l SaveRegs(PC),D0-D3/A0-A2 rte CenterAndLimit: move.w (A0)+,D1 ; Read width/height of Object addq.w #8,D1 ; & add border. move.w D1,4(A1) ; write new length in width/height sub.w D1,D2 ; Calc. High-Limit of centered output lsr.w #1,D1 ; W = W/2 sub.w D1,D0 ; X = PX-W/2 cmp.w D3,D0 ; if (X - MIN bpl.s not_less ; < 0) move.w D3,D0 ; X = MIN; not_less: cmp.w D2,D0 ; if (X - MAX bmi.s not_bigger ; >= 0) move.w D2,D0 ; X = MAX not_bigger: move.w D0,(A1)+ ; Write X/Y-pos in int_out[] addq.w #4,D0 move.w D0,-6(A0) ; Write X/Y-pos into object rts LineA: DS.L 1 SaveRegs: DS.L 7 ******************************************************* ***************** INSTALATION ROUTINE ***************** install: pea take_vec(PC) ; Please Note: it is not a bug that move.w #Supexec,-(SP) ; this routine does NOT clean up the trap #xbios ; Stack... (it saves some bytes!!!) linea #0 [ Init ] ; Get pointer to LineA variables move.l A0,LineA pea InstString(PC) move.w #Cconws,-(SP) trap #gemdos clr.w (SP) ; Resident terminate move.l #($0100+install-first),-(SP) ; = Program length move.w #Ptermres,-(SP) trap #gemdos take_vec: lea Zoombie-4(PC),A0 move.l (4*ZombTrap+$80).w,(A0)+ move.l A0,(4*ZombTrap+$80).w rts InstString: DC.B 10,'Form-Pointer-Pop''s installed...',13,10,10,0 END