Re: Assembly - Convert 16 bit integer to ascii help please [message #33141 is a reply to message #33036] |
Sun, 13 January 2013 21:20   |
rusure
Messages: 1030 Registered: March 2012
Karma:
|
Senior Member |
|
|
On Sunday, January 13, 2013 12:12:30 AM UTC-7, Groepaz wrote:
> 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:
>
> its not a very good idea to use direct calls into basic rom though =P
Jim Butterfield agrees with you, but I can't figure out why. I first saw $bdcd used in a reverse assembly of a program in COMPUTE. It took me less than an hour to figure out what the call was doing. I probably coded a call to it or $8e32 on a C128 about 10 times without any difficulty. The program overwrites the contents of the accumulator and index registers.
|
|
|