3 ; for 93C46 (128 bytes as 64 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
14 ; (c) 1995..97 Bastian Schick
19 ;And now how to contact the EEPROM :
22 ;PORT ----\/---- 93C46(SMD too)
23 ;(18) A7 --------| CS |- +5V
24 ;(11) A1 --------| CLK |- NC
26 ;(32) AUDIN ----+---| DO |- GND
28 .export _lynx_eeread_93c46
29 .export _lynx_eewrite_93c46
43 ; ------------------------------------------------------------------------
44 ; unsigned __fastcall__ lynx_eeread_93c46(unsigned char cell);
45 ; /* Read a 16 bit word from the given address */
57 ; reads EEPROM-word to ptr1
61 sta IODIR ; set AUDIN to Input
76 adc #$f0 ; C=1 if A=$10
78 rol ptr1+1 ; shifts 0 to Carry
83 stx IODIR ; set AUDIN for output
94 ; write word to EEPROM
95 ; void __fastcall__ lynx_eewrite_93c46(unsigned int addr, unsigned int val);
105 jsr EE_Send16Bit ; Sends ptr1 that contains val
118 sta IODIR ; AUDIN to input
121 bit IODAT ; 'til ready :D0-read is /D0-written
123 lda #$1a ; AUDIN to output
126 ; bra EE_Send9Bit ; fall into
151 ror A ; bit 8 at pos. 4
169 ; send ptr1 to EEPROM