-
Notifications
You must be signed in to change notification settings - Fork 0
/
interrupciones
204 lines (176 loc) · 5.2 KB
/
interrupciones
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
;*****************************************************************
; Aprendiendo Assembler - 8085
; Actividad: Entender las interrupciones
; FERRER, Ezequiel
;*****************************************************************
; Requiere (simulacion):
; - Teclado en puerto 10h
;*****************************************************************
; Definición de Etiquetas
;*****************************************************************
.define
BootAddr 0000h
StackAddr FFFFh
DataROM 4100h
DataRAM 5100h
AddrIntRST1 0008h ; direcciones de intr
AddrIntRST2 0010h
AddrIntRST3 0018h
AddrIntRST4 0020h
AddrIntTRAP 0024h
AddrIntRST5 0028h
AddrIntRST55 002Ch
AddrIntRST6 0030h
AddrIntRST65 0034h
AddrIntRST7 0038h
AddrIntRST75 003Ch
MSE 08h ; establecimiento de intr
M75 04h
M65 02h
M55 01h
Teclado 10h ; Puerto teclado
CantD 10 ; elementos del vector
;*****************************************************************
; Datos en ROM
;*****************************************************************
.data DataROM
;DatoNum: dB 4h, 8h, 5h, 2h, 0h, 3h, 2h, 9h, 3h, 7h
DatoNum: dB 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h
;DatoNum: dB 5Ch, D8h, 35h, 2Fh, 90h, 38h, A7h, B9h, 33h, A7h
;*****************************************************************
; Datos en RAM
;*****************************************************************
.data DataRAM
DatoAux: dB 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h, 0h
CantPar: dB 0h
CritOrden: dB 0h
DatoTecl: dB 0h
FlgNewData: dB 0h ; 1= new 3= new idem
;*****************************************************************
; Arranque del 8085
;*****************************************************************
.org BootAddr
JMP Boot
;*****************************************************************
; Vector de INTR
;*****************************************************************
.org AddrIntRST1
JMP IntRST1
.org AddrIntRST2
JMP IntRST2
.org AddrIntRST3
JMP IntRST3
.org AddrIntRST4
JMP IntRST4
.org AddrIntTRAP
JMP IntTRAP
.org AddrIntRST5
JMP IntRST5
.org AddrIntRST55
JMP IntRST55
.org AddrIntRST6
JMP IntRST6
.org AddrIntRST65
JMP IntRST65
.org AddrIntRST7
JMP IntRST7
.org AddrIntRST75
JMP IntRST75
;*****************************************************************
; Definiciones de INTR
;*****************************************************************
IntRST1:
RET
IntRST2:
RET
IntRST3:
RET
IntRST4:
RET
IntTRAP:
RET
IntRST5:
RET
IntRST55:
RET
IntRST6:
RET
IntRST65: ; FlgNewData (i) newdata, NEW != LAST lo guardo en RAM
PUSH PSW
LDA FlgNewData ; |> A<- FlgNewData && (0000 0001)
ANI 01h ; |
JNZ MismaTecl ; A!=0 ? => salto
IN Teclado ; |> en RAM<- tecla
STA DatoTecl ; |
MVI A, 01h ; |> FlgNewData<- (0000 0001)
STA FlgNewData ; |
MismaTecl:
POP PSW
EI
RET
IntRST7:
RET
IntRST75:
RET
;*****************************************************************
; PROGRAMA PRINCIPAL
;*****************************************************************
Boot:
LXI SP, StackAddr
MVI A, MSE|M75|M55 ; 0000 1101 para las intr
SIM ; Inicializo las inter
EI
LXI H, DatoNum ; posiciono array datos
MVI B, CantD ; contador para cargar datos
Main:
LDA FlgNewData ; |> A<- FlgNewData && (0000 0001)
ANI 01h ; | L> (NEW?:01h OTHER?:00h)
JZ Main ; A=0 ? => main
CALL ProcesaTecl ; A!=0 => salto
DCR B ; un numero menos
JNZ Main ; hasta que se llene el array
HLT
ProcesaTecl:
;PUSH H ; guardo pa no cagarla
;PUSH PSW
LDA DatoTecl ; A<- tecla
CPI '0' ; comparo con 0
JZ valid ; es cero? sigo comparando
CPI '1' ; comparo con 1
JZ valid ; es uno?.....
CPI '2'
JZ valid
CPI '3'
JZ valid
CPI '4'
JZ valid
CPI '5'
JZ valid
CPI '6'
JZ valid
CPI '7'
JZ valid
CPI '8'
JZ valid
CPI '9'
JZ valid ; ...no es valido?
JMP NoDato ; se tira
valid:
CALL GuardarDato ; al array
NoDato:
LDA FlgNewData ; |> A<- FlgNewData && (1111 1110)
ANI FEh ; | (*vale XXXX XXX0?)<-'
STA FlgNewData ; Flags<- A *normal/ 0000 0000
;POP PSW ; salgo aca afuera no paso nada
;POP H
RET
HLT
;*****************************************************************
; FUNCION GuardarDato
;*****************************************************************
GuardarDato:
LDA DatoTecl
MOV M, A
INX H
RET
HLT