⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asmops.asm

📁 比dos下的debug更好的debug程序源码
💻 ASM
📖 第 1 页 / 共 3 页
字号:
;
; unordered version of AOP4.  (any combo of reg and RM)
; This is XCHG instructions,
; this is unordered, so, it doesn't
; need to know which comes first
;
; bit 0 = size
;
AOP7	PROC
	call	noarg3
	call	intsize
	sub	al,al
	mov	bx,offset arg1
	call	sizeb0
 	cmp	[arg1.mode],AM_REG
	jne	aop7rs
	mov	bx,offset arg2
	mov	ah,[arg1.areg1]
	jmp	aop7j

aop7rs:
 	cmp	[arg2.mode],AM_REG
	jne	aop7err
	mov	bx,offset arg1
	mov	ah,[arg2.areg1]
aop7j:
	or	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	mov	al,ah
	call	asmrm
	ret
aop7err:
	stc
	ret
AOP7	ENDP
;
; word regrm, reg = dest.
;
AOP8	PROC
	call	noarg3
	call	intsize
	cmp	[arg1.asize],BYTESIZE
	je	aop8errx
	mov	bx,offset arg1
	call	chkreg
	mov	al,[bx+asmop.asize]
	cmp	bl,1
	jne	aop8ok
aop8errx:
	stc
	ret
aop8ok:
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	mov	al,[bx+asmop.areg1]
	mov	bx,offset arg2
	call	asmrm
	ret
AOP8	ENDP
;
; interrupts (imm byte)
;
AOP9	PROC
	call	noarg2
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	cmp	byte ptr [arg1.addrx],3
	je	aop9i3
	mov	al,byte ptr [si+OPCODE.COMPARE]
	or	al,1
	stosb
	mov	al,byte ptr [bx+asmop.addrx]
	stosb
	clc
	ret
aop9i3:
	mov	al,0cch
	stosb
	ret
AOP9	ENDP
;
; short relative branches
;
AOP10	PROC
	call	noarg2
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	movzx	eax,[lastofs]
	sub	eax,[bx+asmop.addrx]
	neg	eax
	sub	eax,2
	cmp	eax,-128
	jl	aop10errx
	cmp	eax,127
	jle	aop10ok
aop10errx:
	stc
	ret
aop10ok:
	push	ax
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	pop	ax
	stosb
	clc
	ret
AOP10	ENDP
;
; RM, IMMEDIATE
; bit 0 = size
;
AOP11	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg2
	call	chkimm
	mov	bx,offset arg1
	mov	ax,[si+OPCODE.COMPARE]
	call	sizeb0
	stosb
	xchg	al,ah
	call	asmrm2
	mov	bx,offset arg2
	call	rmszimm
	ret
AOP11	ENDP
;
; ACC,immediate
; bit 0 = size
;
AOP12	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkax
	mov	bx,offset arg2
	call	chkimm
	mov	al,byte ptr [si+OPCODE.COMPARE]
	call	sizeb0
	stosb
	call	rmszimm
	ret
AOP12	ENDP
;
; mem,acc
; bit 0 = size
;
AOP13	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg2
	call	chkax
	mov	bx,offset arg1
	call	chkmem
	mov	al,byte ptr [si+OPCODE.COMPARE]
	call	sizeb0
	stosb
	call	rmszoffs
	ret
AOP13	ENDP
;
; sign-extended RM/IMM
; b1 = 0, treat as normal RM/IMM (aop11)
; else b01=11 means sign-extend byte to word
;
AOP14	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg2
	call	chkimm
	cmp	[bx+asmop.asize],BYTESIZE
	je	aop11
	mov	eax,[bx +asmop.addrx]
	cmp	eax,-128
	jl	aop11
	cmp	eax,127
	jge	aop11
;
; get here for signed extension
;
	mov	bx,offset arg1
	mov	ax,[si+opcode.compare]
	or	al,3
	stosb
	xchg	al,ah
	call	asmrm2
	mov	al,byte ptr [arg2.addrx]
	stosb
	ret
AOP14	ENDP
;
; acc,imm
; b3 of opcode = size
; 
AOP15	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkax
	mov	bx,offset arg2
	call	chkimm
	mov	al,byte ptr [si+OPCODE.COMPARE]
	call	sizeb3
	stosb
	call	rmszimm
	ret
AOP15	ENDP
;
; seg,regrm or regrm,seg
; b1 set if seg is dest
;
AOP16	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	cmp	[bx+asmop.mode],AM_SEG
	jne	aop16seg2
	mov	al,byte ptr [si+OPCODE.COMPARE]
	or	al,2
	mov	ah,[bx+asmop.areg1]
	mov	bx,offset arg2
	jmp	aop16rm
aop16seg2:
	mov	bx,offset arg2
	call	chkseg
	mov	al,byte ptr [si+OPCODE.COMPARE]
	mov	ah,[bx+asmop.areg1]
	mov	bx,offset arg1
aop16rm:
	stosb
	xchg	al,ah
	call	asmrm
	ret
AOP16	ENDP
;
; returns which pop the stack
;
AOP17	PROC
	call	noarg2
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	mov	ax,word ptr [bx+asmop.addrx]
	stosw
	clc
	ret
AOP17	ENDP
;
; far branch or call
;
AOP18	PROC
	call	noarg2
	call	intsize
	cmp	[arg1.mode],AM_SEGOFFS
	jne	aop18bad
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	mov	ax,word ptr [arg1.addrx2]
	stosw
	mov	ax,word ptr [arg1.addrx]
	stosw
	clc
	ret
aop18bad:
	stc
	ret
AOP18	ENDP
;
; ESC instruction
; imm,rm... imm is six bits and fills the low three bits of the
; opcode and the reg field
;
AOP19	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	mov	al,byte ptr [bx+asmop.addrx]
	shr	al,3
	and	al,7
	or	al,byte ptr [si+OPCODE.compare]
	stosb
	mov	al,byte ptr [bx+asmop.addrx]
	and	al,7
	mov	bx,offset arg2
	call	asmrm
	ret
AOP19	ENDP
;
; long relative branch
;  (the parser fills in the 0f starter)
;
AOP20	PROC
	call	noarg2
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	movzx	eax,[lastofs]
	sub	eax,[bx+asmop.addrx]
	neg	eax
	sub	eax,3
	cmp	byte ptr [si+OPCODE.COMPARE],0e0h
	jae	aop20got
	dec	eax
aop20got:
	cmp	eax,-32768
	jl	aop20errx
	cmp	eax,32767
	jle	aop20ok
aop20errx:
	stc
	ret
aop20ok:
	push	ax
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	pop	ax
	stosw
	clc
	ret
AOP20	ENDP
;
;	acc,dx (in instructions)
;	bit 0 = size
;
AOP21	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg2
	call	chkdx
	mov	bx,offset arg1
	call	chkax
	mov	al,byte ptr [ si+OPCODE.COMPARE]
	cmp	[bx+asmop.asize],BYTESIZE
	je	aop21nw
	or	al,1
aop21nw:
	cmp	[bx +asmop.asize],DWORDSIZE	; auto prefixing on
	jne	aop21nw2		; ins & outs is disabled
	or	[PrefixBitmapWord],AS_OPSIZE
aop21nw2:
	stosb
	clc
	ret
AOP21	ENDP
;
; dx,acc (out_)
; bit 0 = size
;
AOP22	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkdx
	mov	bx,offset arg2
	call	chkax
	mov	al,byte ptr [ si+OPCODE.COMPARE]
	cmp	[bx+asmop.asize],BYTESIZE
	je	aop22nw
	or	al,1
aop22nw:
	cmp	[bx +asmop.asize],DWORDSIZE	; auto prefixing on
	jne	aop22nw2		; ins & outs is disabled
	or	[PrefixBitmapWord],AS_OPSIZE
aop22nw2:
	stosb
	clc
	ret
AOP22	ENDP
;
; port,acc or acc,port
; b0 =size, b1 = 1 if port is dest
;
AOP23	PROC
	call	noarg3
	call	intsize
	test	byte ptr [si+OPCODE.COMPARE],2
	jz	aop23in
	mov	bx,offset arg2
	call	chkax
	mov	bx,offset arg1
	call	chkimm
	jmp	aop23j
aop23in:
	mov	bx,offset arg1
	call	chkax
	mov	bx,offset arg2
	call	chkimm
aop23j:
	mov	al,byte ptr [si+OPCODE.compare]
	cmp	[bx +asmop.asize],WORDSIZE
	jb	aop23b
       	or	al,1
aop23b:
	clc
	stosb
	mov	al,byte ptr [bx +asmop.addrx]
	stosb
	ret
AOP23	ENDP
;
; acc,mem
; bit 0 = size
;
AOP24	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkax
	mov	bx,offset arg2
	call	chkmem
	mov	al,byte ptr [si+OPCODE.COMPARE]
	call	sizeb0
	stosb
	call	rmszoffs
	ret
AOP24	ENDP
;
; immediate byte or word
; this is push imm, bit 1 set for byte
; we were about due for a departure from the standard...
; anyway the op is sign-extended if it is byte size
;
AOP25	PROC
	call	noarg2
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	mov	al,byte ptr [si+OPCODE.COMPARE]
	mov	ebx,[bx+asmop.addrx]
	cmp	ebx,-128
	jl	aop25w
	cmp	ebx,127
	jg	aop25w
;
; byte size
;
	or	al,2
	stosb
	mov	al,bl
	stosb
	ret
aop25w:
	stosb
	test	[PrefixBitmapWord],AS_OPSIZE
	jnz	aop25dw
	cmp	ebx,-23768
	jl	aop25dw
	cmp	ebx,32767
	jg	aop25dw
	mov	ax,bx
	stosw
	clc
	ret
aop25dw:
	or	[PrefixBitmapWord],AS_OPSIZE
	mov	eax,ebx
	stosd
	clc
	ret
AOP25	ENDP
;
; enter command, we have a word then a byte
;
AOP26	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg1
	call	chkimm
	mov	[bx+asmop.asize],WORDSIZE
	mov	bx,offset arg2
	call	chkimm
	mov	[bx+asmop.asize],BYTESIZE
	mov	al,byte ptr [si+OPCODE.COMPARE]
	stosb
	mov	ax,word ptr [arg1.addrx]
	stosw
	mov	al,byte ptr [arg2.addrx]
	stosb
	ret
AOP26	ENDP
;
; stringu/w/d, pushaw,pushfw, etc
; explicit byte sizing handled elsewhere (aop0)
;
AOP27	PROC
	call	noarg1
	call	intsize
	mov	al,byte ptr [si+opcode.compare]
	cmp	[lastbyte],'w'
	je	aop27w
	cmp	[lastbyte],'d'
	je	aop27dw
;
; get here if no size specced.
	mov	al,byte ptr [si+opcode.compare]
	and	al,NOT 1
	cmp	al,60h		; default for push/pop is word
	je	aop27w
	cmp	al,9ch
	je	aop27w
	stosb		; else default is byte
	clc
	ret
aop27dw:
	or	[PrefixBitmapWord],AS_OPSIZE	; come here if specified dword
aop27w:
	mov	al,byte ptr [si+opcode.compare] ; or here if specified word
	stosb
	clc
	ret
AOP27	ENDP
;
; rm,reg (test instruction)
; bit 0 = size
; 
AOP28	PROC
	call	noarg3
	call	intsize
	mov	bx,offset arg2
	call	chkreg
	mov	al,byte ptr [si+OPCODE.COMPARE]
	call	sizeb0
	stosb
	mov	al,[arg2.areg1]
	mov	bx,offset arg1
	call	asmrm
	ret
AOP28	ENDP
;
; rm, size don't care
;
AOP29	PROC
	call	noarg2
	mov	ax,[si+OPCODE.COMPARE]
	stosb
	xchg	al,ah
	mov	bx,offset arg1
	call	asmrm2
	ret
AOP29	ENDP
;
; RM, shift
; bit 0 & 1 of opcode set if uses CL
; bit 0 & 4 set if uses uses 1
; else nothing set
;
AOP30	PROC
	call	noarg3
	call	intsize
	mov	ax,word ptr [si+OPCODE.compare]
	and	al,0ech	; get rid of extraneous bits
	mov	bx,offset arg2
	cmp	[bx+asmop.areg1],isEBX
	je	aop30cl
	call	chkimm
	cmp	[bx+asmop.addrx],1
	jne	aop30xx
	or	al,11h
	stosb
	xchg	al,ah
	call	asmrm2
	ret
aop30xx:
	or	al,3
	stosb
	xchg	al,ah
	call	asmrm2
	mov	al,byte ptr [arg2.addrx]
	stosb
	ret
aop30cl:
	cmp	[bx+asmop.asize],BYTESIZE
	jne	aop30bad
	cmp	[bx+asmop.mode],AM_REG
	jne	aop30bad
	stosb
	xchg	al,ah
	call	asmrm2
	ret

aop30bad:
	stc
	ret
AOP30	ENDP
;
; reg,rm,imm or reg,imm (imul)
; bit 1 = set if immed = signed byte
;
AOP31	PROC
	cmp	[arg3.mode],AM_NONE
	jne	aop31three
	mov	bx,offset arg1
	call	chkreg
	mov	al,byte ptr [si+OPCODE.compare]
	mov	bx,offset arg2
	call	chkimm
	call	aop31sb
	stosb
	push	ax
	mov	al,[arg1.areg1]
	mov	ah,al
	shl	al,3
	or	al,ah
	or	al,0c0h
	stosb
	jmp	aop31sz
aop31three:
	mov	bx,offset arg1
	call	chkreg
	mov	al,byte ptr [si+OPCODE.compare]
	mov	bx,offset arg3
	call	chkimm
	call	aop31sb
	stosb
	push	ax
	push	bx
	mov	al,[arg1.areg1]
	mov	bx,offset arg2
	call	asmrm
	pop	bx
	jmp	aop31sz
aop31sz:
	pop	ax

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -