/*****************************************************************************/
/*									     */
/*									     */
/*	CP/M emulator version 0.1					     */
/*									     */
/*	written by Michael Bischoff (mbi@mo.math.nat.tu-bs.de)		     */
/*	June-1994							     */
/*									     */
/*	This file is distributed under the GNU COPYRIGHT		     */
/*	see COPYRIGHT.GNU for Copyright details				     */
/*									     */
/*									     */
/*****************************************************************************/
		.data
jumptabiy:
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iy09, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iy19, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iy21, iy22, iy23, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iy29, iy2a, iy2b, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,iy34, iy35, iy36, EXIT2
		.long EXIT2,iy39, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy46, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy4e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy56, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy5e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy66, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy6e, EXIT2
		.long iy70, iy71, iy72, iy73, iy74, iy75, EXIT2,iy77
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy7e, EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy86, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy8e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy96, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iy9e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iya6, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iyae, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iyb6, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,iybe, EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,iycb, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iye1, EXIT2,iye3, EXIT2,iye5, EXIT2,EXIT2
		.long EXIT2,iye9, EXIT2,iyeb, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,iyf9, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.text

		
		opcode (0x09)		/* ADD IY,BC */
iy09:           andb $0xec,%ah		/* ### H noch falsch */
		addw %cx,IY
		adcb $0,%ah		/* set carry flag if necessary (8 Byte) */
		dispatch
		opcode (0x19)		/* ADD IY,DE */
iy19:           andb $0xec,%ah		/* ### H noch falsch */
		addw %dx,IY
		adc $0,%ah
		dispatch

		opcode (0x21)		/* LD IY,nnnn */
iy21:           movw (%esi,%ebp),%di
		movw %di,IY
		incl %esi
		incl %esi
		dispatch

		opcode (0x22)           /* LD (nnnn),IY */
iy22:		movzwl (%esi,%ebp),%edi
		pushl %ebx
		movl IY,%ebx
		movw %bx,(%edi,%ebp)
		popl %ebx
		incl %esi
		incl %esi
		dispatch

		opcode (0x23)		/* INC IY */
iy23:           incw IY
		dispatch

		opcode (0x29)		/* ADD IY,IY */
iy29:           andb $0xec,%ah		/* clear some Flags  ### H noch falsch */
		movl IY,%edi
		addw %di,%di
		movl %edi,IY
		adc $0,%ah
		dispatch

		opcode (0x2a)		/* LD IY,(nnnn) */
iy2a:           movzwl (%esi,%ebp),%edi
		pushl %ebx
		movw (%edi,%ebp),%bx
		movw %bx,IY
		popl %ebx
		incl %esi
		incl %esi
		dispatch

		opcode (0x2b)		/* DEC IY */
iy2b:           decw IY
		dispatch

		opcode (0x34)           /* INC (IY+off) */
iy34:		GETIYOFF
		inc8mac((%ebp,%edi))
		dispatch

		opcode (0x35)	        /* DEC (IY+off) */
iy35:		GETIYOFF
		dec8mac((%ebp,%edi))
		dispatch

		opcode (0x36)		/* LD (IY+off),nn */
iy36:		GETIYOFF
		pushl %eax
		movb (%esi,%ebp),%al
		incl %esi
		movb %al,(%edi,%ebp)
		popl %eax
		dispatch

		opcode (0x39)		/* ADD IY,SP */
iy39:           andb $0xec,%ah		/* clear some Flags  ### H noch falsch */
		movw _z80regs+4,%di
		addw %di,IY
		adc $0,%ah
		dispatch

                opcode (0xe1)		/* POP IY */
iye1:		movl _z80regs+4,%edi
		pushl %eax
		movw (%edi,%ebp),%ax
		incl %edi
		incl %edi
		movl %edi,_z80regs+4
		movw %ax,IY
		popl %eax
		dispatch

                opcode (0xe5)		/* PUSH IY */
iye5:		movl _z80regs+4,%edi
		decw %di
		decw %di
		pushl %ebx
		movw IY,%bx
		movw %bx,(%ebp,%edi)
		popl %ebx
		movl %edi,_z80regs+4
		dispatch

                opcode (0xe3)        	/* EX (SP),IY */
iye3:		movl _z80regs+4,%edi
		pushl %ebx
                movw (%edi,%ebp),%bx
		xchgw %bx,IY
		movw %bx,(%edi,%ebp)
		popl %ebx
	        dispatch

                opcode (0xe9)		/* JP (IY) */
iye9:           movl IY,%esi
                dispatch

                opcode (0xeb)		/* EX DE,IY */
iyeb:           xchgl IY,%edx
                dispatch

                opcode (0xf9)		/* LD SP,IY */
iyf9:	        movl IY,%edi
		movl %edi,_z80regs+4
                dispatch
