Re: 8bit binary to ASCII

From: Professor Dredd (profdredd_at_yahoo.com)
Date: 2001-09-26 05:48:49

; OUTPUT A AS A HEXADECIMAL NUMBER
;
CHROUT EQU $FFD2
;
; BINARY EXAMPLE
PHA
LSR
LSR
LSR
LSR
JSR HEXOUT
PLA
AND #$0F
;
HEXOUT CMP #10
BCC SKIP
ADC #'A'-9-2
SKIP ADC #'0'
JMP CHROUT ; OUTPUT HEX DIGIT
;
;
;
; OUTPUT A 16-BIT DECIMAL NUMBER
;
INTOUT EQU $BDCD
;
LDX LSB
LDA MSB
JSR INTOUT ; Y IS DESTROYED

There are also binary to decimal conversion routines in the
C-128 monitor ROM as well as the 1541 DOS IP ROM. Hope that
helps!

--- Nathan Smith <stryyker16@hotmail.com> wrote:
> 
> ----- Original Message -----
> From: <ncoplin@orbeng.com>
> To: <cbm-hackers@cling.gu.se>
> Sent: Wednesday, September 26, 2001 11:24 AM
> Subject: 8bit binary to ASCII
> 
> 
> | Hi All,
> |
> | Does any one have a short assembly routine for
> converting an 8bit unsigned
> | binary number (0-255) to ASCII?
> |
> | The BASIC ROM only seems to have floating to ASCII
> conversion...
> |
> | - Nick
> |
> |
> www.6502.org has a routine that converts 32bit (I think)
> to BCD which can be
> easily used for what you want.
> 
>        Message was sent through the cbm-hackers mailing
list


=====
go6502 - Commodore and Apple II news, programs, hardware and resources
http://www.geocities.com/profdredd

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.1.