.section vectors, #alloc
;*************************************************************
.org 0x00
LJMP reset
.org 0x03
LJMP intIE0 ; external interrupt 0
.org 0x0B
LJMP intTF0 ; timer 0
.org 0x13
LJMP intIE1 ; external interrupt 1
.org 0x1B
LJMP intTF1 ; timer 1
.org 0x23
LJMP intRITI ; serial port
;
.section reset_begin, #alloc
;*************************************************************
.global reset
reset:
MOV R7,#20 ;ISP DELAY for AT89S8252 CPU
ISP_Ra: MOV R6,#0xFF ; 255 x 255 x 25 = 650 ms for 22.1184 MHz Xtal
ISP_Rb: MOV R5,#0xFF
ISP_Rc: DJNZ R5,ISP_Rc
DJNZ R6,ISP_Rb
DJNZ R7,ISP_Ra
MOV P0,#-1
MOV P1,#0
MOV P2,#-1
MOV P3,#-1
MOV SP,#stack
MOV R0,#0
resLP: MOV @R0,#0
INC R0
MOV A,R0
JNZ resLP
;
mov PCON,#0 ; default
mov TMOD,#0b00000001; timer 0, 16 bit mode
; timer 1, default
mov tl0,#LOW(SysTik)
mov th0,#HIGH(SysTik)
mov TCON,#0x30 ; start timer0, other bits set to default
mov IE,#0b00000010 ; enable timer0 int
.if RD2
mov CKCON, #C2SETUP
; mov AUXR1, #0 ;select DPTR
mov AUXR, #X2SETUP
.endif
.section reset_end, #alloc
;*************************************************************
orl IE,#0b10000000 ; enable interrupt
.ifdef SERIAL
clr rxint ; clear interrupt flags
clr txint
.endif
clr bit1ms
mov slowtimer,#slowtiming
INIT_WD
;; ajmp main
.section fast_begin, #alloc
;*************************************************************
.global main
main:
RESTART_WD ;restart Watchdog
.ifdef SERIAL
lcall sstat ;scan RTS/CTS,...
.endif
mov stateFlg,#0 ;flagARP..flagTCP
clr rx_eth_bit
LCALL rcv_pkt
jnb rx_eth_bit,NoRxEth
acall ProcessEthPacket