3 ; for 93C66 (512 bytes as 256 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 ; 2011 modified to suit cc65 environment Karri Kaksonen
15 ; (c) 1995..97 Bastian Schick
20 ;And now how to contact the EEPROM :
23 ;PORT ----\/---- 93C66(SMD too)
24 ;(18) A7 --------| CS |- +5V
25 ;(11) A1 --------| CLK |- NC
27 ;(32) AUDIN ----+---| DO |- GND
30 .export _lynx_eeread_93c66
31 .export _lynx_eewrite_93c66
43 EE_C_EWEN2 = $FF ;; C0 schould be enough
48 ; Only lower byte in A is used for address
49 ; unsigned int __fastcall__ lynx_eeread_93c66(unsigned int addr);
59 ; reads EEPROM-word to ptr1
63 sta IODIR ; set AUDIN to Input
78 adc #$f0 ; C=1 if A=$10
80 rol ptr1+1 ; shifts 0 to Carry
85 stx IODIR ; set AUDIN for output
96 ; write word to EEPROM
97 ; void __fastcall__ lynx_eewrite_93c66(unsigned int addr, unsigned int val);
107 jsr EE_Send16Bit ; Sends ptr1 that contains val
120 sta IODIR ; AUDIN to input
123 bit IODAT ; 'til ready :D0-read is /D0-written
125 lda #$1a ; AUDIN to output
129 ; bra EE_Send11Bit ; fall into
149 txa ;; Ok erstmal x abarbeiten und A sichern
168 pla ;; jetzt kommt a an die reihe
172 ror A ; bit 7 at pos. 4
192 ; send ptr1 to EEPROM