Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Assembly - Convert 16 bit integer to ascii help please
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Assembly - Convert 16 bit integer to ascii help please [message #33090 is a reply to message #33069] Sun, 13 January 2013 11:42 Go to previous messageGo to previous message
Anonymous
Karma:
Originally posted by: <fr>

after BNE DEC4... let me remove the ">" :

;* DECIMAL TO ASCII ROUTINE *
;* LOW-BYTE IN .X HI-BYTE IN .A
;* STORES ASCII STRING IN MEMORY
;* Y=0 REMOVES LEADING 0'S
;* Y=1 PRINTS LEADING 0'S

DECIMAL STX BINARY
STA BINARY+1
STY DIGITS
LDY #0
DEC1 LDX #"0"
DEC2 LDA BINARY
CMP DECTBL1,Y
LDA BINARY+1
SBC DECTBL2,Y
BCC DEC3
STA BINARY+1
LDA BINARY
SBC DECTBL1,Y
STA BINARY
INX
BNE DEC2
DEC3 TXA
BNE DEC4
CPY #4
BEQ DEC4
LDX DIGITS
BEQ DEC5
DEC4 INC DIGITS
STA DECCHR,Y
JSR $FFD2
DEC5 INY
CPY #5
BNE DEC1
RTS

DIGITS .BYTE 0

DECTBL1 .BYTE <10000,<1000,<100
..BYTE <10,<1
DECTBL2 .BYTE >10000,>1000,>100
..BYTE >10,>1

DECCHR .WORD 0,0
BINARY .WORD 0


"JB" <jbrown1289@gmail.com> a écrit dans le message de news:
f8a4f3fb-66d5-4192-a36b-df6d4d881b95@googlegroups.com...
> FR:

>

> where does the CPY #4 and BEQ DEC4 go in the code?

>

>

>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PTV-Newsletter 5/2013
Next Topic: THE MULTICART IS FINALLY READY!!!!!!
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Jan 29 05:00:40 EST 2023

Total time taken to generate the page: 0.00274 seconds