-
Notifications
You must be signed in to change notification settings - Fork 0
/
test4.s
95 lines (79 loc) · 1.1 KB
/
test4.s
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
ld sp, 0x1400
jp start
ds 0x66 - $
nmi:
retn
ds 0x100 - $
start:
ld hl, 56
ld bc, 56
ld d, 0
ccf
sbc hl, bc
inc d
sbc hl, bc
inc d
adc hl, bc
ld a, h
call print_bin
ld a, ' '
out (0xaa), a
ld a, l
call print_bin
ld a, ' '
out (0xaa), a
ld a, d
call print_bin
call flush
halt
ld ix, msg0
call print_str
ld hl, 0
ld a, 56
call divandprint
ld ix, msg1
call print_str
ld hl, 1
ld a, 56
call divandprint
ld ix, msg56
call print_str
ld hl, 56
ld a, 56
call divandprint
ld ix, msg57
call print_str
ld hl, 57
ld a, 56
call divandprint
ld ix, msg112
call print_str
ld hl, 112
ld a, 56
call divandprint
ld ix, msg199
call print_str
ld hl, 199
ld a, 56
call divandprint
halt
jp start
divandprint:
call divide
push de
call print_bin
ld a, '%'
out (0xaa), a
pop de
ld a, d
call print_bin
call flush
ret
include 'math.s'
include 'io.s'
msg0: db '0/56 = ', 0
msg1: db '1/56 = ', 0
msg56: db '56/56 = ', 0
msg57: db '57/56 = ', 0
msg112: db '112/56 = ', 0
msg199: db '199/56 = ', 0