| ??? 05/17/01 19:40 Read: times |
#11668 - RE: Hexadecimal to Decimal Routine for 3byte |
Copy this text and use Notepad of windows to see the text right
; _________________________________________________________________ ; This routine convert a 16 bits number in ASCII | ; Inputs: R2(LSB) and R3 (MSB) | ; OUTPUT: The ASCII value in 30h,31h,32h,33h,34h <- internal ram | ; MSB LSB | ; | ; Destroy folows registers: R0,R1,R2,R3,R6,R7 | ; By: Bruno Marcio Diogo Venancio and Dartagnan Antunes de Oliveira| ; Date :13/05/2001 | ; Email: bruno.marcio@bol.com.br | ; _________________________________________________________________| ; Example of use: ;START: ; MOV R2,#low(1234H) ; input a 16bit number in R2,R3 ; MOV R3,#high(1234H) ; MOV R0,#30H ; This is the start address of output ; LCALL BINTODEC ; you can change for another adress ;DIE: ; JMP $ BINTODEC: MOV R0,#30h MOV DPTR,#TAB ; R=TAB(P) COM1: CLR A MOVC A,@A+DPTR MOV R7,A INC DPTR CLR A MOVC A,@A+DPTR MOV R6,A MOV R4,#'0' SOMA: ; <-----------+ CLR C ; | MOV A,R2 ; | SUBB A,R6 ; | MOV R2,A ; | MOV A,R3 ; | SUBB A,R7 ; | MOV R3,A ; | JC SAIDA ; -------+ | INC R4 ; | | SJMP SOMA ;--------|----+ SAIDA: MOV A,R4 ; <------+ MOV @R0,A MOV A,R2 ; ADD A,R6 ; N=N+R MOV R2,A ; MOV A,R3 ; ADDC A,R7 ; MOV R3,A ; INC R0 ; PSAIDA=PSAIDA +1 CLR A MOVC A,@A+DPTR CJNE A,#1,INCREMENTA RET INCREMENTA: INC DPTR LJMP COM1 TAB: DW 10000 DW 1000 DW 100 DW 10 DW 1 ; ------------------------------------------------------------------------- |
| Topic | Author | Date |
| Hexadecimal to Decimal Routine for 3byte | 01/01/70 00:00 | |
| RE: Hexadecimal to Decimal Routine for 3byte | 01/01/70 00:00 | |
| RE: Hexadecimal to Decimal Routine for 3byte | 01/01/70 00:00 | |
| RE: Hexadecimal to Decimal Routine for 3byte | 01/01/70 00:00 | |
RE: Hexadecimal to Decimal Routine for 3byte | 01/01/70 00:00 |



