home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / apple2 / 27646 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.6 KB  |  100 lines

  1. Newsgroups: comp.sys.apple2
  2. Path: sparky!uunet!comp.vuw.ac.nz!actrix!David.Empson
  3. From: David.Empson@bbs.actrix.gen.nz
  4. Subject: Re: ZipGSX programming...
  5. Organization: Actrix Information Exchange
  6. Date: Thu, 28 Jan 1993 10:36:40 GMT
  7. Message-ID: <1993Jan28.103640.24485@actrix.gen.nz>
  8. References: <djshaw01.727980535@starbase.spd.louisville.edu>
  9. Sender: David.Empson@actrix.gen.nz (David Empson)
  10. Lines: 88
  11.  
  12. In article <djshaw01.727980535@starbase.spd.louisville.edu> djshaw01@romulus.spd.louisville.edu (Daniel Shaw) writes:
  13. > how does one recognize whether a zip exists in a slot from a program...
  14.  
  15. Well, you can't tell _which_ slot the ZIP is in.  It has no I/O
  16. locations, ROM or anything else in the slot's space.  The slot is used
  17. to support the card, provide power, and to access signals that aren't
  18. available at the processor (such as DMA).
  19.  
  20. > I noticed in thye cH..'s code that it accesses the annunciators to
  21. > turn it on or off....????? it doesn't really make sense...if anyone
  22. > knows how.. email or better.. post!!!!...let everyone know how to do
  23. > it.. 
  24.  
  25. The ZIP uses the same locations as the annunciators to access its
  26. registers.  However, they aren't accessable at all times.  You have to
  27. go through a special 'unlock ZIP registers' sequence to access them.
  28. While the ZIP is 'unlocked', the annunciators cannot be accessed.
  29. After you've finished with the ZIP, you have to 'lock' the registers
  30. again to restore annunciator access.
  31.  
  32. I posted a file containing a description of the ZIP registers to
  33. comp.binaries.apple2, well over a year ago.  Andy McFadden's "ZIPPY"
  34. program includes this file (I don't know if Andy used the information
  35. to write ZIPPY).  I got the details from ZIP, and reworked it into a
  36. single page summary.
  37.  
  38.  
  39. Detecting the ZIP is somewhat of a black art.  The best way to identify
  40. it (IMO) is to use the following sequence (interrupts should be
  41. disabled for security):
  42.  
  43. - Enable the ZIP registers
  44. - Save the current 'percentage speed' setting
  45. - Change the 'percentage speed' to something else
  46. - Read back the 'percentage speed'.  If it doesn't match what you
  47. wrote, there is no ZIP.
  48. - Restore the original percentage speed.
  49. - Read it back again.  If it doesn't match, there is no ZIP.
  50. - Disable the ZIP registers
  51.  
  52. Another possibility would be to verify that other ZIP registers can be
  53. read and written.  Reading from an annunciator will produce a random
  54. value.
  55.  
  56. Unfortunately, the detection sequence will affect the state of the
  57. annunciators if there is no ZIP in the system, which may cause
  58. problems if you are using them to control external devices (for
  59. example, I have an infra-red transmitter connected to AN2, which is
  60. affected by accesses to $C05C or $C05D).
  61.  
  62. The following routine will detect the ZIP, returning with A=$00 and
  63. carry clear if the ZIP is present, A=$01 and carry set if not.
  64. Emulation mode (or 8-bit native mode) is assumed.
  65.  
  66. CHKZIP    SEI
  67.     LDA #$55    ; Unlock the ZIP registers
  68.     STA $C05A
  69.     STA $C05A
  70.     STA $C05A
  71.     STA $C05A
  72.     LDA $C05A    ; Save the percentage speed
  73.     AND #$F0    ; Extract the speed bits
  74.     TAX
  75.     EOR #$F0    ; Toggle the speed to something else
  76.     STA $C05D    ; Write the percentage speed
  77.     ORA #$0F    ; Set up bits to match
  78.     CMP $C05A    ; Expect speed in top bits, 1111 in bottom bits
  79.     BNE NOZIP
  80.     STX $C05D    ; Restore the original speed
  81.     TXA
  82.     ORA #$0F    ; Set up bits to match
  83.     CMP $C05A    ; Expect speed in top bits, 1111 in bottom bits
  84.     BNE NOZIP
  85.     LDA #$AA    ; Lock the ZIP registers
  86.     STA $C05A
  87.     LDA #$00    ; Tests passed: ZIP is present!
  88.     CLC
  89.     CLI
  90.     RTS
  91. NOZIP    LDA #$01    ; The ZIP is not present
  92.     SEC
  93.     CLI
  94.     RTS
  95. -- 
  96. David Empson
  97.  
  98. Internet: David.Empson@bbs.actrix.gen.nz    EMPSON_D@kosmos.wcc.govt.nz
  99. Snail mail: P.O. Box 27-103, Wellington, New Zealand
  100.