|
Post by Scorpion Illuminati on Jan 11, 2016 10:34:39 GMT -5
Hi, I am working on trying to get a basic score system setup but ran into a snag. Unfortinately when your score goes above 10 it starts showing weird character instead of actual numbers. So far my int to ascii converter was working fine, but then again it never actually displayed a real score. I Tried:
ItoA_Int_w:
; Converts a word to int ASCII
; a0 --- In/Out: String address
; d0 (w) In: Number to convert
; 4 nybbles + terminator, working backwards
add.l #0x5, a0
; Zero terminate
move.b #0x0, -(a0)
move.w #0x0, d1 ; Char ptr
move.w #0x3, d2 ; 4 nybbles in a word
@NybbleLp:
move.b d0, d3 ; Byte to d3
andi.b #0x0F, d3 ; Bottom nybble
[b] cmp.w #10, d3 ; is it greater then 10
blt @NotOver10 ; skip if not over 10
add.b #5, d3 ; add 5 to string digit
@NotOver10:[/b]
add.b #ASCIINumericOffset, d3 ; In numeric range (0 - 9)
move.b d3, -(a0) ; Back to string
lsr.w #0x4, d0 ; Next nybble
dbra d2, @NybbleLp ; Loop
rts
To no avail as it only offsets the ascii character, so instead of starting of : it starts at A. I am attaching the latest version of the source code as reference. Any assistance in this matter would be greatly appreciated. Signed, Scorepion Illuminati Source: Link
|
|