; in HL:DE the 32 bit integer
; BC points to the output
long2ascii:
; HL = HIGH WORD
PUSH DE
EXX
POP HL ; HL' = LOW WORD
EXX
LD E,C
LD D,B
LD BC,-1000000000/0x10000 -1
EXX
LD BC,-1000000000&0xFFFF
EXX
CALL NUM1
LD BC,-100000000/0x10000 -1
EXX
LD BC,-100000000&0xFFFF
EXX
CALL NUM1
LD BC,-10000000/0x10000 -1
EXX
LD BC,-10000000&0xFFFF
EXX
CALL NUM1
LD BC,-1000000/0x10000 -1
EXX
LD BC,-1000000&0xFFFF
EXX
CALL NUM1
LD BC,-100000/0x10000 -1
EXX
LD BC,-100000&0xFFFF
EXX
CALL NUM1
LD BC,-10000/0x10000 -1
EXX
LD BC,-10000&0xFFFF
EXX
CALL NUM1
LD BC,-1000/0x10000 -1
EXX
LD BC,-1000&0xFFFF
EXX
CALL NUM1
LD BC,-100/0x10000 -1
EXX
LD BC,-100&0xFFFF
EXX
CALL NUM1
LD BC,-10/0x10000 -1
EXX
LD BC,-10&0xFFFF
EXX
CALL NUM1
LD BC,-1/0x10000 -1
EXX
LD BC,-1&0xFFFF
EXX
CALL NUM1
RET
NUM1:
LD A,'0'-1 ; '0' IN THE TILESET
NUM2:
INC A
EXX
add HL,BC ; low word
EXX
ADC HL,BC ; high word
jp C,NUM2
EXX
SBC HL,BC ; low word
EXX
SBC HL,BC ; high word
LD (DE),A
INC DE
RET