🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: A Few Questions

#4641
From: markv
Date: Tue, 31 Jul 1990 19:39
53 lines
3034 bytes
In article <1139@xroads.UUCP>, aman@xroads.UUCP (Chris Minshall) writes:
> I have a few questions.....
> 
> 1.  What would be the easiest (quick and dirty if necessary) way to get mouse
>     button and movement events without using Intuition?  A code example would
>     be of great help as well!

In increasing order of dirtirness, add an input handler in front of
intution (safe but actually more work than an IDCMP, but useful if you
want to *steal* events so Intution *doesn't* see them), access the
gameport.device directly, and read the registers.  Examples of the
first two are in the Libs & Devs RKMs, the last is in the Hardware
manual.
 
> 2.  How do you create tasks that will share common data structures within a  
>     program (written in C).  Again, a code examples would be appreciated!

In C it is pretty.  Make sure shared objects (or their pointers if
dynamically allocated) are global in scope and access them normally.  
Shared variables make great simple semaphores.  I find that the best
bet with these kinds of semaphores is to set all you subtasks at
different priorities, that way you know for sure which tasks can or
cant interrupt the current task.  Or wrap your semaphore test/set
operations with Forbid()/Permit().  Just remember, Forbid() and
Permit() nest.  Also, if one of your sharing data with an interrupt,
you need to use Disable()/Enable() instead.

Another "tricky" way to do things atomically is use software
interrupts since they only get interrupted by hardware interrupts, not
tasks.  So you can create an interrupt for each action and Cause() it.

If you are using base-relative addresses, any subtasks need to fetch the
global base at their initial entry.  In Lattice C this is easy.
CreateTask() a task with C function as its entry.  Then either declare
the function as __saveds, or call geta4(), or compile the module with
-y.

> Thanks in advance for any answers!
> 
> Chris
> -- 
> \  /  C r o s s r o a d s  C o m m u n i c a t i o n s
>  /\   (602) 941-2005 300|1200 Baud 24 hrs/day
> /  \  hplabs!hp-sdd!crash!xroads!aman
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum			Only...		\    Good Cheer !!!
Academic Computing Services	       ///	  \___________________________
University of Kansas		     ///  /|         __    _
Bix:	  markgood	      \\\  ///  /__| |\/| | | _   /_\  makes it
Bitnet:   MARKV@UKANVAX		\/\/  /    | |  | | |__| /   \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <25062.26b59825@kuhub.cc.ukans.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!wuarchive!kuhub.cc.ukans.edu!markv
References: <1139@xroads.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!wuarchive!kuhub.cc.ukans.edu!markv
From: markv@kuhub.cc.ukans.edu
Newsgroups: comp.sys.amiga.tech
Subject: Re: A Few Questions
Message-ID: <25062.26b59825@kuhub.cc.ukans.edu>
Date: 31 Jul 90 19:39:33 GMT
References: <1139@xroads.UUCP>
Organization: University of Kansas Academic Computing Services
Lines: 53