2013-04-30 12:19 AM
hello,
please can help me someone one with an assembly language who convert a 5digit BCD to BIN many thanks2013-04-30 06:45 AM
.ScanU16
; Save ASCII Input
PUSHW Y
PUSHW X
; U16 Result = 0;
CLRW X
; Loop counter initialization
LDW Y,#5
ScanU16Loop
; Result = Result * 10;
SLLW X
; Temporary word allocation
PUSHW X
SLLW X
SLLW X
ADDW X,(1,SP)
; (1,SP) = value of A
CP A,#'0'
JRMI BadDigitValue
CP A,#'9'
JRUGT BadDigitValue
SUB A,#'0'
LD (2,SP),A
CLR (1,SP) ; High Byte is always 0
; Result = Result + Value_of_Digit;
ADDW X,(1,SP)
BadDigitValue
; Temporary word deallocation
ADDW SP,#2
; Process next digit
POP A
DECW Y
JRNE ScanU16Loop
SUBW SP,#1
RET
Marc,
the above function returns in X the value of the five ASCII digits which are stored in {A,X,Y}.
This function is the inverse of the one I send you here
/f57b93c7
EtaPhi2013-05-02 12:12 PM
hello sir,
i thank you very mutch for the program you have prepared. it works very well i like too the stm8s ,pity there is not many information on it but any way, thanks for the help marc debruyne