Blame | Last modification | View Log | Download | RSS feed | ?url?
;**************************************************************
;
CRST: ; This performs system initialzation, it was moved here so the
; new power on reset functions could be tested in an 8751.
;
;**************************************************************
;
; First, initialize SFR's
;
MOV SCON,#5AH ;INITIALIZE SFR'S
MOV TMOD,#10H
MOV TCON,#54H
DB 75H ;MOV DIRECT, # OP CODE
DB 0C8H ;T2CON LOCATION
DB 34H ;CONFIGURATION BYTE
;
MOV DPTR,#2001H ;READ CODE AT 2001H
CLR A
MOVC A,@A+DPTR
CJNE A,#0AAH,$+6 ;IF IT IS AN AAH, DO USER RESET
LCALL 2090H
;
MOV R0,#IRAMTOP ;PUT THE TOP OF RAM IN R0
CLR A ;ZERO THE ACC
;
MOV @R0,A ;CLEAR INTERNAL MEMORY
DJNZ R0,$-1 ;LOOP TIL DONE
;
; Now, test the external memory
;
MOV SPSAV,#CMNDSP ;SET UP THE STACK
MOV SP,SPSAV
;
MOV BOFAH,#HI(ROMADR)
MOV BOFAL,#LO(ROMADR+17)
MOV DPTR,#ROMADR ;GET THE BYTE AT 8000H
MOVX A,@DPTR
CLR C
SUBB A,#31H ;FOR BIAS
MOV MT1,A ;SAVE IN DIRECT MATH LOC
CLR ACC.2 ;SAVE FOR RESET
MOV R7,A ;SAVE IT IN R7
INC DPTR
ACALL L31DPI ;SAVE BAUD RATE
LCALL RCL
INC DPTR ;GET MEMTOP
ACALL L31DPI
MOV DPTR,#5FH ;READ THE EXTERNAL BYTE
MOVX A,@DPTR
MOV DPTR,#0 ;ESTABLISH BASE FOR CLEAR
CJNE A,#0A5H,CRS
MOV A,MT1
CLR ACC.0 ;CLEAR BIT ONE
XRL A,#4H
JZ CR2
;
CRS: CJNE R7,#2,$+5
SJMP $+5
CJNE R7,#3,$+7
ACALL CL_1
SJMP CR1
;
CR0: MOV R3,DPH ;SAVE THE DPTR
MOV R1,DPL
INC DPTR
MOV A,#5AH
MOVX @DPTR,A
MOVX A,@DPTR
CJNE A,#5AH,CR1
CLR A
MOVX @DPTR,A
CJNE R3,#0E0H,CR0
;
CR1: CJNE R3,#03H,$+3 ;NEED THIS MUCH RAM
JC CRST
MOV DPTR,#MEMTOP ;SAVE MEMTOP
ACALL S31DP2 ;SAVE MEMTOP AND SEED RCELL
ACALL CNEW ;CLEAR THE MEMORY AND SET UP POINTERS
;
CR2: ACALL RC1 ;SET UP STACKS IF NOT DONE
;
LCALL AXTAL0 ;DO THE CRYSTAL
MOV A,MT1 ;GET THE RESET BYTE
CJNE A,#5,$+6
LCALL 4039H
JNC BG1 ;CHECK FOR 0,1,2,3, OR 4
JNB ACC.0,BG3 ;NO RUN IF WRONG TYPE
MOV DPTR,#ROMADR+16
MOVX A,@DPTR ;READ THE BYTE
CJNE A,#55H,BG3
LJMP CRUN
;
BG1: CLR A ;DO BAUD RATE
MOV R3,A
MOV R1,A
MOV R0,#4
JB RXD,$ ;LOOP UNTIL A CHARACTER IS RECEIVED
;
BG2: DJNZ R0,$ ;FOUR CLOCKS, IN LOOP
LCALL DEC3210+4 ;NINE CLOCKS ******AA CALL-->LCALL
MOV R0,#2 ;ONE CLOCK
JNB RXD,BG2 ;TWO CLOCKS, LOOP UNTIL DONE
JB RXD,$ ;WAIT FOR STOP CHARACTER TO END
JNB RXD,$
LCALL RCL ;LOAD THE TIMER ******AA CALL-->LCALL
;
BG3: MOV DPTR,#S_N ;GET THE MESSAGE
ACALL CRP ;PRINT IT
LJMP CRAM