-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshowline.asm
104 lines (70 loc) · 901 Bytes
/
showline.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; showline.asm
bdos equ 5
parambegin equ 80h
paramlen equ 128
org 100h
call showendline
ld hl, parambegin
ld b, paramlen
nextchar: ld a, (hl)
call showreg
inc hl
;djnz nextchar
dec b
jp nz, nextchar
call showendline
ld hl, parambegin
ld a, (hl)
nextchar2: inc hl
cp 0
jp z, nomorechar
ld e, (hl)
ld c, 2
push hl
push af
call bdos
pop af
pop hl
dec a
jp nextchar2
nomorechar: call showendline
call 0
showendline: ld de, endline
ld c, 9
call bdos
ret
showreg:
push bc
push hl
push af
push af
ld e, 20h
ld c, 2
call bdos
pop af
; Para ver mejor al trazar.
and 0F0h
rrca
rrca
rrca
rrca
call shownibble
pop af
call shownibble
pop hl
pop bc
ret
shownibble:
and 0Fh
add a, 30h
cp 3Ah
jp c, isdigit
add a, 7
isdigit:
ld e, a
ld c, 2
call bdos
ret
endline defb 0Dh, 0Ah, '$'
this_is_the_end: end
; End of showline.asm