Last active
December 16, 2015 11:18
-
-
Save mjbella/5426367 to your computer and use it in GitHub Desktop.
Decimal Add on the MSP430
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME toBCD | |
PUBLIC toBCD | |
RSEG CODE | |
toBCD MOV #16, R15 ; Loop Counter | |
MOV R12, R14 ; Move the input to R14 so we can use R12 for our output | |
CLR R12 ; Clear our output register | |
L$1 RLA R14 ; Binary MSB to carry | |
DADD R12,R12 ; Decimal Acc into R12 | |
DEC R15 ; Count down from 16 | |
JNZ L$1 ; Loop again? | |
RET ; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment