-
Notifications
You must be signed in to change notification settings - Fork 8
/
CHANGE.PRN
148 lines (123 loc) · 3.46 KB
/
CHANGE.PRN
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Proc RESET_DSP near
MOV DX,[_io_addx]
ADD DL,6
; MOV AL,1 ;JCM (GET RID OF THIS CODE)
; OUT DX,AL ;JCM
; IN AL,DX ;JCM
;@@RDSP05: ;JCM
; INC AL ;JCM
; JNZ @@RDSP05 ;JCM
; OUT DX,AL ;JCM
mov al,1 ;JCM (USE THIS INSTEAD)
out dx,al ;JCM
;JCM
mov cx,20 ;JCM
@@wait: in al,dx ;JCM ;wait > 3 uS
loop @@wait ;JCM
;JCM
mov al,0 ;JCM ;drop reset
out dx,al ;JCM
MOV CL,20H
@@RDSP10:
CALL READ_DSP_TIME
CMP AL,0AAH
JE @@RDSP20
DEC CL
JNZ @@RDSP10
MOV AX,2
JMP SHORT @@RDSP90
@@RDSP20:
SUB AX,AX
@@RDSP90:
OR AX,AX
RET
endp
PIC0_val db ?
PIC1_val db ?
;-------------------------------------------------
; entry: AL = INTERRUPT NUM |
; DX = new vector ofs, seg is alway CS |
; BX = offset of store buffer :
;-------------------------------------------------
Proc SETUP_INTERRUPT near
PUSH BX
PUSH CX
PUSH DX
CLI
xor ah,ah ; Zero high byte.
MOV CL,AL ; preserve interrupt number for use
cmp al,8
jb @@calc_vect
add al,60h ; index slcae PIC vectors if IRQ > 7
@@calc_vect:
ADD AL,8 ; calculate interrupt vector addx
SHL Ax,1
SHL Ax,1
MOV DI,AX
PUSH ES ; setup and preserve interrupt
SUB AX,AX
MOV ES,AX
MOV AX,[ES:DI]
MOV [cs:BX],AX ;JCM
MOV [ES:DI],DX
MOV AX,[ES:DI+2]
MOV [cs:BX+2],AX ;JCM
MOV [ES:DI+2],CS
POP ES
mov bx,1
shl bx,cl
not bx
in al,0a1h
mov [PIC1_val],al
and al,bh
out 0a1h,al
in al,21h
mov [PIC0_val],al
and al,bl
out 21h,al
STI
POP DX
POP CX
POP BX
RET
endp
;-------------------------------------------------
; entry: AL = INTERRUPT NUM |
; BX = offset to stored addx |
;-------------------------------------------------
Proc RESTORE_INTERRUPT near
CLI
MOV CL,AL
push bx ;JCM
mov bx,1
shl bx,cl
in al,0a1h
or al,bh
and al,[PIC1_val] ;don't kill any interrupts that were
out 0a1h,al ;initially active
in al,21h
or al,bl
and al,[PIC0_val]
out 21h,al
pop bx ;JCM
mov al,cl ; Get back interrupt number.
xor ah,ah
cmp al,8
jb @@calc_vect
add al,60h ; index slave PIC if IRQ > 7
@@calc_vect:
ADD AL,8 ; calculate interrupt vector addx
SHL Ax,1
SHL Ax,1
MOV DI,AX
PUSH ES ; restore interrupt vector
SUB AX,AX
MOV ES,AX
MOV AX,[cs:BX] ;JCM
MOV [ES:DI],AX
MOV AX,[cs:BX+2] ;JCM
MOV [ES:DI+2],AX
POP ES
STI
RET
endp