【正文】
er Initialize AT24Cxx serial bus lines.setbSCL highcallfaultcallfaultcallfaultcallfault$byte_fill: Writes one address at a time (page mode is not used). Destroys A, B, DPTR, XDATA, ADDR_HI:ADDR_LO.mov set up fill datamov initialize address pointeraddr_lo, dpladdr_hi, dphb, 120 retry countera, PADDRwrite_bytex53 jump if write OKdjnzc set timeout error flagjmpx53:inc advance address pointer。a, dplcjne jump if not lastmov check high bytecjne jump if not lastclr clear error flag Verify that all bytes in an AT24Cxx match a fill value. Performs a Random Read function to initialize the internal Then performs multiple Current Address Read functions to step Returns CY set to indicate read timeout or pare fail.dptr, 0addr_lo, dpladdr_hi, dphb, 120 retry countera, PADDRread_randomx82 jump if read OKdjnzx86 set error flag and exita, FILL, x86x85 do remaining addressesa, PADDRcallx87 jump if read failscjne jump if pare errordptra, dpha, (HIGH SIZE), x83cx87 exitc set error flag Fill every byte in an AT24Cxx with the same value. Returns CY set to indicate write timeout.b, PSIZEindex, bufferx61:mov put fill value in bufferincb, x61 next byte Copy buffer to device, one page at a time.mov initialize address pointeraddr_lo, dpladdr_hi, dphkount, PSIZEb, 120 retry countera, PADDRwrite_blockx64 jump if write OKdjnzc set timeout error flagjmpx64: Add page size to address pointer.mova, PSIZEdpl, a save low bytejncdph increment high bytecjne jump if low byte not lastmov check high bytecjne jump if not lastclr clear error flag Verify that all bytes in an AT24Cxx match a fill value. Returns CY set to indicate read timeout or pare fail.dptr, 0x71:mov set up addressmovmov bytes per pagemovx72:mov programmable addresscall try to readjncb, x72 try againc set error flagjmpx74: Verify buffer contents.mov bytes per pagemov point to bufferindex, FILL, x73index advance pointerdjnza, dpl get low byteadd add page sizemovx76 jump if high byte not affectedincx76:。a, (LOW SIZE), x71a, dpha, (HIGH SIZE), x71cx77:retwrite_block: Called with programmable address in A, address of first byte in register KOUNT. Returns CY set to indicate that the bus is not available Destroys A, KOUNT, INDEX.callx38 abort if bus not availablerla, FADDR specify write operationcallx37 abort if no acknowledgemov send high byte of addresscallx37 abort if no acknowledgemov send low byte of addresscallx37 abort if no acknowledgemov point to buffera, indexshout send datajcindex advance buffer pointerdjnz next byteclrx37:callx38:retread_block: Performs a Random Read which is extended into a Sequential Read in A, address of first byte in register pair ADDR_HI:ADDR_LO, Returns data in BUFFER. R