-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprint.asm
88 lines (73 loc) · 1.67 KB
/
print.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
;
; Slowdos Source Code
;
;
; $Id: print.asm,v 1.1 2003/06/15 20:26:26 dom Exp $
; $Author: dom $
; $Date: 2003/06/15 20:26:26 $
;
; Routines regarding printing
MODULE printing
EXTERN cjump ; jp(hl)
EXTERN rom3
PUBLIC prhund
PUBLIC print
PUBLIC messag
PUBLIC string
PUBLIC setchan
; Print a number out
; Entry: hl = number
; b = 0, print leading zeros
; b = 255, print leading spaces
; b = 254, don't print anything
prhund: ld de,100
call numcal
ld de,10
call numcal
ld de,1
ld b,0 ; Got to print something!
numcal: ld a,255
numca1: inc a
and a
sbc hl,de
jr nc,numca1
add hl,de
and a
jr z,numca2
ld b,0
numca2: add A,48
ld c,a
ld a,b
and a
jr z,numca3
inc a
ret nz
ld c,32
numca3: ld a,c
;; Fall into print
print: call rom3
defw 16
ret
; Print a string to screen.
; String to print is after the call to messag
messag: pop hl
messa1: ld a,(hl)
inc hl
cp 255
jp z,cjump+1
call print
jr messa1
; Print a string to screen
; Entry: de = text
; bc = length
string: ld a,b
or c
ret z
ld a,(de)
call print
inc de
dec bc
jr string
setchan: call rom3
defw 5633
ret