-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn.inc
executable file
·87 lines (76 loc) · 1.27 KB
/
fn.inc
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
; Просто функции
;-------------------------------------------------------------------------------
memcpy8back:
ldax d
mov m, a
dcx d
dcx h
dcx b
mov a, c
ora b
jnz memcpy8back
ret
;-------------------------------------------------------------------------------
memcpy8:
mov a, m
stax d
inx d
inx h
dcr c
jnz memcpy8
ret
;-------------------------------------------------------------------------------
memset8:
mov m, a
inx h
dcr c
jnz memset8
ret
;-------------------------------------------------------------------------------
delay8000:
lxi d, 08000h
delay:
dcx d
mov a, d
ora e
jnz delay
ret
;-------------------------------------------------------------------------------
; 16 битное деление
div16:
MOV A,H
ORA L
RZ
LXI B,0000
PUSH B
div16_1:
MOV A,E
SUB L
MOV A,D
SBB H
JC div16_2
PUSH H
DAD H
JNC div16_1
div16_2:
LXI H,0000
div16_3:
POP B
MOV A, B
ORA C
RZ
DAD H
PUSH D
MOV A, E
SUB C
MOV E, A
MOV A, D
SBB B
MOV D, A
JC div16_4
INX H
POP B
JMP div16_3
div16_4:
POP D
JMP div16_3