;
;	all - use all the op codes
;
code2seg	segment
farroutine	proc	far
		mov	ax,4c00H
		int	21H	; if this file is executed, just terminate
farroutine	endp	
;
code2seg	ends
;
dataseg		segment
alpha		dw	0
nearindirect	dw	beta
farindirect	dd	farroutine
dataseg	ends
;
codeseg	segment
;
	assume ds:dataseg
	assume es:nothing
	assume ss:nothing
	assume cs:codeseg
;
;	ensure disassembler synchronization
;
	nop
	nop
	nop
	nop
	nop
	nop
;
;	20 examples of addressing modes
;
	db	10h,00h
	db	10h,08h
	db	10h,10h
	db	10h,18h
	db	10h,20h
	db	10h,28h
	db	10h,30h
	db	10h,38h
	db	10h,00h
	db	10h,01h
	db	10h,02h
	db	10h,03h
	db	10h,04h
	db	10h,05h
	db	10h,06h,64h,63h
	db	10h,07h
	db	10h,00h
	db	10h,40h,78h
	db	10h,80h,78h,79h
	db	10h,0c0h
;
;	another 32 examples of addressing modes
;
	pop	[bx+si]
	pop	[bx+di]
	pop	ss:[bp+si]
	pop	ss:[bp+di]
	pop	[si]
	pop	[di]
	add     ax, [0006]   ; illustrate immediate addressing with add
	                     ; instruction, since there's no immediate pop
	pop	[bx]
	pop	[08+bx+si]
	pop	[09+bx+di]
	pop	ss:[0aH+bp+si]
	pop	ss:[0bH+bp+di]
	pop	[0cH+si]
	pop	[0dH+di]
	pop	ss:[0eH+bp]
	pop	[0fH+bx]
	pop	[1010H+bx+si]
	pop	[1011H+bx+di]
	pop	ss:[1012H+bp+si]
	pop	ss:[1013H+bp+di]
	pop	[1014H+si]
	pop	[1015H+di]
	pop	ss:[1016H+bp]
	pop	[1017H+bx]
	pop	ax
	pop	cx
	pop	dx
	pop	bx
	pop	sp
	pop	bp
	pop	si
	pop	di
;
;	illustrate segment register usage
;
	pop	[bx]		; default is ds:
	pop	cs:[bx]
	pop	ss:[bx]
	pop	ds:[bx]
	pop	es:[bx]
	pop	[bp]		; default is ss:
	pop	cs:[bp]
	pop	ss:[bp]
	pop	ds:[bp]
	pop	es:[bp]
;
nearroutine	proc	near
nearroutine	endp
;
;	8088 instructions in alphabetical order
;	(as in Intel's "iAPX 88 Book")
;
	aaa
	aad
	aam
	aas
	adc	cx,[bx]
	adc	cx,alpha
	adc	cx,13
	adc	ax,13
	add	cx,[bx]
	and	cx,[bx]
	call	nearroutine
	call	farroutine
	call	nearindirect
	call	farindirect
	cbw
	clc
	cld
	cli
	cmc
	cmp	cx,[bx]
	cmpsb
	cmpsw
	cwd
	daa
	das
	dec	ax
	dec	al
	dec	byte ptr [bx]
	div	cx
;
;	esc			floating point operations
;
	fnop
	fchs
	fabs
	ftst
	fxam
	fld1
	fldl2e
	fldpi
	fldlg2
	fldln2
	fdecstp
	fincstp
	fldz
	f2xm1
	fyl2x
	fptan
	fpatan
	fxtract
	fprem
	fyl2xp1
	fsqrt
	frndint
	fscale
	feni
	fdisi
	fclex
	finit
	fcompp
;
	hlt
	idiv	dx
	imul	bx
	in	ax,67
	in	ax,dx
	inc	dl
	inc	dx
	int	3
	int	33
	into
	iret
	ja	$+33
	jnbe	$+33
	jae	$+34
	jnb	$+34
	jb	$+35
	jnae	$+35
	jbe	$+36
	jna	$+36
	jc	$+37
	jcxz	$+38
	je	$+39
	jz	$+39
	jg	$+40
	jnle	$+40
	jge	$+41
	jnl	$+41
	jl	$+42
	jnge	$+42
	jle	$+43
	jng	$+43
	jmp	nearroutine
	jmp	farroutine
	jnc	$+44
	jne	$+45
	jnz	$+45
	jno	$+46
	jns	$+47
	jnp	$+48
	jpo	$+48
	jo	$+49
	jp	$+50
	jpe	$+50
	js	$+51
	lahf
	lds	cx,[bx]
	lea	cx,[bx]
	les	cx,[bx]
	lock	add ax,1
	lodsw
	lodsb
	loop	$+33
	loope	$+34
	loopz	$+34
	loopnz	$+35
	loopne	$+35
	mov	ax,bx
	mov	byte ptr [bx],35
	mov	bx,34
	mov	ax,35
	mov	[bx+345],ax
	mov	alpha,ax
	mov	ax,[345]
	mov	ds,ax
	mov	[bx+346],ds
	movsb
	movsw
	mul	bx
	neg	byte ptr [bx]
	nop
	not	byte ptr [bx]
	or	[bx+34],cx
	or	byte ptr [bx+35],78
	or	ax,67
	out	88,ax
	out	dx,al
	pop	[bx+890]
	pop	ax
	pop	ds
	popf
	push	[bx+879]
	push	bx
	push	ds
	pushf
	rcl	byte ptr [bx],1
	rcr	byte ptr [bx],cl
	rep	stosb
	repe	stosb
	repne	stosb
beta	proc	near
	ret
	ret	3
beta	endp
delta	proc	far
	ret
	ret	3
delta	endp
	rol	dx,1
	rol	dx,cl
	ror	dx,1
	ror	byte ptr [bx+3],cl
	sahf
	sal	cx,1
	sal	dx,cl
	sar	dx,1
	sar	dx,cl
	sar	dx,1
	sar	dx,cl
	sbb	dx,cx
	sbb	dx,1
	sbb	al,3
	scasw
	scasb
	shr	ax,1
	shr	ax,cl
	stc
	std
	sti
	stosb
	sub	dx,cx
	sub	dx,3
	sub	ax,3
	test	dx,cx
	wait
	xchg	[bx+45],cx
	xchg	ax,cx
	xlat
	xor	cx,78
;
;	80186 & V20 instructions
;
	db	62h,0		;bound
	db	0c8h,33,44,5	;enter procedure
	db	69h,0,33,44	;imul immediate
	db	69h,0c0h,33,44	;imul immediate
	db	6bh,0,33	;imul immediate
	db	6bh,0c0h,33	;imul immediate
	db	6ch		;ins dx
	db	0f2h,6ch	;ins dx repeated by count in cx
	db	0c9h		;leave procedure
	db	6eh		;outs dx
	db	0f2h,6eh	;outs dx repeated by count in cx
	db	61h		;popa
	db	68h,33,44	;push immediate
	db	6ah,33		;push immediate
	db	60h		;pusha
	db	0c0h,00h,3	;ROL memory by count
	db	0c0h,08h,3	;ROR memory by count
	db	0c0h,10h,3	;RCL memory by count
	db	0c0h,18h,3	;RCR memory by count
	db	0c0h,20h,3	;SHL/SAL memory by count
	db	0c0h,28h,3	;SHR memory by count
	db	0c0h,38h,3	;SAR memory by count
;
;	V20 unique instructions
;
	db	0fh,20h		;add4s
	db	0fh,12h,0c0h	;clr1 reg8,cl
	db	0fh,12h,000h	;clr1 mem8,cl
	db	0fh,13h,0c0h	;clr1 reg16,cl
	db	0fh,13h,000h	;clr1 mem16,cl
	db	0fh,1ah,0c0h,3	;clr1 reg8,imm3
	db	0fh,1ah,000h,3	;clr1 mem8,imm3
	db	0fh,1bh,0c0h,3	;clr1 reg16,imm4
	db	0fh,1bh,000h,3	;clr1 mem16,imm4
	db	0fh,26h		;cmp4s
	db	0fh,33h,0c0h	;ext bit field
	db	0fh,3bh,0c0h,3	;ext bit field immediate
	db	66h,0c0h	;fp02
	db	66h,000h	;fp02
	db	0fh,31h,0c0h	;insert bit field
	db	0fh,39h,0c0h,3	;insert bit field immediate
	db	0fh,16h,0c0h	;not1 reg8,cl
	db	0fh,16h,000h	;not1 mem8,cl
	db	0fh,17h,0c0h	;not1 reg16,cl
	db	0fh,17h,000h	;not1 mem16,cl
	db	0fh,1eh,0c0h,3	;not1 reg8,imm3
	db	0fh,1eh,000h,3	;not1 mem8,imm3
	db	0fh,1fh,0c0h,3	;not1 reg16,imm4
	db	0fh,1fh,000h,3	;not1 mem16,imm4
	db	65h		;repc
	db	64h		;repnc
	db	0fh,28h,0c0h	;rol4
	db	0fh,28h,000h	;rol4
	db	0fh,2ah,0c0h	;ror4
	db	0fh,2ah,000h	;ror4
	db	0fh,14h,0c0h	;set1 reg8,cl
	db	0fh,14h,000h	;set1 mem8,cl
	db	0fh,15h,0c0h	;set1 reg16,cl
	db	0fh,15h,000h	;set1 mem16,cl
	db	0fh,1ch,0c0h,3	;set1 reg8,imm3
	db	0fh,1ch,000h,3	;set1 mem8,imm3
	db	0fh,1dh,0c0h,3	;set1 reg16,imm4
	db	0fh,1dh,000h,3	;set1 mem16,imm4
	db	0fh,22h		;sub4s
	db	0fh,10h,0c0h	;test1 reg8,cl
	db	0fh,10h,000h	;test1 mem8,cl
	db	0fh,11h,0c0h	;test1 reg16,cl
	db	0fh,11h,000h	;test1 mem16,cl
	db	0fh,18h,0c0h,3	;test1 reg8,imm3
	db	0fh,18h,000h,3	;test1 mem8,imm3
	db	0fh,19h,0c0h,3	;test1 reg16,imm4
	db	0fh,19h,000h,3	;test1 mem16,imm4
;
;	'386 unique instructions
;
	db	64h		;fs:
	mov	byte ptr [bx],35
	db	65h		;gs:
	mov	byte ptr [bx],35
	db	66h		;32 bit operand
	adc	cx,1300
	dw	90h,90h
	db	66h		;32 bit operand
	adc	ax,1300
	dw	90h,90h
	db	67h		;32 bit address
	ja	$+33
	dw	90h,90h
;
;	s-i-b byte instructions
;
	db	0,0ch,0c0h			; add  [eax+8*eax],cl               
	db	0,4ch,0c0h,33h			; add  [eax+8*eax+33],cl            
	db	0,8ch,0c0h,11h,22h,33h,44h	; add  [eax+8*eax+44332211],cl      
	db	0,8ch,80h,11h,22h,33h,44h	; add  [eax+4*eax+44332211],cl      
	db	0,8ch,40h,11h,22h,33h,44h	; add  [eax+2*eax+44332211],cl      
	db	0,8ch,44h,11h,22h,33h,44h	; add  ss:[eax+2*eax+44332211],cl   
	db	26h,0,8ch,44h,11h,22h,33h,44h	; add  es:[eax+2*eax+44332211],cl   

;
codeseg	ends
;

	end
