3 ; for 93C86 (2048 bytes as 1024 16-bit words)
8 ; 16.02.96 leaner (thanks to Harry)
9 ; 12.03.96 test for busy after write and erase (well, Harry ;)) )
10 ; 22.08.97 ported to ra65 for use with cc65
11 ; 02.12.97 added xref for the new ra65
12 ; 2010 93c66 support B. Spruck
13 ; 2010 93c86 support B. Spruck
14 ; 2011 modified to suit cc65 environment Karri Kaksonen
16 ; (c) 1995..97 Bastian Schick
21 ;And now how to contact the EEPROM :
24 ;PORT ----\/---- 93C86(SMD too)
25 ;(18) A7 --------| CS |- +5V
26 ;(11) A1 --------| CLK |- NC
28 ;(32) AUDIN ----+---| DO |- GND
31 .export _lynx_eeread_93c86
32 .export _lynx_eewrite_93c86
44 EE_C_EWEN2 = $FF ;; C0 schould be enough
49 ; Only lower byte in A is used for address
50 ; unsigned int __fastcall__ lynx_eeread_93c86(unsigned int addr);
64 ; reads EEPROM-word to ptr1
68 sta IODIR ; set AUDIN to Input
83 adc #$f0 ; C=1 if A=$10
85 rol ptr1+1 ; shifts 0 to Carry
90 stx IODIR ; set AUDIN for output
101 ; write word to EEPROM
102 ; void __fastcall__ lynx_eewrite_93c86(unsigned int addr, unsigned int val);
116 jsr EE_Send16Bit ; Sends ptr1 that contains val
129 sta IODIR ; AUDIN to input
132 bit IODAT ; 'til ready :D0-read is /D0-written
134 lda #$1a ; AUDIN to output
138 ; bra EE_Send13Bit ; fall into
158 txa ;; Ok erstmal x abarbeiten und A sichern
177 pla ;; jetzt kommt a an die reihe
181 ror A ; bit 7 at pos. 4
201 ; send ptr1 to EEPROM