🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Parallel port and interrupt servers

#5456
From: Allan Duncan
Date: Tue, 25 Sep 1990 07:43
90 lines
3607 bytes
Expert assistance is being sought!

I am currently (unsuccessfully) trying to write an interrupt server to
run with the parallel port.  Unfortunately the standard sources of docos
(RKM, Amiga Mail, Devcon notes) do not address this particular problem,
which is similar but not quite the same - and the differences count!

So far, I have found out that on the installing side of things you have to -

OpenResource ( "ciaa.resource" )  [ciaa is not mentioned in the RKM,
only cia, but I guessed] to get a pointer for the AbleICR and SetICR
functions which I _suspect_ you need to look at the interrupts to find
out if it is yours, rather than going to the ICR register directly,
which will clear it and prevent other servers in the same chain getting
screwed.  I'm a little puzzled by this, as the RKM says that doing the
OpenResource passes ownership of the CIA to you, but all I want to do is
use a part of it - the keyboard uses another of the bits that gives rise
to an interrupt on the same bit of the interrupt controller, so I really
need to _share_ use.  This point is a little more than academic, as you
will see.

OpenResource( "misc.resource" ) to get control of the CIA parallel port
(sounds fair enough) via AllocMiscResource() for the port and bits.

Optionally get a signal bit (for the moment I'm just writing the
incoming byte in a global variable and polling it for change of value).

Set the DDR for some bits out, some in (I want asynchronous full duplex
I/O).

Set up an Interrupt node structure, and AddIntServer().

	So far, so good!

AbleICR() the CIA Flag signal interrupt line ( Ack* to the parallel port)
so that I will get the interrupts.

After this, I _intended_ to just look at the spot where the interrupt
routine puts the new value, waiting for it to change.


Well.  I have tried this without the AbleICR, looking directly at the
CIA port, and my hardware talks to it correctly, but if I enable the
flag interrupt, the next keystroke will cause a guru (usually an address
error - hmm).

One thing I _love_ about interrupt routines - they are all dead
reckoning unless you have some high power hardware!

Here is the interrupt code ( I am using Manx, and don't think there are
any A4 offsets left in it)
---------------------------------------------------------------


* Entered with:
*  D0 == scratch
*  D1 == scratch
*  A0 == scratch
*  A1 == is_Data which is OURDATA structure (scratch)
*  A5 == vector to our code (scratch)
*  A6 == scratch
*

_ciaa	EQU	$bfe001
SetICR	EQU	-24

	XDEF	_CIAaResourceBase

_PARServer:				; entry to our interrupt Server
	movea.l	_CIAaResourceBase,a6
	move	#CIAICRF_FLG,d0
	jsr	SetICR(a6)
	andi.b	#CIAICRF_FLG,d0
	beq.s	not_ours
	lea	_ciaa,a0
	move.b	ciaprb(a0),d1		; new byte
	move.b	d1,od_lastin(a0)
	moveq	#1,d0
	RTS

not_ours:
	moveq	#0,d0			;pass on to next Server in chain
        RTS				;return to exec

--------------------------------------------------------
Allan Duncan	ACSnet	a.duncan@trl.oz
(03) 541 6708	ARPA	a.duncan%trl.oz.au@uunet.uu.net
		UUCP	{uunet,hplabs,ukc}!munnari!trl.oz!a.duncan
Telecom Research Labs, PO Box 249, Clayton, Victoria, 3168, Australia.
Technical Details
Message-ID: <2275@trlluna.trl.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!apple!uokmax!munnari.oz.au!bruce!trlluna!rhea.trl.oz.au!aduncan

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!apple!uokmax!munnari.oz.au!bruce!trlluna!rhea.trl.oz.au!aduncan
From: aduncan@rhea.trl.oz.au (Allan Duncan)
Newsgroups: comp.sys.amiga.tech
Subject: Parallel port and interrupt servers
Message-ID: <2275@trlluna.trl.oz>
Date: 25 Sep 90 07:43:50 GMT
Sender: news@trlluna.trl.oz
Lines: 90