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 #33068 is a reply to message #33008] Sun, 13 January 2013 10:26 Go to previous messageGo to previous message
JB is currently offline  JB
Messages: 42
Registered: January 2013
Karma:
Member
Yeah I know about $BDCD but that will only print the number not store it in a memory location. I did break that routine down and can make it work, but basic rom has to be switched in for it to work. I'd like to have a solution that will run regardless if basic is in or out.


On Saturday, January 12, 2013 9:14:39 PM UTC-5, rusure wrote:
> On Saturday, January 12, 2013 8:56:32 AM UTC-7, JB wrote:

>

>> I am looking for a routine to convert a 16 bit integer into ascii (text)

>

>>

>

>>

>

>>

>

>> ex. convert $C000 (49152) to the characters "49152" stored in a memory address.

>

>>

>

>> Ideally I would like to have a routine that you can pass an option to either print leading 0's or strip them. But first things first I guess. :)

>

>

>

> A C64 systems routine at $bdcd prints the decimal equivalent of a two byte integer. Here is how to use that code:

>

>

>

> lda $#0d

>

> jsr $ffd2

>

>

>

> lda #$c0

>

> ldx #$00

>

> jsr $bdcd

>

> rts

>

>

>

> for the C128, substitute $8e32 at bank 15 for $bdcd. I've never had to do it but I'm sure that buried in the routine at $bdcd is a routine for converting 4 nibble hexidecimal to decimal text digits. I think the routines suppreses leading zeroes.
[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: Sat Dec 02 19:35:44 EST 2023

Total time taken to generate the page: 0.00606 seconds