📄 lib24c16.asm
字号:
;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.3.5 Wed Jul 30 11:55:55 2003
;--------------------------------------------------------
.module lib24c16
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _reeprom_PARM_2
.globl _weeprom_PARM_3
.globl _weeprom_PARM_2
.globl _weeprom
.globl _reeprom
.globl _read
.globl _outs
.globl _out
.globl _in
.globl _stop
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
.area REG_BANK_0 (REL,OVR,DATA)
.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
.area DSEG (DATA)
_weeprom_PARM_2::
.ds 1
_weeprom_PARM_3::
.ds 1
_reeprom_PARM_2::
.ds 1
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
.area OSEG (OVR,DATA)
.area OSEG (OVR,DATA)
.area OSEG (OVR,DATA)
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
.area ISEG (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
.area BSEG (BIT)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
.area XSEG (XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
.area XISEG (XDATA)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area GSINIT (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area HOME (CODE)
.area CSEG (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area CSEG (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'weeprom'
;------------------------------------------------------------
;address Allocated to in memory with name '_weeprom_PARM_2'
;datum Allocated to in memory with name '_weeprom_PARM_3'
;page Allocated to registers r2
;WRCMD Allocated to registers
;------------------------------------------------------------
;C:/Maxx/Proyectos/APublicar/lib24c16.c:92: void weeprom (char page, char address, char datum)
; -----------------------------------------
; function weeprom
; -----------------------------------------
_weeprom:
ar2 = 0x02
ar3 = 0x03
ar4 = 0x04
ar5 = 0x05
ar6 = 0x06
ar7 = 0x07
ar0 = 0x00
ar1 = 0x01
; genReceive
;C:/Maxx/Proyectos/APublicar/lib24c16.c:95: page = page << 1; // move A0, A1 & A2 to their positions
; genLeftShift
; genLeftShiftLiteral
; genlshOne
; Peephole 244.a moving first to a instead of r2
mov a,dpl
mov r2,a
add a,acc
mov r2,a
;C:/Maxx/Proyectos/APublicar/lib24c16.c:96: page = page & 0xFE; // clear r/w bit
; genAnd
anl ar2,#0xFE
;C:/Maxx/Proyectos/APublicar/lib24c16.c:97: WRCMD = page | 0xA0; // build the write command
; genOr
mov a,#0xA0
orl a,r2
mov dpl,a
;C:/Maxx/Proyectos/APublicar/lib24c16.c:98: outs (WRCMD); // send the write command with start condition
; genCall
lcall _outs
;C:/Maxx/Proyectos/APublicar/lib24c16.c:99: out (address); // send address
; genCall
mov dpl,_weeprom_PARM_2
lcall _out
;C:/Maxx/Proyectos/APublicar/lib24c16.c:100: out (datum); // send data
; genCall
mov dpl,_weeprom_PARM_3
lcall _out
;C:/Maxx/Proyectos/APublicar/lib24c16.c:101: stop (); // send stop condition
; genCall
lcall _stop
00101$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'reeprom'
;------------------------------------------------------------
;address Allocated to in memory with name '_reeprom_PARM_2'
;page Allocated to registers r2
;aux Allocated to registers r2
;WRCMD Allocated to registers r3
;------------------------------------------------------------
;C:/Maxx/Proyectos/APublicar/lib24c16.c:118: char reeprom (char page, char address)
; -----------------------------------------
; function reeprom
; -----------------------------------------
_reeprom:
; genReceive
;C:/Maxx/Proyectos/APublicar/lib24c16.c:123: aux = aux << 1; // move A0, A1 & A2 to their positions
; genLeftShift
; genLeftShiftLiteral
; genlshOne
; Peephole 244.a moving first to a instead of r2
mov a,dpl
mov r2,a
add a,acc
mov r2,a
;C:/Maxx/Proyectos/APublicar/lib24c16.c:124: aux = aux & 0xFE; // clear r/w bit
; genAnd
anl ar2,#0xFE
;C:/Maxx/Proyectos/APublicar/lib24c16.c:125: WRCMD = aux | 0xA0; // build the write command
; genOr
mov a,#0xA0
orl a,r2
;C:/Maxx/Proyectos/APublicar/lib24c16.c:126: outs (WRCMD); // send the write command with start condition
; genCall
; Peephole 244.c loading dpl from a instead of r3
mov r3,a
mov dpl,a
push ar2
push ar3
lcall _outs
pop ar3
pop ar2
;C:/Maxx/Proyectos/APublicar/lib24c16.c:127: out (address); // send address
; genCall
mov dpl,_reeprom_PARM_2
push ar2
push ar3
lcall _out
pop ar3
pop ar2
;C:/Maxx/Proyectos/APublicar/lib24c16.c:128: aux = read (WRCMD); // send read command and receive data
; genCall
mov dpl,r3
lcall _read
;C:/Maxx/Proyectos/APublicar/lib24c16.c:129: return (aux); // return solicited data
; genRet
; Peephole 150 removed misc moves via dpl before return
00101$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'read'
;------------------------------------------------------------
;readcmd Allocated to registers r2
;RDCMD Allocated to registers
;aux Allocated to registers r2
;------------------------------------------------------------
;C:/Maxx/Proyectos/APublicar/lib24c16.c:145: char read (char readcmd)
; -----------------------------------------
; function read
; -----------------------------------------
_read:
; genReceive
mov r2,dpl
;C:/Maxx/Proyectos/APublicar/lib24c16.c:149: RDCMD = readcmd | 0x01; // set r/w bit
; genOr
mov a,#0x01
orl a,r2
mov dpl,a
;C:/Maxx/Proyectos/APublicar/lib24c16.c:150: outs (RDCMD); // send read command with start condition
; genCall
lcall _outs
;C:/Maxx/Proyectos/APublicar/lib24c16.c:151: aux = in(); // read current position
; genCall
lcall _in
mov r2,dpl
;C:/Maxx/Proyectos/APublicar/lib24c16.c:152: stop (); // send stop condition
; genCall
push ar2
lcall _stop
pop ar2
;C:/Maxx/Proyectos/APublicar/lib24c16.c:153: return (aux); // return current position data
; genRet
mov dpl,r2
00101$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'outs'
;------------------------------------------------------------
;------------------------------------------------------------
;C:/Maxx/Proyectos/APublicar/lib24c16.c:170: void outs (char datum)
; -----------------------------------------
; function outs
; -----------------------------------------
_outs:
; genReceive
mov r2,dpl
;C:/Maxx/Proyectos/APublicar/lib24c16.c:174: SDA = 1; // set port pin SDA to insure data is HI
; genAssign
setb _SDA
;C:/Maxx/Proyectos/APublicar/lib24c16.c:175: SCK = 1; // set port pin SCK to insure clock is HI
; genAssign
setb _SCK
;C:/Maxx/Proyectos/APublicar/lib24c16.c:182: _endasm;
; genInline
nop
nop
nop
nop
nop
;C:/Maxx/Proyectos/APublicar/lib24c16.c:183: SDA = 0; // start condition, data = 0
; genAssign
clr _SDA
;C:/Maxx/Proyectos/APublicar/lib24c16.c:190: _endasm;
; genInline
nop
nop
nop
nop
nop
;C:/Maxx/Proyectos/APublicar/lib24c16.c:191: SCK = 0; // clock = 0
; genAssign
clr _SCK
;C:/Maxx/Proyectos/APublicar/lib24c16.c:192: for (i = 0; i < 8; i++) // bit shifting cycle
; genAssign
mov r3,#0x00
00104$:
; genCmpLt
; genCmp
clr c
mov a,r3
xrl a,#0x80
subb a,#0x88
; genIfxJump
; Peephole 108 removed ljmp by inverse jump logic
jnc 00107$
00113$:
;C:/Maxx/Proyectos/APublicar/lib24c16.c:194: aux = datum & 0x80; // check MSB bit
; genAnd
mov a,#0x80
anl a,r2
mov r4,a
;C:/Maxx/Proyectos/APublicar/lib24c16.c:195: if (aux == 0) // MSB = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -