442 lines
9.1 KiB
NASM
442 lines
9.1 KiB
NASM
;--------------------------------------------------------
|
|
; File Created by SDCC : free open source ANSI-C Compiler
|
|
; Version 4.2.0 #13081 (Linux)
|
|
;--------------------------------------------------------
|
|
.module delay
|
|
.optsdcc -mmcs51 --model-small
|
|
|
|
;--------------------------------------------------------
|
|
; Public variables in this module
|
|
;--------------------------------------------------------
|
|
.globl _EADC
|
|
.globl _ET1
|
|
.globl _ET0
|
|
.globl _ES
|
|
.globl _EA
|
|
.globl _REN
|
|
.globl _RI
|
|
.globl _TI
|
|
.globl _TR1
|
|
.globl _TF1
|
|
.globl _IT0
|
|
.globl _IE0
|
|
.globl _TR0
|
|
.globl _TF0
|
|
.globl _CMPCR2
|
|
.globl _CMPCR1
|
|
.globl _TA
|
|
.globl _IRCBAND_REG
|
|
.globl _IAP_TPS
|
|
.globl _IAP_CONTR
|
|
.globl _IAP_TRIG
|
|
.globl _IAP_CMD
|
|
.globl _IAP_ADDRL
|
|
.globl _IAP_ADDRH
|
|
.globl _IAP_DATA
|
|
.globl _WDT_CONTR
|
|
.globl _PCA_PWM3
|
|
.globl _PCA_PWM2
|
|
.globl _PCA_PWM1
|
|
.globl _PCA_PWM0
|
|
.globl _CCAP3L
|
|
.globl _CCAP2L
|
|
.globl _CCAP1L
|
|
.globl _CCAP0L
|
|
.globl _CCAPM3
|
|
.globl _CCAPM2
|
|
.globl _CCAPM1
|
|
.globl _CCAPM0
|
|
.globl _CMOD
|
|
.globl _CCON
|
|
.globl _ADCTIM_X
|
|
.globl _ADCCFG
|
|
.globl _ADC_RESL
|
|
.globl _ADC_RES
|
|
.globl _ADC_CONTR
|
|
.globl _SPDAT
|
|
.globl _SPCTL
|
|
.globl _SPSTAT
|
|
.globl _IP2H
|
|
.globl _IP2
|
|
.globl _IP
|
|
.globl _IE2
|
|
.globl _IE
|
|
.globl _BRT
|
|
.globl _P_SW1
|
|
.globl _SADEN
|
|
.globl _SADDR
|
|
.globl _S2BUF
|
|
.globl _S2CON
|
|
.globl _SBUF
|
|
.globl _SCON
|
|
.globl _TM4PS_X
|
|
.globl _TM3PS_X
|
|
.globl _TM2PS_X
|
|
.globl _T4T3M
|
|
.globl _T4L
|
|
.globl _T4H
|
|
.globl _T3L
|
|
.globl _T3H
|
|
.globl _T2L
|
|
.globl _T2H
|
|
.globl _INTCLKO
|
|
.globl _AUXR
|
|
.globl _TH1
|
|
.globl _TH0
|
|
.globl _TL1
|
|
.globl _TL0
|
|
.globl _TMOD
|
|
.globl _TCON
|
|
.globl _P_SW2
|
|
.globl _P5M0
|
|
.globl _P5M1
|
|
.globl _P4M0
|
|
.globl _P4M1
|
|
.globl _P3M0
|
|
.globl _P3M1
|
|
.globl _P2M0
|
|
.globl _P2M1
|
|
.globl _P1M0
|
|
.globl _P1M1
|
|
.globl _P0M0
|
|
.globl _P0M1
|
|
.globl _PSW
|
|
.globl _B
|
|
.globl _ACC
|
|
.globl _PCON
|
|
.globl _DPH
|
|
.globl _DPL
|
|
.globl _SP
|
|
.globl _P5
|
|
.globl _P4
|
|
.globl _P3
|
|
.globl _P2
|
|
.globl _P1
|
|
.globl _P0
|
|
.globl _delay_us
|
|
.globl _delay_ms
|
|
;--------------------------------------------------------
|
|
; special function registers
|
|
;--------------------------------------------------------
|
|
.area RSEG (ABS,DATA)
|
|
.org 0x0000
|
|
_P0 = 0x0080
|
|
_P1 = 0x0090
|
|
_P2 = 0x00a0
|
|
_P3 = 0x00b0
|
|
_P4 = 0x00c0
|
|
_P5 = 0x00c8
|
|
_SP = 0x0081
|
|
_DPL = 0x0082
|
|
_DPH = 0x0083
|
|
_PCON = 0x0087
|
|
_ACC = 0x00e0
|
|
_B = 0x00f0
|
|
_PSW = 0x00d0
|
|
_P0M1 = 0x0093
|
|
_P0M0 = 0x0094
|
|
_P1M1 = 0x0091
|
|
_P1M0 = 0x0092
|
|
_P2M1 = 0x0095
|
|
_P2M0 = 0x0096
|
|
_P3M1 = 0x00b1
|
|
_P3M0 = 0x00b2
|
|
_P4M1 = 0x00b3
|
|
_P4M0 = 0x00b4
|
|
_P5M1 = 0x00c9
|
|
_P5M0 = 0x00ca
|
|
_P_SW2 = 0x00ba
|
|
_TCON = 0x0088
|
|
_TMOD = 0x0089
|
|
_TL0 = 0x008a
|
|
_TL1 = 0x008b
|
|
_TH0 = 0x008c
|
|
_TH1 = 0x008d
|
|
_AUXR = 0x008e
|
|
_INTCLKO = 0x008f
|
|
_T2H = 0x00d6
|
|
_T2L = 0x00d7
|
|
_T3H = 0x00d4
|
|
_T3L = 0x00d5
|
|
_T4H = 0x00d2
|
|
_T4L = 0x00d3
|
|
_T4T3M = 0x00d1
|
|
_TM2PS_X = 0xfea1
|
|
_TM3PS_X = 0xfea2
|
|
_TM4PS_X = 0xfea3
|
|
_SCON = 0x0098
|
|
_SBUF = 0x0099
|
|
_S2CON = 0x009a
|
|
_S2BUF = 0x009b
|
|
_SADDR = 0x00a9
|
|
_SADEN = 0x00b9
|
|
_P_SW1 = 0x00a2
|
|
_BRT = 0x009c
|
|
_IE = 0x00a8
|
|
_IE2 = 0x00af
|
|
_IP = 0x00b8
|
|
_IP2 = 0x00b6
|
|
_IP2H = 0x00b7
|
|
_SPSTAT = 0x00cd
|
|
_SPCTL = 0x00ce
|
|
_SPDAT = 0x00cf
|
|
_ADC_CONTR = 0x00bc
|
|
_ADC_RES = 0x00bd
|
|
_ADC_RESL = 0x00be
|
|
_ADCCFG = 0x00de
|
|
_ADCTIM_X = 0xfea8
|
|
_CCON = 0x00d8
|
|
_CMOD = 0x00d9
|
|
_CCAPM0 = 0x00da
|
|
_CCAPM1 = 0x00db
|
|
_CCAPM2 = 0x00dc
|
|
_CCAPM3 = 0x00dd
|
|
_CCAP0L = 0x00ea
|
|
_CCAP1L = 0x00eb
|
|
_CCAP2L = 0x00ec
|
|
_CCAP3L = 0x00ed
|
|
_PCA_PWM0 = 0x00f2
|
|
_PCA_PWM1 = 0x00f3
|
|
_PCA_PWM2 = 0x00f4
|
|
_PCA_PWM3 = 0x00f5
|
|
_WDT_CONTR = 0x00c1
|
|
_IAP_DATA = 0x00c2
|
|
_IAP_ADDRH = 0x00c3
|
|
_IAP_ADDRL = 0x00c4
|
|
_IAP_CMD = 0x00c5
|
|
_IAP_TRIG = 0x00c6
|
|
_IAP_CONTR = 0x00c7
|
|
_IAP_TPS = 0x00f7
|
|
_IRCBAND_REG = 0x009d
|
|
_TA = 0x00ae
|
|
_CMPCR1 = 0x00e6
|
|
_CMPCR2 = 0x00e7
|
|
;--------------------------------------------------------
|
|
; special function bits
|
|
;--------------------------------------------------------
|
|
.area RSEG (ABS,DATA)
|
|
.org 0x0000
|
|
_TF0 = 0x008d
|
|
_TR0 = 0x008c
|
|
_IE0 = 0x0089
|
|
_IT0 = 0x0088
|
|
_TF1 = 0x008f
|
|
_TR1 = 0x008e
|
|
_TI = 0x0099
|
|
_RI = 0x0098
|
|
_REN = 0x009c
|
|
_EA = 0x00af
|
|
_ES = 0x00ac
|
|
_ET0 = 0x00a9
|
|
_ET1 = 0x00ab
|
|
_EADC = 0x00ad
|
|
;--------------------------------------------------------
|
|
; overlayable register banks
|
|
;--------------------------------------------------------
|
|
.area REG_BANK_0 (REL,OVR,DATA)
|
|
.ds 8
|
|
;--------------------------------------------------------
|
|
; internal ram data
|
|
;--------------------------------------------------------
|
|
.area DSEG (DATA)
|
|
;--------------------------------------------------------
|
|
; overlayable items in internal ram
|
|
;--------------------------------------------------------
|
|
.area OSEG (OVR,DATA)
|
|
.area OSEG (OVR,DATA)
|
|
;--------------------------------------------------------
|
|
; indirectly addressable internal ram data
|
|
;--------------------------------------------------------
|
|
.area ISEG (DATA)
|
|
;--------------------------------------------------------
|
|
; absolute internal ram data
|
|
;--------------------------------------------------------
|
|
.area IABS (ABS,DATA)
|
|
.area IABS (ABS,DATA)
|
|
;--------------------------------------------------------
|
|
; bit data
|
|
;--------------------------------------------------------
|
|
.area BSEG (BIT)
|
|
;--------------------------------------------------------
|
|
; paged external ram data
|
|
;--------------------------------------------------------
|
|
.area PSEG (PAG,XDATA)
|
|
;--------------------------------------------------------
|
|
; external ram data
|
|
;--------------------------------------------------------
|
|
.area XSEG (XDATA)
|
|
;--------------------------------------------------------
|
|
; absolute external ram data
|
|
;--------------------------------------------------------
|
|
.area XABS (ABS,XDATA)
|
|
;--------------------------------------------------------
|
|
; external initialized ram data
|
|
;--------------------------------------------------------
|
|
.area XISEG (XDATA)
|
|
.area HOME (CODE)
|
|
.area GSINIT0 (CODE)
|
|
.area GSINIT1 (CODE)
|
|
.area GSINIT2 (CODE)
|
|
.area GSINIT3 (CODE)
|
|
.area GSINIT4 (CODE)
|
|
.area GSINIT5 (CODE)
|
|
.area GSINIT (CODE)
|
|
.area GSFINAL (CODE)
|
|
.area CSEG (CODE)
|
|
;--------------------------------------------------------
|
|
; global & static initialisations
|
|
;--------------------------------------------------------
|
|
.area HOME (CODE)
|
|
.area GSINIT (CODE)
|
|
.area GSFINAL (CODE)
|
|
.area GSINIT (CODE)
|
|
;--------------------------------------------------------
|
|
; Home
|
|
;--------------------------------------------------------
|
|
.area HOME (CODE)
|
|
.area HOME (CODE)
|
|
;--------------------------------------------------------
|
|
; code
|
|
;--------------------------------------------------------
|
|
.area CSEG (CODE)
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function '_delay_loop'
|
|
;------------------------------------------------------------
|
|
;n Allocated to registers
|
|
;------------------------------------------------------------
|
|
; src/delay.c:9: static void _delay_loop(uint16_t n)
|
|
; -----------------------------------------
|
|
; function _delay_loop
|
|
; -----------------------------------------
|
|
__delay_loop:
|
|
ar7 = 0x07
|
|
ar6 = 0x06
|
|
ar5 = 0x05
|
|
ar4 = 0x04
|
|
ar3 = 0x03
|
|
ar2 = 0x02
|
|
ar1 = 0x01
|
|
ar0 = 0x00
|
|
mov r6,dpl
|
|
mov r7,dph
|
|
; src/delay.c:11: while (n--) {
|
|
00101$:
|
|
mov ar4,r6
|
|
mov ar5,r7
|
|
dec r6
|
|
cjne r6,#0xff,00115$
|
|
dec r7
|
|
00115$:
|
|
mov a,r4
|
|
orl a,r5
|
|
jz 00104$
|
|
; src/delay.c:12: NOP(); NOP(); NOP(); NOP(); NOP();
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
sjmp 00101$
|
|
00104$:
|
|
; src/delay.c:14: }
|
|
ret
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'delay_us'
|
|
;------------------------------------------------------------
|
|
;us Allocated to registers
|
|
;------------------------------------------------------------
|
|
; src/delay.c:16: void delay_us(uint16_t us)
|
|
; -----------------------------------------
|
|
; function delay_us
|
|
; -----------------------------------------
|
|
_delay_us:
|
|
mov r6,dpl
|
|
mov r7,dph
|
|
; src/delay.c:19: while (us--) {
|
|
00101$:
|
|
mov ar4,r6
|
|
mov ar5,r7
|
|
dec r6
|
|
cjne r6,#0xff,00115$
|
|
dec r7
|
|
00115$:
|
|
mov a,r4
|
|
orl a,r5
|
|
jz 00104$
|
|
; src/delay.c:20: NOP(); NOP(); NOP(); NOP(); NOP(); NOP();
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
; src/delay.c:21: NOP(); NOP(); NOP(); NOP(); NOP(); NOP();
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
; src/delay.c:22: NOP(); NOP(); NOP(); NOP(); NOP(); NOP();
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
; src/delay.c:23: NOP(); NOP(); NOP(); NOP(); NOP(); NOP();
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
sjmp 00101$
|
|
00104$:
|
|
; src/delay.c:25: }
|
|
ret
|
|
;------------------------------------------------------------
|
|
;Allocation info for local variables in function 'delay_ms'
|
|
;------------------------------------------------------------
|
|
;ms Allocated to registers
|
|
;------------------------------------------------------------
|
|
; src/delay.c:27: void delay_ms(uint16_t ms)
|
|
; -----------------------------------------
|
|
; function delay_ms
|
|
; -----------------------------------------
|
|
_delay_ms:
|
|
mov r6,dpl
|
|
mov r7,dph
|
|
; src/delay.c:29: while (ms--) {
|
|
00101$:
|
|
mov ar4,r6
|
|
mov ar5,r7
|
|
dec r6
|
|
cjne r6,#0xff,00115$
|
|
dec r7
|
|
00115$:
|
|
mov a,r4
|
|
orl a,r5
|
|
jz 00104$
|
|
; src/delay.c:30: delay_us(1000);
|
|
mov dptr,#0x03e8
|
|
push ar7
|
|
push ar6
|
|
lcall _delay_us
|
|
pop ar6
|
|
pop ar7
|
|
sjmp 00101$
|
|
00104$:
|
|
; src/delay.c:32: }
|
|
ret
|
|
.area CSEG (CODE)
|
|
.area CONST (CODE)
|
|
_DEFAULT_ADDR:
|
|
.db #0xe7 ; 231
|
|
.db #0xe7 ; 231
|
|
.db #0xe7 ; 231
|
|
.db #0xe7 ; 231
|
|
.db #0xc2 ; 194
|
|
.area XINIT (CODE)
|
|
.area CABS (ABS,CODE)
|