[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ZipGSX programming...
In article <djshaw01.727980535@starbase.spd.louisville.edu> djshaw01@romulus.spd.louisville.edu (Daniel Shaw) writes:
> how does one recognize whether a zip exists in a slot from a program...
Well, you can't tell _which_ slot the ZIP is in. It has no I/O
locations, ROM or anything else in the slot's space. The slot is used
to support the card, provide power, and to access signals that aren't
available at the processor (such as DMA).
> I noticed in thye cH..'s code that it accesses the annunciators to
> turn it on or off....????? it doesn't really make sense...if anyone
> knows how.. email or better.. post!!!!...let everyone know how to do
> it..
The ZIP uses the same locations as the annunciators to access its
registers. However, they aren't accessable at all times. You have to
go through a special 'unlock ZIP registers' sequence to access them.
While the ZIP is 'unlocked', the annunciators cannot be accessed.
After you've finished with the ZIP, you have to 'lock' the registers
again to restore annunciator access.
I posted a file containing a description of the ZIP registers to
comp.binaries.apple2, well over a year ago. Andy McFadden's "ZIPPY"
program includes this file (I don't know if Andy used the information
to write ZIPPY). I got the details from ZIP, and reworked it into a
single page summary.
Detecting the ZIP is somewhat of a black art. The best way to identify
it (IMO) is to use the following sequence (interrupts should be
disabled for security):
- Enable the ZIP registers
- Save the current 'percentage speed' setting
- Change the 'percentage speed' to something else
- Read back the 'percentage speed'. If it doesn't match what you
wrote, there is no ZIP.
- Restore the original percentage speed.
- Read it back again. If it doesn't match, there is no ZIP.
- Disable the ZIP registers
Another possibility would be to verify that other ZIP registers can be
read and written. Reading from an annunciator will produce a random
value.
Unfortunately, the detection sequence will affect the state of the
annunciators if there is no ZIP in the system, which may cause
problems if you are using them to control external devices (for
example, I have an infra-red transmitter connected to AN2, which is
affected by accesses to $C05C or $C05D).
The following routine will detect the ZIP, returning with A=$00 and
carry clear if the ZIP is present, A=$01 and carry set if not.
Emulation mode (or 8-bit native mode) is assumed.
CHKZIP SEI
LDA #$55 ; Unlock the ZIP registers
STA $C05A
STA $C05A
STA $C05A
STA $C05A
LDA $C05A ; Save the percentage speed
AND #$F0 ; Extract the speed bits
TAX
EOR #$F0 ; Toggle the speed to something else
STA $C05D ; Write the percentage speed
ORA #$0F ; Set up bits to match
CMP $C05A ; Expect speed in top bits, 1111 in bottom bits
BNE NOZIP
STX $C05D ; Restore the original speed
TXA
ORA #$0F ; Set up bits to match
CMP $C05A ; Expect speed in top bits, 1111 in bottom bits
BNE NOZIP
LDA #$AA ; Lock the ZIP registers
STA $C05A
LDA #$00 ; Tests passed: ZIP is present!
CLC
CLI
RTS
NOZIP LDA #$01 ; The ZIP is not present
SEC
CLI
RTS
--
David Empson
Internet: David.Empson@bbs.actrix.gen.nz EMPSON_D@kosmos.wcc.govt.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand