repo.or.cz
/
urasm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
added "printf[0a]", and "error"
[urasm.git]
/
libs
/
printdechl
blob
aaf053aa0c8ccd720b69711281551258c3f2d59f
1
printdechl:
2
ld e,0
3
ld bc,-10000
4
call .printdec1
5
ld bc,-1000
6
call .printdec1
7
ld bc,-100
8
call .printdec1
9
ld c,-10
10
call .printdec1
11
ld d,l
12
.printdigit:
13
ld a,'0'
14
add a,d
15
rst #10
16
ret
17
.printdec1:
18
; The hl register pair holds the number
19
; and the bc register the value for 'repeated subtraction'
20
ld d,0
21
.loop:
22
add hl,bc
23
inc d
24
jr c,.loop
25
sbc hl,bc
26
inc e
27
dec d
28
jr nz,.printdigit
29
dec e
30
ret z
31
jr .printdigit