🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

!CIA Allocation Bug!

#10911
From: Robert R. Burns
Date: Tue, 10 Jan 1989 19:23
42 lines
2065 bytes
In articles, folks (most recently Karl Lehenbauer) write:
>#define CIAINTBIT CIAICRB_TA
>...
>if ((CIAResource = (struct Library *)OpenResource(CIAANAME)) == NULL)
>...
>if ((OldCIAInterrupt = AddICRVector(CIAResource,CIAINTBIT,&CIATimerInterrupt))
>...

Let me say this again (though I didn't say it the first time).  The hardware
manual incorrectly identifies CIA usage.  Here is the correct allocation:

    CIAA (int 2)
	timerA      keyboard handshake
	timerB      uSec timer.device
	TOD         60Hz timer.device
    CIAB (int 6)
	timerA      Commodore serial communication, usually not used
	timerB      not used
	TOD         graphics.library beam counter

This example code incorrectly allocates CIAA timerA.  The keyboard is
arguably "broken" in the sense that it does not preclude that from happening
-- but in any event, the keyboard expects timerA for its exclusive use.
The keyboard.device code on the amiga side handshakes key acquisition to the
keyboard processor using a mechanism such that if the timer is running, the
handshake may not be properly generated.  Furthermore, under 1.4 the
keyboard.device will be using the timer itself, and the AddICRVector would
begin to (correctly) fail.

so, use...

if ((CIAResource = (struct Library *)OpenResource(CIABNAME)) == NULL)
						     ^

and do it carefully, because your interrupt code is now at a much higher
priority (6 vs. 2).

-- 
Bob Burns, amiga!kodiak                   _
| /_  _|. _ |      Commodore __          |_) _ |_  _ )'
|<(_)(_)|(_\|<      /\ |  ||| _` /\      |_)(_\| )(_\ |
| \ Software    ___/..\|\/|||__|/..\___           Faith
Technical Details
Message-ID: <3244@amiga.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!oliveb!amiga!kodiak
References: <3252@sugar.uu.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!oliveb!amiga!kodiak
From: kodiak@amiga.UUCP (Robert R. Burns)
Newsgroups: comp.sys.amiga.tech
Subject: !CIA Allocation Bug!
Summary: Hardware manual *not correct*
Message-ID: <3244@amiga.UUCP>
Date: 10 Jan 89 19:23:41 GMT
References: <3252@sugar.uu.net>
Reply-To: kodiak@tooter.UUCP (Robert Burns)
Organization: Commodore-Amiga Inc, Los Gatos CA
Lines: 42