⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib24c16.rst

📁 eeprom program for 8051 and atmel at89c52 or At89s52
💻 RST
📖 第 1 页 / 共 3 页
字号:
                              1 ;--------------------------------------------------------
                              2 ; File Created by SDCC : FreeWare ANSI-C Compiler
                              3 ; Version 2.3.5 Wed Jul 30 11:55:55 2003
                              4 
                              5 ;--------------------------------------------------------
                              6 	.module lib24c16
                              7 	
                              8 ;--------------------------------------------------------
                              9 ; Public variables in this module
                             10 ;--------------------------------------------------------
                             11 	.globl _reeprom_PARM_2
                             12 	.globl _weeprom_PARM_3
                             13 	.globl _weeprom_PARM_2
                             14 	.globl _weeprom
                             15 	.globl _reeprom
                             16 	.globl _read
                             17 	.globl _outs
                             18 	.globl _out
                             19 	.globl _in
                             20 	.globl _stop
                             21 ;--------------------------------------------------------
                             22 ; special function registers
                             23 ;--------------------------------------------------------
                             24 ;--------------------------------------------------------
                             25 ; special function bits 
                             26 ;--------------------------------------------------------
                             27 ;--------------------------------------------------------
                             28 ; overlayable register banks 
                             29 ;--------------------------------------------------------
                             30 	.area REG_BANK_0	(REL,OVR,DATA)
   0000                      31 	.ds 8
                             32 ;--------------------------------------------------------
                             33 ; internal ram data
                             34 ;--------------------------------------------------------
                             35 	.area DSEG    (DATA)
   0008                      36 _weeprom_PARM_2::
   0008                      37 	.ds 1
   0009                      38 _weeprom_PARM_3::
   0009                      39 	.ds 1
   000A                      40 _reeprom_PARM_2::
   000A                      41 	.ds 1
                             42 ;--------------------------------------------------------
                             43 ; overlayable items in internal ram 
                             44 ;--------------------------------------------------------
                             45 	.area	OSEG    (OVR,DATA)
                             46 	.area	OSEG    (OVR,DATA)
                             47 	.area	OSEG    (OVR,DATA)
                             48 ;--------------------------------------------------------
                             49 ; indirectly addressable internal ram data
                             50 ;--------------------------------------------------------
                             51 	.area ISEG    (DATA)
                             52 ;--------------------------------------------------------
                             53 ; bit data
                             54 ;--------------------------------------------------------
                             55 	.area BSEG    (BIT)
                             56 ;--------------------------------------------------------
                             57 ; external ram data
                             58 ;--------------------------------------------------------
                             59 	.area XSEG    (XDATA)
                             60 ;--------------------------------------------------------
                             61 ; external initialized ram data
                             62 ;--------------------------------------------------------
                             63 	.area XISEG   (XDATA)
                             64 ;--------------------------------------------------------
                             65 ; global & static initialisations
                             66 ;--------------------------------------------------------
                             67 	.area GSINIT  (CODE)
                             68 	.area GSFINAL (CODE)
                             69 	.area GSINIT  (CODE)
                             70 ;--------------------------------------------------------
                             71 ; Home
                             72 ;--------------------------------------------------------
                             73 	.area HOME    (CODE)
                             74 	.area CSEG    (CODE)
                             75 ;--------------------------------------------------------
                             76 ; code
                             77 ;--------------------------------------------------------
                             78 	.area CSEG    (CODE)
                             79 ;------------------------------------------------------------
                             80 ;Allocation info for local variables in function 'weeprom'
                             81 ;------------------------------------------------------------
                             82 ;address                   Allocated to in memory with name '_weeprom_PARM_2'
                             83 ;datum                     Allocated to in memory with name '_weeprom_PARM_3'
                             84 ;page                      Allocated to registers r2 
                             85 ;WRCMD                     Allocated to registers 
                             86 ;------------------------------------------------------------
                             87 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:92: void weeprom (char page, char address, char datum)
                             88 ;	-----------------------------------------
                             89 ;	 function weeprom
                             90 ;	-----------------------------------------
   0049                      91 _weeprom:
                    0002     92 	ar2 = 0x02
                    0003     93 	ar3 = 0x03
                    0004     94 	ar4 = 0x04
                    0005     95 	ar5 = 0x05
                    0006     96 	ar6 = 0x06
                    0007     97 	ar7 = 0x07
                    0000     98 	ar0 = 0x00
                    0001     99 	ar1 = 0x01
                            100 ;     genReceive
                            101 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:95: page = page << 1; // move A0, A1 & A2 to their positions
                            102 ;     genLeftShift
                            103 ;     genLeftShiftLiteral
                            104 ;     genlshOne
                            105 ;       Peephole 244.a  moving first to a instead of r2
   0049 E5 82               106 	mov	a,dpl
   004B FA                  107 	mov	r2,a
   004C 25 E0               108 	add	a,acc
   004E FA                  109 	mov	r2,a
                            110 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:96: page = page & 0xFE; // clear r/w bit
                            111 ;     genAnd
   004F 53 02 FE            112 	anl	ar2,#0xFE
                            113 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:97: WRCMD = page | 0xA0; // build the write command
                            114 ;     genOr
   0052 74 A0               115 	mov	a,#0xA0
   0054 4A                  116 	orl	a,r2
   0055 F5 82               117 	mov	dpl,a
                            118 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:98: outs (WRCMD); // send the write command with start condition
                            119 ;     genCall
   0057 12 00 B1            120 	lcall	_outs
                            121 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:99: out (address); // send address
                            122 ;     genCall
   005A 85 08 82            123 	mov	dpl,_weeprom_PARM_2
   005D 12 00 FB            124 	lcall	_out
                            125 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:100: out (datum); // send data
                            126 ;     genCall
   0060 85 09 82            127 	mov	dpl,_weeprom_PARM_3
   0063 12 00 FB            128 	lcall	_out
                            129 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:101: stop (); // send stop condition
                            130 ;     genCall
   0066 12 01 62            131 	lcall	_stop
   0069                     132 00101$:
   0069 22                  133 	ret
                            134 ;------------------------------------------------------------
                            135 ;Allocation info for local variables in function 'reeprom'
                            136 ;------------------------------------------------------------
                            137 ;address                   Allocated to in memory with name '_reeprom_PARM_2'
                            138 ;page                      Allocated to registers r2 
                            139 ;aux                       Allocated to registers r2 
                            140 ;WRCMD                     Allocated to registers r3 
                            141 ;------------------------------------------------------------
                            142 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:118: char reeprom (char page, char address)
                            143 ;	-----------------------------------------
                            144 ;	 function reeprom
                            145 ;	-----------------------------------------
   006A                     146 _reeprom:
                            147 ;     genReceive
                            148 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:123: aux = aux << 1; // move A0, A1 & A2 to their positions 
                            149 ;     genLeftShift
                            150 ;     genLeftShiftLiteral
                            151 ;     genlshOne
                            152 ;       Peephole 244.a  moving first to a instead of r2
   006A E5 82               153 	mov	a,dpl
   006C FA                  154 	mov	r2,a
   006D 25 E0               155 	add	a,acc
   006F FA                  156 	mov	r2,a
                            157 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:124: aux = aux & 0xFE; // clear r/w bit
                            158 ;     genAnd
   0070 53 02 FE            159 	anl	ar2,#0xFE
                            160 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:125: WRCMD = aux | 0xA0; // build the write command
                            161 ;     genOr
   0073 74 A0               162 	mov	a,#0xA0
   0075 4A                  163 	orl	a,r2
                            164 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:126: outs (WRCMD); // send the write command with start condition
                            165 ;     genCall
                            166 ;       Peephole 244.c  loading dpl from a instead of r3
   0076 FB                  167 	mov	r3,a
   0077 F5 82               168 	mov	dpl,a
   0079 C0 02               169 	push	ar2
   007B C0 03               170 	push	ar3
   007D 12 00 B1            171 	lcall	_outs
   0080 D0 03               172 	pop	ar3
   0082 D0 02               173 	pop	ar2
                            174 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:127: out (address); // send address
                            175 ;     genCall
   0084 85 0A 82            176 	mov	dpl,_reeprom_PARM_2
   0087 C0 02               177 	push	ar2
   0089 C0 03               178 	push	ar3
   008B 12 00 FB            179 	lcall	_out
   008E D0 03               180 	pop	ar3
   0090 D0 02               181 	pop	ar2
                            182 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:128: aux = read (WRCMD); // send read command and receive data
                            183 ;     genCall
   0092 8B 82               184 	mov	dpl,r3
   0094 12 00 98            185 	lcall	_read
                            186 ;C:/Maxx/Proyectos/APublicar/lib24c16.c:129: return (aux); // return solicited data 
                            187 ;     genRet
                            188 ;       Peephole 150    removed misc moves via dpl before return
   0097                     189 00101$:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -