Skip to content

Commit

Permalink
Proyecto terminado pero muy mejorable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lobaina7 committed Jul 16, 2022
1 parent cbc4604 commit 9830fc2
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 43 deletions.
Binary file modified Sistema de Control d Acceso.pdsprj
Binary file not shown.
186 changes: 143 additions & 43 deletions main.asm
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
;====================================================================
; Main.asm file generated by New Project wizard
;
.MODEL SMALL
.8086
.stack 100h
.code
org 400h
mov ax,0042h
mov ds,ax
; Created: Fri Jul 15 2022
; Processor: 8086
; Compiler: MASM32
;
; Before starting simulation set Internal Memory Size
; in the 8086 model properties to 0x10000
;====================================================================


_DATA SEGMENT WORD PUBLIC 'DATA'

ASSUME DS:_DATA
public __acrtused ; trick to force in startup
__acrtused = 9876h

; Aquí dentro declaramos las variables necesarç
;***************************************************
; Configuración del 8255A
;***************************************************
PUERTAS_IN db 73h,0B3h,0D3h,0E3h
db 75h,0B5h,0D5h,0E5h
db 76h,0B6h,0D6h,0E3h
PUERTAS_OUT dw 8004h,8020h,8100h,1000h
dw 8002h,8010h,8080h,8200h
dw 8001h,8008h,8040h,0000h
DIR_PP1 EQU 0FE06H
WC1 EQU 81H
PC1 EQU 0FE04H
PB1 EQU 0FE02H
PA1 EQU 0FE00H
DIR_PP2 EQU 0FF06H
WC2 EQU 88H
PC2 EQU 0FF04H
PB2 EQU 0FF02H
PA2 EQU 0FF00H

;*************************************************
; Segmento de pila (no declarar tamaño)
;*************************************************

;*************************************************
; Segmento de pila (no declarar tamaño)
;*************************************************
_DATA ENDS

CODE SEGMENT PUBLIC 'CODE'
ASSUME CS:CODE

START:


; Configuracion del 8255 PP1
Expand All @@ -24,13 +66,18 @@ mov ds,ax
mov al, 0
out dx, al
; inicializar variables
start: CALL TECLADO1
JMP start

TECLADO1 PROC NEAR
MOV CX,5
xor DI,DI; DI=0
mov DX,PC2
mov Al,0
out DX,AL
start1:
CALL TECLADO1
JMP start1

TECLADO1 PROC NEAR
TECLAS: MOV CX,5
MOV BL,0FEH ;calcula la máscara de fila
TECLA: MOV DX, PB1
key1: MOV DX, PB1
MOV AL,BL
OUT DX,AL
MOV DX,PC1
Expand All @@ -42,21 +89,24 @@ start: CALL TECLADO1
CONTINUE: ROL BL,1
DEC CX
JCXZ FIN
JMP TECLA


TEC_DECODIFICADOR1:
CALL DECODIFICADOR_TECLADO2

JMP key1

TEC_DECODIFICADOR1:
CALL DECODIFICADOR1_TECLADO1
JMP CONTINUE
TEC_DECODIFICADOR2:
TEC_DECODIFICADOR2:
CALL DECODIFICADOR2_TECLADO1
JMP CONTINUE

FIN:
FIN:
RET
TECLADO1 ENDP
TECLADO1 ENDP

DECODIFICADOR1_TECLADO1 PROC NEAR USES BX AX
DECODIFICADOR1_TECLADO1 PROC NEAR USES BX AX

XOR BH,BH
NOT BL
Expand All @@ -66,12 +116,12 @@ CONTINUE: ROL BL,1
MOV DX,PC1
MOV AL,BH
OUT DX,AL

RET
DECODIFICADOR1_TECLADO1 ENDP
MOV DI,BX ;actualizacion de la puerta activada
RET
DECODIFICADOR1_TECLADO1 ENDP


DECODIFICADOR2_TECLADO1 PROC NEAR USES BX AX
DECODIFICADOR2_TECLADO1 PROC NEAR USES BX AX

OR BH,0FFh
ROL BX,1
Expand All @@ -90,27 +140,77 @@ CONTINUE: ROL BL,1
MOV DX,PC1
MOV AL,BH
OUT DX,AL
MOV DI,BX ;actualizacion de la puerta activada

RET
DECODIFICADOR2_TECLADO1 ENDP

DECODIFICADOR_TECLADO2 PROC NEAR USES BX AX SI DI DX CX

MOV SI,OFFSET PUERTAS_IN
MOV DI,OFFSET PUERTAS_OUT
MOV DX,PC2
MOV BX,0

MOV AL,03
OUT DX,AL
IN AL,DX
OR AL,03
MOV CX,4
PRUB: CMP AL,[SI]
JNZ S0
CALL SALIDA
S0: INC SI
INC BX
LOOP PRUB

MOV AL,05
OUT DX,AL
IN AL,DX
OR AL,05
MOV CX,4
PRUB1: CMP AL,[SI]
JNZ S1
CALL SALIDA
S1: INC SI
INC BX
LOOP PRUB1

MOV AL,06
OUT DX,AL
IN AL,DX
OR AL,06
MOV CX,4
PRUB2: CMP AL,[SI]
JNZ S2
CALL SALIDA
S2:
INC SI
INC BX
LOOP PRUB2
JMP FIN2


FIN2:
RET
DECODIFICADOR_TECLADO2 ENDP

SALIDA PROC NEAR USES BX AX DI DX
SHL BX,1; multiplica por dos
MOV AX,[DI+BX]
MOV DX,PA2
OUT DX,AL
MOV DX,PB2
MOV AL,AH
OUT DX,AL
RET
SALIDA ENDP

ENDLESS:
JMP ENDLESS
CODE ENDS
END START

RET
DECODIFICADOR2_TECLADO1 ENDP
end1:
jmp end1



.data ;Data segment - Segmento de datos
;***************************************************
; Configuración del 8255A
;***************************************************
DIR_PP1 EQU 0FE06H
WC1 EQU 81H
PC1 EQU 0FE04H
PB1 EQU 0FE02H
PA1 EQU 0FE00H
DIR_PP2 EQU 0FF06H
WC2 EQU 89H
PC2 EQU 0FF04H
PB2 EQU 0FF02H
PA2 EQU 0FF00H
LEDS dW 1,2,4,6,8,16,32,64,128,256,400h,800h
END

0 comments on commit 9830fc2

Please sign in to comment.