[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

1233.0. "What is XBRA?" by VFOVAX::PATTERSON (The world is flat, it's the universe thats round) Mon Jan 13 1992 12:17

    Does anyone know what XBRA is, and how do you make a program compatible
    with the standard?

    Jim Patterson
    
T.RTitleUserPersonal
Name
DateLines
1233.1Stealing interrupt and trap vectorsPRNSYS::LOMICKAJJeffrey A. LomickaMon Jan 13 1992 14:405
That's the developer's standard for stealing interrupt vectors.  It
allows multiple applications to steal and put back the vectors without
causing other applications that steal them and put them back from being
locked out.  I don't know the details, but if you need them, I can
probabally get them.
1233.2I'll borrow some code exaples.VFOVAX::PATTERSONThe world is flat, it's the universe thats roundMon Jan 13 1992 16:318
>locked out.  I don't know the details, but if you need them, I can
>probabally get them.

    I will rip apart a small program that supports it and get what I need from
    there, but if you happen to find any detailed docs on it, I would be 
    interested.

    Jim Patterson
1233.3more info ...COL01::OBERHOLZBeam me up, Scotty!Tue Jan 14 1992 04:0360
Hi,
	as far as I know, XBRA is a protocol based on a convention of 
	programmers that write software that modifies system-vectors, 
	which are of common interest.
	It is the eXtended version of the BRA-protocol of Moshe BRAner 
	(whoever this may be ...).
	It allows you to put your software into a vector-chain and(!) to
	easily remove it, without affecting the other members of the chain.
	To make this possible there should be an XBRA-structure directly 
	before the entry-point of a user-supplied handler, which has the 
	following format: (for example in 'C')

	typedef struct 
	{  
	    char xb_magic[4];	 /* always "XBRA", missing in BRA-protocol */
	    char xb_id[4];       /* Id of your software, eg. "KB14"        */
	    long xb_oldvec;      /* next member of the chain               */
	} XBRA;
	
	An XBRA-handler does its work an then branches to xb_oldvec.

	'Installing' means, to store a system vector in xb_oldvec and then to
	bend it to your routine, which branches to xb_oldvec after completion.

	Because of the well defined position of that field, an 'unchaining'
	program can copy its xb_oldvec into the xb_oldvec of its predecessor 
	in the chain. After that it will be bypassed automatically.

	Sample Assembler "Main Program"

********************************************************************************external 'C'-Subhandler

        GLOBL my_c_hdl          ; external 'C-Subhandler'
        GLOBL my_xbra1          

my_xbra:    
         ASCII         "XBRA"    
         ASCII         "KB14"     
xb_oldvec:                   
         DS.L          1        ; filled in by external 'C-Subhandler'
        
         TEXT

my_asm_hdl:
        movem.l        d0-d7/a0-a7,-(sp)   ; save registers
        jsr            my_c_hdl            ; call external 'C-Subhandler'
        movem.l        (sp)+,d0-d7/a0-a7   ; restore registers
        move.l         xb_oldvec,-(sp)   
        rts                                ; branch to next handler

********************************************************************************

If you are interested in detail, I can mail you a sample 'external C-Subhandler'
(discussed in note 1063.*) which is able to install and deinstall itself 
within an existing (maybe empty) XBRA-queue.
                      

I hope this will help you 

Bert.
1233.4Sounds easy enough.VFOVAX::PATTERSONThe world is flat, it's the universe thats roundTue Jan 14 1992 13:1810
>	typedef struct 
>	{  
>	    char xb_magic[4];	 /* always "XBRA", missing in BRA-protocol */
>	    char xb_id[4];       /* Id of your software, eg. "KB14"        */
>	    long xb_oldvec;      /* next member of the chain               */
>	} XBRA;

	This should be enough info for what I want to do.  Thanks a million.

	Jim Patterson