🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11272

Re: Help writing a vblank server in assembly

#11272
From: Aaron Avery
Date: Tue, 31 Jan 1989 09:19
43 lines
2291 bytes
In article <676@cord.UUCP> nsw@cord.UUCP (Neil Weinstock) writes:
>server_routine() {
>	toggle = 1 - toggle;
>	if (toggle) Signal(t1,sig);
>	return;
>}
>
>That's it.  I figure the whole thing should be 10 or 15 lines long, max.
>I think I understand how to get A4 loaded at the beginning, but the Signal()
>call has got me stumped. Oh yeah, I'm using Manx 3.6, small code and data,
>32 bit ints.

I think the following will get you pretty close:

        public _toggle,_t1,_sig,_geta4,_LVOSignal

server_routine
        movem.l a4/a6,-(sp)
        jsr     _geta4          ;get a4 for variable access
        not.w   _toggle(a4)     ;forgot toggle's type - this assumes a short
        beq.s   1$              ;toggle now off, don't signal
        move.l  _t1(a4),a1
        move.l  _sig(a4),d0     ;Signal takes its arguments in a1 and d0
        move.l  4,a6            ;moves SysBase into a6
        jsr     _LVOSignal(a6)  ;not sure SysBase must go in a6, habit
1$      movem.l (sp)+,a4/a6
        moveq   #0,d0           ;continue server chain
        rts

I'm just used to putting SysBase into a6 - may not matter. Be sure that the
program which installed this routine hangs around until it's removed from the
server chain. Otherwise, accessing toggle may tromp on something, not to
mention that calling geta4() may call never-never land if the code's not there
anymore.

To simplify the source a bit: if you set 'near code' and 'near data', you
shouldn't have to use _var(a4), and just use _var to access things.

-- 
Aaron Avery, ASDG Inc.         "A mime is a terrible thing to waste."
                                                             -- Robin Williams
ARPA: madnix!aaron@cs.wisc.edu   {uunet|ncoast}!marque!
UUCP:   {harvard|rutgers|ucbvax}!uwvax!astroatc!nicmad!madnix!aaron
Technical Details
Message-ID: <449@madnix.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!xanth!nic.MR.NET!umn-d-ub!uwvax!astroatc!nicmad!madnix!aaron
References: <676@cord.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!xanth!nic.MR.NET!umn-d-ub!uwvax!astroatc!nicmad!madnix!aaron
From: aaron@madnix.UUCP (Aaron Avery)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Help writing a vblank server in assembly
Message-ID: <449@madnix.UUCP>
Date: 31 Jan 89 09:19:14 GMT
References: <676@cord.UUCP>
Reply-To: aaron@madnix.UUCP (Aaron Avery)
Distribution: usa
Organization: ASDG Incorporated
Lines: 43