p*-------------------------------
*
* 32 bit -> ASCII conversion
*
* Take 2 -- Divide by 10 manually; remainder is coeff
* of successive powers of 10
*
* Number to convert -> faq2..faq2+3 (lo..hi)
*
* SLJ 8/28/96

          ORG $1300

FAQ2      EQU $6A
TEMP      EQU $FE

CHROUT    EQU $FFD2

          LDA #$FF
          STA FAQ2
          STA FAQ2+1
          STA FAQ2+2
          STA FAQ2+3

          LDA #10
          STA FAQ2+4

          LDY #10
:LOOP     STY TEMP
          JSR DIV32
          LDY TEMP
          CLC
          ADC #48
          STA $0400,Y     ;Stick it on the screen
          DEY
          BNE :LOOP
          RTS


*
* Routine to divide a 32-bit number (in faq2..faq2+3) by
* the 8-bit number in faq2+4.  Result -> faq2..faq2+3, remainder
* in A.  Numbers all go lo..hi
*

DIV32     LDA #00
          LDY #$20
:LOOP     ASL FAQ2
          ROL FAQ2+1
          ROL FAQ2+2
          ROL FAQ2+3
          ROL
          CMP FAQ2+4
          BCC :DIV2
          SBC FAQ2+4
          INC FAQ2
:DIV2     DEY
          BNE :LOOP
          RTS
