??? 06/02/05 06:07 Read: times |
#94221 - DAA instruction helps BCD conversion Responding to: ???'s previous message |
This example uses the DAA instruction to do BCD conversion.
It follows the algorithm mentioned above. ;******************************* ;16 BIT BINARY TO BCD CONVERTER ;TAKES 16 BITS BINARY IN R3,2 ;AND CONVERTS IT TO 6 DIGIT BCD IN R6,5,4 ;TIMING 284 CYCLES AND 31 BYTES (500us @7.37MHz) BINBCD CLR A MOV R4,A MOV R5,A MOV R6,A ;CLEAR RESULT SETB C ;COUNTER CALL BBCDB ;CONVERT HI BYTE MOV A,R2 ;CONVERT LO BYTE SETB C ;COUNTER JMP BBCDC BBCDA MOV A,R4 ADDC A,R4 DA A MOV R4,A MOV A,R5 ADDC A,R5 DA A MOV R5,A MOV A,R6 ADDC A,R6 DA A MOV R6,A BBCDB MOV A,R3 BBCDC RLC A MOV R3,A JNZ BBCDA ;17 CYCLES/LOOP RET Peter |
Topic | Author | Date |
Hex to Dec Coversion Assembly code | 01/01/70 00:00 | |
back to math | 01/01/70 00:00 | |
Poor question | 01/01/70 00:00 | |
never underestimate anybody | 01/01/70 00:00 | |
If you want respect here... | 01/01/70 00:00 | |
At least you've achieved something | 01/01/70 00:00 | |
Net score | 01/01/70 00:00 | |
Format | 01/01/70 00:00 | |
DAA instruction helps BCD conversion | 01/01/70 00:00 | |
My quary to Raghunathan sir | 01/01/70 00:00 | |
May I ask a question? | 01/01/70 00:00 | |
Reply to Mr. Ijaz Ahmed | 01/01/70 00:00 | |
underestimating | 01/01/70 00:00 | |
How about ... | 01/01/70 00:00 | |
Looks OK | 01/01/70 00:00 | |
It can be easier to re-map a range..... | 01/01/70 00:00 | |
lookup table? | 01/01/70 00:00 | |
was thinking the same | 01/01/70 00:00 | |
hextobcd conversion![]() | 01/01/70 00:00 |