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

📄 asminstr.inc

📁 Turbo Pascal 6.0编译器源码
💻 INC
📖 第 1 页 / 共 2 页
字号:
ProcessCommand	proc	near
@@1:	xor	ax,ax
	mov	CodeCount,ax
	mov	Pending,al
	mov	DirectionBit,al
	mov	DefPrefix,al
	mov	bx,OpcodePtr
	mov	bx,cs:[bx]
	mov	cl,6
	shr	bh,cl
	cmp	bh,OperCount
	jne	@@2
	lea	si,Operand1
	lea	di,Operand2
	mov	ah,[si].aType
	mov	al,[di].aType
	and	bx,7eh
	call	cs:Opcodes[bx]
	jz	@@3
@@2:	call	OpcodeLength
	test	byte ptr cs:[bx],80h
	jz	@@5
	add	ax,2
	add	OpcodePtr,ax
	jmp	@@1
@@3:	mov	bx,OpcodePtr
	test	byte ptr cs:[bx+1],4
	jz	@@4
	test	byte ptr Options,3
	jnz	@@4
	mov	ax,Oper1TextPtr
	mov	SaveTextPtr,ax
	jmp	Not286Err
@@4:	call	PutPending
	ret
@@5:	mov	ax,Oper1TextPtr
	cmp	OperCount,1
	jle	@@6
	mov	ax,Oper2TextPtr
@@6:	mov	SaveTextPtr,ax
	jle	@@7
	mov	ax,Operand1.aSize
	cmp	ax,Operand2.aSize
	je	@@7
	jmp	InvOperErr2
@@7:	jmp	InvOperErr
ProcessCommand	endp

@Nop	proc	near
	call	GetOpcode
	xor	ax,ax
	ret
@Nop	endp

@Invalid	proc	near
	jmp	SyntaxErr
@Invalid	endp

@JmpRM16	proc	near
	call	GetRM16
	jnz	@@1
	call	GetOpcode
	call	PutOperRM
@@1:	ret
@JmpRM16	endp

@JmpRM32	proc	near
	call	GetRM
	jnz	@@1
	cmp	al,szDword
	jne	@@1
	call	GetOpcode
	call	PutOperRM
@@1:	ret
@JmpRM32	endp

@Jcc	proc	near
	cmp	ah,tMEM
	jne	@@1
	cmp	[si].aSize,-3
	jne	@@1
	mov	ax,[si].aValue.W0
	or	ax,[si].aValue.W2
	jnz	@@1
	call	PutPrefixes
	call	OpcodeLength
	mov	cl,cs:[bx+2]
	mov	bx,eShort
	mov	ax,[si].aAddr.Offs
	mov	TempAddr.Offs,ax
	mov	ax,[si].aAddr.Segm
	mov	TempAddr.Segm,ax
	call	Put
@@1:	ret
@Jcc	endp

@JmpNear	proc	near
	mov	bh,fRel
	mov	cx,-3
	cmp	[si].aSize,cx
	je	@@1
	mov	cl,-1
	jmp	short @@1
@JmpFar	label	near
	mov	bh,fPtr
	mov	cx,-2
@@1:	cmp	[si].aSize,cx
	jne	@@2
	cmp	ah,tMEM
	jne	@@2
	cmp	[si].aRegs,rfInd
	jne	@@2
	push	bx
	call	PutPrefixes
	call	OpcodeLength
	mov	cl,cs:[bx+2]
	mov	bl,eByte
	call	Put
	pop	bx
	mov	bl,eFixup
	mov	cx,[si].aValue.W0
	mov	dx,[si].aValue.W2
	mov	ax,[si].aAddr.Offs
	mov	TempAddr.Offs,ax
	mov	ax,[si].aAddr.Segm
	mov	TempAddr.Segm,ax
	call	Put
@@2:	ret
@JmpNear	endp

@Shift	proc	near
	call	GetRM8_16
	jnz	@@4
	call	GetOpcode
	call	ByteOperand
	jnz	@@2
	cmp	al,1
	je	@@3
	test	byte ptr Options,3
	jnz	@@1
	jmp	Not286Err
@@1:	sub	Opcode,10h
	push	ax
	call	PutSizeOperRM
	pop	ax
	call	PutByte
	ret
@@2:	cmp	[di].aType,tREG
	jne	@@4
	cmp	[di].aRegNum,rgCL*256+szByte
	jne	@@4
	add	Opcode,2
@@3:	call	PutSizeOperRM
@@4:	ret
@Shift	endp

@XchgRAX	proc	near
	xchg	al,ah
	xchg	si,di
@XchgAXR	label	near
	cmp	ax,tREG+tREG*256
	jne	@@1
	cmp	[si].aRegNum,rgAX*256+szWord
	jne	@@1
	cmp	[di].aRegNum.B0,szWord
	jne	@@1
	call	GetOpcode
	mov	al,[di].aRegNum.B1
	or	Opcode,al
	xor	ax,ax
@@1:	ret
@XchgRAX	endp

@Enter	proc	near
	xchg	si,di
	call	GetOpcode
	call	PutWordOperand
	jnz	@@1
	xchg	si,di
	call	PutByteOperand
@@1:	ret
@Enter	endp

@Ret	proc	near
	call	GetOpcode
	test	Options,100h
	jz	@@1
	or	Opcode,8
@@1:	cmp	OperCount,0
	jne	@@2
	ret
@RetnD16	label	near
	call	GetOpcode
@@2:	mov	di,si
	or	Opcode,1
	call	ZeroWord
	jnz	@@3
	ret
@@3:	and	Opcode,0feh
	jmp	PutWordOperand
@Ret	endp

@PushD16	proc	near
	call	GetOpcode
	xchg	si,di
	jmp	PutWordOperand
@PushD16	endp

@PushD8	proc	near
	xchg	si,di
	call	GetOpcode
	call	SignedByte
	jnz	@@1
	call	PutByte
@@1:	ret
@PushD8	endp

@Imul286	proc	near
	cmp	ah,tREG
	jne	@@3
	cmp	[si].aRegNum.B0,szWord
	jne	@@3
	xchg	si,di
	call	GetRM16
	jnz	@@3
	call	GetOpcode
	call	PutReg2
	lea	di,Operand3
	call	WordOperand
	jnz	@@3
	call	SignedByte
	pushf
	jnz	@@1
	or	Opcode,2
@@1:	push	ax
	call	PutRegRM
	pop	ax
	popf
	jnz	@@2
	jmp	PutByte
@@2:	call	PutWord
@@3:	ret
@Imul286	endp

@Lea	proc	near
	cmp	ax,tREG*256+tMEM
	jne	@@1
	cmp	[si].aRegNum.B0,szWord
	jne	@@1
	xchg	si,di
	call	GetRM
	xchg	si,di
	jnz	@@1
	mov	DefPrefix,0
	call	GetOpcode
	call	PutReg1
	call	PutRegRM
@@1:	ret
@Lea	endp

@OutD8	proc	near
	xchg	si,di
	xchg	al,ah
@InD8	label	near
	call	CheckALAX
	jnz	@@1
	call	PutByteOperand
@@1:	ret
@OutD8	endp

@OutDX	proc	near
	xchg	si,di
	xchg	al,ah
@InDX	label	near
	cmp	al,tREG
	jne	@@1
	cmp	[di].aRegNum,rgDX*256+szWord
	jne	@@1
	call	CheckALAX
@@1:	ret
@OutDX	endp

CheckALAX	proc	near
	cmp	ah,tREG
	jne	@@1
	cmp	[si].aRegNum.B1,rgAX
	jne	@@1
	call	GetOpcode
	mov	al,[si].aRegNum.B0
	cmp	al,szWord
	ja	@@1
	or	Opcode,al
	xor	ax,ax
@@1:	ret
CheckALAX	endp

@Int	proc	near
	call	GetOpcode
	mov	di,si
	call	ByteOperand
	jnz	@@1
	cmp	al,3
	je	@@1
	inc	Opcode
	call	PutByte
@@1:	ret
@Int	endp

@MovSrRM	proc	near
	xchg	al,ah
	xchg	si,di
	mov	bl,[di].aRegNum.B1
	sub	bl,rgCS
	jnz	@@1
	dec	bx
	ret
@MovRMSr	label	near
@@1:	cmp	al,tREG
	jne	@@3
	cmp	[di].aRegNum.B0,szSreg
	jne	@@3
	call	GetRM
	jnz	@@3
	cmp	al,szWord
	je	@@2
	cmp	[si].aSize,0
	jne	@@3
@@2:	call	GetOpcode
	call	PutReg2
	call	PutRegRM
@@3:	ret
@MovSrRM	endp

@MovRD	proc	near
	cmp	ax,tREG*256+tNUMBER
	jne	@@2
	cmp	[si].aRegNum.B0,szWord
	ja	@@2
	call	GetOpcode
	mov	al,[si].aRegNum.B1
	or	Opcode,al
	cmp	[si].aRegNum.B0,szByte
	je	@@1
	or	Opcode,8
	jmp	PutWordOperand
@@1:	call	PutByteOperand
@@2:	ret
@MovRD	endp

@IncRM	proc	near
	call	GetRM8_16
	jnz	@@1
	call	GetOpcode
	call	PutSizeOperRM
@@1:	ret
@IncRM	endp

@MovAccM	proc	near
	xchg	al,ah
	xchg	si,di
@MovMAcc	label	near
	cmp	ax,tMEM*256+tREG
	jne	@@1
	cmp	[di].aRegNum.B1,rgAX
	jne	@@1
	call	PureMem
	jnz	@@1
	call	GetOpcode
	mov	al,[di].aRegNum.B0
	cmp	al,szWord
	ja	@@1
	cmp	al,SizeBit
	jne	@@1
	or	Opcode,al
	call	PutMemRef
@@1:	ret
@MovAccM	endp

@XchgRMR	proc	near
	push	ax
	call	@@1
	pop	ax
	jz	@@2
	xchg	si,di
	xchg	al,ah
@@1:	cmp	al,tREG
	jne	@@2
	cmp	[di].aRegNum.B0,szWord
	ja	@@2
	call	GetRM8_16
	jnz	@@2
	call	GetOpcode
	call	PutReg2
	mov	al,[di].aRegNum.B0
	cmp	al,SizeBit
	jne	@@2
	call	PutSizeRegRM
@@2:	ret
@XchgRMR	endp

@Lds	proc	near
	cmp	ax,tREG*256+tMEM
	jne	@@2
	cmp	[si].aRegNum.B0,szWord
	jne	@@2
	xchg	si,di
	call	GetRM
	cmp	Oper2Size,0
	je	@@1
	cmp	al,szDword
	jne	@@2
@@1:	call	GetOpcode
	call	PutReg2
	call	PutRegRM
@@2:	ret
@Lds	endp

@Lar	proc	near
	xchg	si,di
	xchg	al,ah
@Arpl	label	near
	cmp	al,tREG
	jne	@@1
	cmp	[di].aRegNum.B0,szWord
	jne	@@1
	call	GetRM16
	jnz	@@1
	call	GetOpcode
	call	PutReg2
	call	PutRegRM
@@1:	ret
@Lar	endp

@Lgdt	proc	near
	call	GetRM
	jnz	@@2
	cmp	[si].aSize,6
	je	@@1
	cmp	[si].aSize,0
	jne	@@2
@@1:	call	GetOpcode
	call	PutOperRM
@@2:	ret
@Lgdt	endp

@MovRMR	proc	near
	cmp	al,tREG
	je	@@1
	cmp	ah,tREG
	jne	@@2
	mov	DirectionBit,2
	xchg	si,di
@@1:	cmp	[di].aRegNum.B0,szWord
	ja	@@2
	call	GetRM8_16
	jnz	@@2
	call	GetOpcode
	call	PutReg2
	mov	al,[di].aRegNum.B0
	cmp	al,SizeBit
	jne	@@2
	call	PutSizeRegRM
@@2:	ret
@MovRMR	endp

@PopRM	proc	near
	call	GetRM16
	jnz	@@1
	call	GetOpcode
	call	PutOperRM
@@1:	ret
@PopRM	endp

@ArOpRMD	proc	near
	call	WordOperand
	jnz	@@3
	call	GetRM8_16
	jnz	@@3
	call	GetOpcode
	cmp	SizeBit,szByte
	je	@@1
	call	SignedByte
	jnz	@@2
	or	Opcode,2
@@1:	call	ByteOperand
	jnz	@@3
	call	PutSizeOperRM
	jnz	@@3
	call	PutByteOperand
	jmp	short @@3
@@2:	call	PutSizeOperRM
	jnz	@@3
	call	PutWordOperand
@@3:	ret
@ArOpRMD	endp

@MovRMD	proc	near
	cmp	al,tNUMBER
	jne	@@2
	call	GetRM8_16
	jnz	@@2
	call	GetOpcode
	call	PutSizeOperRM
	cmp	SizeBit,szWord
	jz	@@1
	jmp	PutByteOperand
@@1:	jmp	PutWordOperand
@@2:	ret
@MovRMD	endp

@ArOpRD	proc	near
	cmp	ax,tREG*256+tNUMBER
	jne	@@2
	call	WordOperand
	jnz	@@2

⌨️ 快捷键说明

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