CODE SEGMENT
  ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE

PPIC_C EQU 1FH
PPIC EQU 1DH
PPIB EQU 1BH
PPIA EQU 19H
KEY EQU      01H

 ORG 1000H

MOV AL,10000000B
OUT PPIC_C , AL

MOV AL, 11111111B
OUT PPIA,AL

MOV AL , 00000000B
OUT PPIC, AL

MOV AL,80H
OUT KEY,AL

L2 : MOV AL, 11101110B
L3: OUT PPIB,AL

ROL AL,1

PUSH AX

IN AL, KEY


CMP AL,80H
JE NONE

CMP AL,40H
JE ZERO

NONE : MOV CX,400D
 CALL TIMER

POP AX
JMP L3

ZERO: MOV CX,200D
      CALL TIMER

	POP AX
	JMP L3

TIMER:
TIMER2: PUSH CX
MOV CX,00FFH
TIMER1: NOP
NOP
NOP
NOP
LOOP TIMER1
POP CX
LOOP TIMER2
RET
CODE ENDS 
END
      


