cD1 EQU 34H ; BCD 0.34567890 cD2 EQU 56H cD3 EQU 78H cD4 EQU 90H
DTB EQU 30H DTB1 DATA DTB+0; 90H DTB2 DATA DTB+1; 78H DTB3 DATA DTB+2; 56H DTB4 DATA DTB+3; 34H
DT EQU DTB+4 ; PACKED BCD DT1 DATA DT+0; 0.00000001m DT2 DATA DT+1; 0.000001m DT3 DATA DT+2; 0.0001m DT4 DATA DT+3; 0.01m DT5 DATA DT+4; 1m DT6 DATA DT+5; 100m DT7 DATA DT+6; 10000m DT8 DATA DT+7; 1000000m DT9 DATA DT+8; 100000000m DT10 DATA DT+9 ;-------------------------------------- ; DT = 0 SUB_CLR_DATA: MOV R0, #DTB MOV @R0, #DTB1 INC R0 MOV @R0, #DTB2 INC R0 MOV @R0, #DTB3 INC R0 MOV @R0, #DTB4 INC R0
MOV R2, #(9) CLR_DATA: MOV @R0, #0 INC R0 DJNZ R2, CLR_DATA RET ;------------------------------- SUB_ADD_30_CM: ;--ADD_30_R2A MOV R0, #DT MOV R1, #DTB MOV R2, #4 CLR C L_ADD_30_R2A: MOV A, @R0 ADDC A, @R1 DA A MOV @R0, A INC R0 INC R1 DJNZ R2, L_ADD_30_R2A
JNC L_ADD_30_EX CLR A MOV DT10, A
NEXT_ADD_30: ADDC A, @R0 DA A MOV @R0, A CLR A INC R0 JC NEXT_ADD_30
MOV DT10, A
L_ADD_30_EX: RET |