/*****************************************************************************/
/*									     */
/*									     */
/*	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
jumptabix:
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ix09, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ix19, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ix21, ix22, ix23, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ix29, ix2a, ix2b, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,ix34, ix35, ix36, EXIT2
		.long EXIT2,ix39, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix46, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix4e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix56, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix5e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix66, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix6e, EXIT2
		.long ix70, ix71, ix72, ix73, ix74, ix75, EXIT2,ix77
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix7e, EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix86, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix8e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix96, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ix9e, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ixa6, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ixae, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ixb6, EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,ixbe, EXIT2

		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,ixcb, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ixe1, EXIT2,ixe3, EXIT2,ixe5, EXIT2,EXIT2
		.long EXIT2,ixe9, EXIT2,ixeb, EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.long EXIT2,ixf9, EXIT2,EXIT2,EXIT2,EXIT2,EXIT2,EXIT2
		.text

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

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

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

		opcode (0x23)		/* INC IX */
ix23:           incw IX
		dispatch

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

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

		opcode (0x2b)		/* DEC IX */
ix2b:           decw IX
		dispatch

		opcode (0x34)           /* INC (IX+off) */
ix34:		GETIXOFF
		inc8mac((%ebp,%edi))
		dispatch

		opcode (0x35)	        /* DEC (IX+off) */
ix35:		GETIXOFF
		dec8mac((%ebp,%edi))
		dispatch

		opcode (0x36)		/* LD (IX+off),nn */
ix36:		GETIXOFF		/* erst offset, dann data! */
		pushl %eax
		movb (%esi,%ebp),%al
		incl %esi
		movb %al,(%edi,%ebp)
		popl %eax
		dispatch

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

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

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

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

                opcode (0xe9)		/* JP (IX) */
ixe9:           movl IX,%esi
                dispatch

                opcode (0xeb)		/* EX DE,IX */
ixeb:           xchgl IX,%edx
                dispatch

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