User Tools

Site Tools


base:tiny_.a_to_ascii_routine

Tiny .A to ASCII routine

From somebody in comp.sys.cbm, don't remember who nor if I tweaked it further to get this version. The thread was probably “Converting An 8-bit Number Into A String”, but I couldn't find it in Google.

Converts .A to 3 ASCII/PETSCII digits: .Y = hundreds, .X = tens, .A = ones

  ldy #$2f
  ldx #$3a
  sec
- iny
  sbc #100
  bcs -
- dex
  adc #10
  bmi -
  adc #$2f
  rts

White Flame (aka David Holz)
http://www.white-flame.com/

base/tiny_.a_to_ascii_routine.txt · Last modified: 2015-04-17 04:34 (external edit)