$paginate title(Test 180)
$sm
$subtitle(Test file for the 64180)
$copyright(Copyright (C) 1986, Avocet Systems, Inc.)
$chip(HD64180)

;
; LD Instruction
;
        DEFSEG ABS_CODE,ABSOLUTE  ; show abs addresses.
        SEG ABS_CODE
        
        %FOR I CHARS ABCDEHL
        %FOR J IN A,B,C,D,E,H,L,(HL),(IX),(IX+5),(IY),(IY-2),5
        LD      I,J
        %ENDFOR
        %ENDFOR

        %FOR I IN (HL),(IX),(IX+5),(IY),(IY-4)
        %FOR J IN A,B,C,D,E,H,L,-5
        LD      I,J
        %ENDFOR
        %ENDFOR

        %FOR I IN BC,DE,HL,SP,IX,IY
        LD      I,5555H
        LD      I,(1234H)
        LD      (4321H),I
        %ENDFOR

	LD	A,(BC)
	LD	A,(DE)
	LD	(BC),A
	LD	(DE),A
	LD	(1234H),A
	LD	A,(1234H)

	LD	A,I
	LD	A,R
	LD	I,A
	LD	R,A

	LD	SP,HL
	LD	SP,IX
	LD	SP,IY

;
; PUSH AND POP
;

	PUSH	BC
	PUSH	DE
	PUSH	HL
	PUSH	AF
	PUSH	IX
	PUSH	IY

	POP	BC
	POP	DE
	POP	HL
	POP	AF
	POP	IX
	POP	IY
;
; EXCHANGES
;

	EX	DE,HL
	EX	AF,AF'
	EXX

;
; BLOCK MOVES
;

	LDI
	LDIR
	LDD
	LDDR
	CPI
	CPIR
	CPD
	CPDR

;
; ARITHMETIC AND LOGIC
;

	ADD	A,A
	ADD	A,B
	ADD	A,C
	ADD	A,D
	ADD	A,E
	ADD	A,H
	ADD	A,L
	ADD	A,(HL)
	ADD	A,(IX+5)
	ADD	A,(IY+0)
	ADD	A,17H

	ADD	HL,BC
	ADD	HL,DE
	ADD	HL,HL
	ADD	HL,SP

	ADD	IX,BC
	ADD	IX,DE
	ADD	IX,SP
	ADD	IX,IX

	ADD	IY,BC
	ADD	IY,DE
	ADD	IY,SP
	ADD	IY,IY

	ADC	A,A
	ADC	A,B
	ADC	A,C
	ADC	A,D
	ADC	A,E
	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
	RES	4,(IX+5)
	RES	5,(IX+5)
	RES	6,(IX+5)
	RES	7,(IX+5)

	RES	0,(IY+0)
	RES	1,(IY+0)
	RES	2,(IY+0)
	RES	3,(IY+0)
	RES	4,(IY+0)
	RES	5,(IY+0)
	RES	6,(IY+0)
	RES	7,(IY+0)


	SET	0,A
	SET	1,A
	SET	2,A
	SET	3,A
	SET	4,A
	SET	5,A
	SET	6,A
	SET	7,A

	SET	0,B
	SET	1,B
	SET	2,B
	SET	3,B
	SET	4,B
	SET	5,B
	SET	6,B
	SET	7,B

	SET	0,C
	SET	1,C
	SET	2,C
	SET	3,C
	SET	4,C
	SET	5,C
	SET	6,C
	SET	7,C

	SET	0,D
	SET	1,D
	SET	2,D
	SET	3,D
	SET	4,D
	SET	5,D
	SET	6,D
	SET	7,D

	SET	0,E
	SET	1,E
	SET	2,E
	SET	3,E
	SET	4,E
	SET	5,E
	SET	6,E
	SET	7,E

	SET	0,H
	SET	1,H
	SET	2,H
	SET	3,H
	SET	4,H
	SET	5,H
	SET	6,H
	SET	7,H

	SET	0,L
	SET	1,L
	SET	2,L
	SET	3,L
	SET	4,L
	SET	5,L
	SET	6,L
	SET	7,L

	SET	0,(HL)
	SET	1,(HL)
	SET	2,(HL)
	SET	3,(HL)
	SET	4,(HL)
	SET	5,(HL)
	SET	6,(HL)
	SET	7,(HL)

	SET	0,(IX+5)
	SET	1,(IX+5)
	SET	2,(IX+5)
	SET	3,(IX+5)
	SET	4,(IX+5)
	SET	5,(IX+5)
	SET	6,(IX+5)
	SET	7,(IX+5)

	SET	0,(IY+0)
	SET	1,(IY+0)
	SET	2,(IY+0)
	SET	3,(IY+0)
	SET	4,(IY+0)
	SET	5,(IY+0)
	SET	6,(IY+0)
	SET	7,(IY+0)

;
; JUMPS, CALLS, AND RETURNS
;

	JP	1234H		;comment
	JP	NZ,4455H	;comment
	JP	Z,4455H
	JP	NC,4455H
	JP	C,1234H
	JP	PO,1234H
	JP	PE,1234H
	JP	P,1234H
	JP	M,1234H
	JP	(HL)
	JP	(IX)
	JP	(IY)

	CALL	1234H
	CALL	NZ,4455H
	CALL	Z,4455H
	CALL	NC,4455H
	CALL	C,1234H
	CALL	PO,1234H
	CALL	PE,1234H
	CALL	P,1234H
	CALL	M,1234H

	RET		;comment
	RET	NZ	;comment
	RET	Z
	RET	NC
	RET	C	;comment
	RET	PO
	RET	PE
	RET	P
	RET	M

	RETI
	RETN

	JR	$+3	;comment
	JR	NZ,$+4	;comment
	JR	Z,$-2
	JR	NC,$ + 8
	JR	C,$ + $ - $ + 2

	DJNZ	$

	RST 	0
	RST	8
	RST	16
	RST	24
	RST	32
	RST	40
	RST	48
	RST	56

;
; INPUT/OUTPUT
;

	IN	A,(5)	;comment
	IN	A,(7)

	IN	A,(C)	;comment
	IN	B,(C)
	IN	C,(C)
	IN	D,(C)
	IN	E,(C)
	IN	H,(C)
	IN	L,(C)

	INI
	INIR
	IND
	INDR

	OUT	(5),A
	OUT	(7),A

	OUT	(C),A
	OUT	(C),B
	OUT	(C),C
	OUT	(C),D
	OUT	(C),E
	OUT	(C),H
	OUT	(C),L

	OUTI
	OTIR
	OUTD
	OTDR

;
;  new 64180 instructions
;
        TST     A
        TST     B
        TST     C
        TST     D
        TST     E
        TST     H       
        TST     L
        TST     (HL)
        TST     $AA
        
        MLT     BC
        MLT     HL
        MLT     DE
        MLT     SP
        
        SLP     

        IN0     A,      ($BB)
        IN0     B,      ($BB)
        IN0     C,      ($BB)
        IN0     D,      ($BB)
        IN0     E,      ($BB)
        IN0     H,      ($BB)
        IN0     L,      ($BB)
        
        OUT0    ($BB),  a
        OUT0    ($BB),  b
        OUT0    ($BB),  c
        OUT0    ($BB),  d
        OUT0    ($BB),  e
        OUT0    ($BB),  h
        OUT0    ($BB),  l 

        OTIM
        OTIMR
        OTDM
        OTDMR
        
        TSTIO   $ff

	END

