;
; IEEE TEST PROGRAMM
;
R0 EQU 0000H ; I\O REG
R1 EQU 0001H ; INT1\STAT1
R2 EQU 0002H ; INT2\STAT2
R3 EQU 0003H ; SER.PO\SER.PO
R4 EQU 0004H ; ADDR STA\ADDR.MOD
R5 EQU 0005H ; COM.PA.TH\AUX.MOD
R6 EQU 0006H ; ADDR.0\ADDR.0/1
R7 EQU 0007H ; ADDR.1\EOS
ISL1 EQU 0030H ;INTF.SELECT
ISL2 EQU 0040H ;INTF.SELECT
MYAD EQU 0008H ;READ MY ADDR.
;
; INITIALZATION
;
ORG 1000H
INIT: MVI A,02H ;CHIP RESET
OUT ISL1+R5
XRA A ;CLEAR ACCU
OUT ISL1+R1 ;DISABLE INTERR.
MVI A,50H ;DISABLE DMA1
OUT ISL1+R2 ;ENABLE DMA1,DISABLE DMA0
MVI A,31H
OUT ISL1+R4 ;SET T/R MO3,SET ADDR.MO1
IN ISL1+MYAD ;READ MY ADR. FROM SWITCH
STA ADFE
OUT ISL1+R6 ;MY ADDR.TO ADDR 0
MVI A,0E0H
OUT ISL1+R6 ;DISA.ADDR1
MVI A,0AH
OUT ISL1+R7 ;SET EOS CODE
MVI A,24H
OUT ISL1+R5 ;SET CLOCK FREQU.
MVI A,80H
OUT ISL1+R5 ;SET AUX.MOD A
MVI A,0A6H
OUT ISL1+R5 ;SET AUX.MOD B
XRA A ;CLEAR ACCU
STA STFE
OUT ISL1+R5 ;IMMEDIATE EXEC.
LDA ADFE
OUT ISL1+R0
CALL IFC
CALL WAIT
MVI A,10H ;CONTR.IDLE STATE
OUT ISL1+R5
NOP
NOP
MVI A,12H
OUT ISL1+R5 ;TAKE CONTROL ASY.
MVI A,0A5H ;DATA OUT
OUT ISL1+R0
CALL WAIT
IDLE:JMP IDLE
STFE: DW 0
ADFE: DW 0
;
; SEND ROUTINE
;
SEND: CALL LIAD
IN ISL1+MYAD
ORI 40H
OUT ISL1+R0 ;SEND MY TALK ADDR.
CALL WAIT
MVI A,78H
OUT ISL1+R2
MVI A,10H ;STAND BY MODE
OUT ISL1+R5
JMP WAIT
;
; RECEIVE ROUTINE
;
RECV:CALL TAAD ;TALKER ADDR.
CALL UNLTN
MVI A,13H ;LTN CODE
OUT ISL1+R5
MVI A,1AH
UNLTN: MVI A,3FH
OUT ISL1+R0 ;UNLISTEN CODE
JMP WAIT
;
IFC: MVI A,1EH ;SET IFC CODE
OUT ISL1+R5
LXI B,0110H ;SET DELAY COUNTER 100 USEC
CALL WAITA
MVI A,16H
OUT ISL1+R5
RET
;
TAAD: MOV A,B ;TALKER ADDR.
ORI 40H ;FORM TALKER
OUT ISL1+R0
JMP WAIT
;
LIAD: MOV A,B ;LISTEN ADDR
ORI 20H ;FORM LISTENER
OUT ISL1+R0
JMP WAIT
;OUT ISL1+R5 ;TAKE COTROL SYNCH. ON END
MVI A,10H
OUT ISL1+R5 ;STANDBY
JMP WAIT
WAITA: DCR C
JNZ WAITA
MVI C,0FFH
DCR B
JNZ WAITA
RET
;
WAIT:IN ISL1+R1
ANI 0FFH ;EVENT 
JNZ WAIT
IN ISL1+R2
ANI 0FFH ;EVENT
JNZ WAIT
RET
; END
