1985-03-29 21:44:50 +00:00
|
|
|
.define outdec
|
1987-02-02 13:30:20 +00:00
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
.sect .text
|
1985-03-29 21:44:50 +00:00
|
|
|
! output contents of HL as a sequence
|
|
|
|
! of decimal digits
|
|
|
|
outdec:
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
|
|
|
ld de,table
|
|
|
|
ld b,4
|
|
|
|
1: call convert
|
|
|
|
or 0x30
|
|
|
|
ld (iy+0),a
|
|
|
|
inc iy
|
|
|
|
djnz 1b
|
|
|
|
ld a,l
|
|
|
|
or 0x30
|
|
|
|
ld (iy+0),a
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
! convert returns in a a count
|
|
|
|
! hl is decremented count times by (de)
|
|
|
|
! as a usefull side effect de is incremented
|
|
|
|
! by 2
|
|
|
|
convert:
|
|
|
|
push bc
|
|
|
|
ld b,h
|
|
|
|
ld c,l
|
|
|
|
ex de,hl
|
|
|
|
ld e,(hl)
|
|
|
|
inc hl
|
|
|
|
ld d,(hl)
|
|
|
|
inc hl
|
|
|
|
push hl ! save pointer to new value
|
|
|
|
ld h,b
|
|
|
|
ld l,c
|
|
|
|
xor a
|
|
|
|
1: inc a
|
|
|
|
sbc hl,de
|
|
|
|
jr nc,1b
|
|
|
|
add hl,de
|
|
|
|
dec a
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
table:
|
1987-02-02 13:30:20 +00:00
|
|
|
.data2 10000
|
|
|
|
.data2 1000
|
|
|
|
.data2 100
|
|
|
|
.data2 10
|