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

📄 anasm.asm

📁 这是汇编器的源代码
💻 ASM
📖 第 1 页 / 共 5 页
字号:

	mov si,word[pointer_write]
	mov al,byte[es:di]
	inc di

	mov ah,0x0f
	xchg al,ah
	mov word[gs:si],ax
	add si,2
	mov byte[gs:si],0x06
	inc si
	add word[pointer_write],3
	add word[act_offset],3

	cmp bx,-1
	je .asm_set3@var@no_offset

	call .asm@offset

	jmp near .end
.asm_set3@var@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set3@addr
	mov bx,ax

	mov al,byte[es:di]

	mov si,word[pointer_write]
	mov byte[gs:si],bl
	inc si
	mov ah,0x0f
	xchg al,ah
	mov word[gs:si],ax
	add si,2

	mov byte[gs:si],bh
	add word[pointer_write],4
	add word[act_offset],4

	jmp near .end
.asm_set3@reg
	or al,11000000b

	mov si,word[pointer_write]
	mov bl,byte[es:di]
	inc di

	mov bh,0x0f
	xchg bl,bh
	mov word[gs:si],bx
	add si,2
	mov byte[gs:si],al
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end

.instruc_set4
	mov di,instruction_set4
.loop_set4
	cmp di,instruction_set5
	je near .instruc_set5

	call string_cmp

	push si
	mov si,di
	call string_len
	pop si

	add di,cx

	and ax,ax
	jz .asm_set4
.loop_set4@1
	mov al,byte[es:di]
	inc di

	and al,al
	jz .loop_set4
	jmp .loop_set4@1
.asm_set4
	inc di
	push di
	mov si,word[pointer_read]
	mov di,buffer_bef1
	call parse_line
	add word[pointer_read],cx
	pop di

	push di
	mov si,word[pointer_read]
	mov di,buffer_bef2
	call parse_line
	add word[pointer_read],cx
	pop di

	mov si,buffer_bef1

	cmp byte[failure],0
	jne near .asm_set4@short

	mov si,buffer_bef2

	push di
	push si
	mov si,buffer_bef1
	mov di,op_short
	call string_cmp
	pop si
	pop di
	and ax,ax
	jz .asm_set4@short

	push di
	push si
	mov si,buffer_bef1
	mov di,op_near
	call string_cmp
	pop si
	pop di
	and ax,ax
	jz .asm_set4@near

	jmp near .error_opcode
.asm_set4@short
	call look4label
	and al,al
	jnz near .error_label

	mov si,word[pointer_write]
	mov al,byte[es:di]

	mov byte[gs:si],al
	inc si
	inc word[pointer_write]
	inc word[act_offset]

	cmp bx,-1
	je .asm_set4@short@no_offset
.asm_set4@short@offset
	mov ax,word[act_offset]
	inc ax

	sub bx,ax

	cmp bx,-127
	jg near .error_short_jmp

	mov byte[gs:si],bl
	inc word[pointer_write]
	inc word[act_offset]

	jmp near .end
.asm_set4@short@no_offset
	mov al,3
	call add_offset2offset_table

	inc word[pointer_write]
	inc word[act_offset]

	jmp near .end
.asm_set4@near
	call look4label
	and al,al
	jnz near .error_label

	mov si,word[pointer_write]
	mov al,byte[es:di]
	add al,10h
	mov ah,0x0f
	xchg al,ah

	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	je near .asm@no_offset@jmp
.asm_set4@near@offset
	mov ax,word[act_offset]
	add ax,2

	sub bx,ax

	mov word[gs:si],bx
	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end

.instruc_set5
	mov di,instruction_set5
.loop_set5
	cmp di,instruction_set6
	je near .instruc_set6

	call string_cmp

	push si
	mov si,di
	call string_len
	pop si

	add di,cx

	and ax,ax
	jz .asm_set5
.loop_set5@1
	add di,4

	jmp .loop_set5
.asm_set5
	inc di

	push si
	push di
	mov si,word[pointer_read]
	mov di,buffer_bef1
	call parse_line
	add word[pointer_read],cx
	pop di
	pop si

	push si
	push di
	mov si,word[pointer_read]
	mov di,buffer_bef2
	call parse_line
	add word[pointer_read],cx
	pop di
	pop si

	cmp byte[failure],0
	jne near .error_opcode

	mov si,buffer_bef1

	call translate_8bit_reg
	cmp al,0xff
	jne near .asm_set5@reg8bit

	call translate_16bit_reg
	cmp al,0xff
	jne near .asm_set5@reg16bit

	call translate_32bit_reg
	cmp al,0xff
	jne near .asm_set5@reg32bit

	push di
	push si
	mov di,op_byte
	cmpsd
	pop si
	pop di
	je near .asm_set5@var_byte

	push di
	push si
	mov di,op_word
	cmpsd
	pop si
	pop di
	je near .asm_set5@var_word

	push di
	push si
	mov di,op_dword
	mov cx,5
	rep cmpsb
	pop si
	pop di
	je near .asm_set5@var_dword

	jmp near .error_opcode
.asm_set5@reg8bit
	mov dl,al

	mov si,buffer_bef2

	call translate_8bit_reg

	cmp al,0xff
	jne near .asm_set5@reg@reg_byte

	mov si,buffer_bef2

	call format_numbers_8bit
	jnc .asm_set5@reg_byte@number

	push di
	mov di,op_byte
	cmpsd
	pop di

	jne near .error_opcode
	jmp near .asm_set5@reg@var_byte
.asm_set5@reg_byte@number
	mov bl,al
	mov si,word[pointer_write]
	mov ah,byte[es:di]
	inc di
	mov bh,byte[es:di]
	inc di

	mov al,dl
	shl bh,3
	or al,bh
	or al,11000000b

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	mov byte[gs:si],bl
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@reg16bit
	mov dl,al

	mov si,buffer_bef2

	call translate_16bit_reg
	cmp al,0xff
	jne near .asm_set5@reg@reg_word

	call format_numbers_16bit
	jnc .asm_set5@reg_word@number

	push di
	push si
	mov di,op_word
	cmpsd
	pop si
	pop di
	je near .asm_set5@reg@var_word

	call look4label
	and al,al
	jz .asm_set5@reg_word@var_num

	jmp near .error_opcode
.asm_set5@reg_word@number
	mov cx,ax
	mov si,word[pointer_write]
	mov ah,byte[es:di]
	inc di
	mov bh,byte[es:di]
	inc di

	inc ah
	mov al,dl
	shl bh,3
	or al,bh
	or al,11000000b

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	mov word[gs:si],cx
	add word[pointer_write],4
	add word[act_offset],4

	jmp near .end
.asm_set5@reg_word@var_num
	mov si,word[pointer_write]
	mov ah,byte[es:di]
	inc di
	mov dh,byte[es:di]
	inc di

	inc ah
	mov al,dl
	shl dh,3
	or al,dh
	or al,11000000b

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	je .asm_set5@reg_word@no_offset

	call .asm@offset

	jmp near .end
.asm_set5@reg_word@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg32bit
	mov dl,al

	mov si,buffer_bef2

	call translate_32bit_reg

	cmp al,0xff
	jne near .asm_set5@reg@reg_dword

	mov si,buffer_bef2

	call format_numbers_32bit
	jnc .asm_set5@reg_dword@number

	push di
	mov di,op_dword
	mov cx,5
	rep cmpsb
	pop di

	je near .asm_set5@reg@var_dword
	jmp near .error_opcode
.asm_set5@reg_dword@number
	mov ecx,eax
	mov si,word[pointer_write]
	mov ah,byte[es:di]
	inc di
	mov bh,byte[es:di]
	inc di

	inc ah
	mov al,dl
	shl bh,3
	or al,bh
	or al,11000000b

	mov byte[gs:si],0x66
	inc si

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	mov dword[gs:si],ecx
	add word[pointer_write],7
	add word[act_offset],7

	jmp near .end
.asm_set5@reg@var_byte
	call test_clips
	and al,al
	jnz near .error_no_clips

	call format_address_16bit
	cmp ax,0xffff
	jne .asm_set5@reg@addr@var_byte

	call look4label
	and al,al
	jnz near .error_label

	mov si,word[pointer_write]
	add di,2
	mov al,byte[es:di]
	add al,2
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,00000110b

	mov byte[gs:si],dl
	inc si
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	je .asm_set5@reg@var_byte@no_offset

	call .asm@offset

	jmp near .end
.asm_set5@reg@var_byte@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg@addr@var_byte
	mov si,word[pointer_write]
	mov byte[gs:si],al
	inc si
	add di,2
	mov al,byte[es:di]
	add al,2
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,ah
	mov byte[gs:si],dl
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@reg@var_word
	add si,4
	call test_clips
	and al,al
	jnz near .error_no_clips

	call format_address_16bit
	cmp ax,0xffff
	jne .asm_set5@reg@addr@var_word

	call look4label
	and al,al
	jnz near .error_label

	mov si,word[pointer_write]
	add di,2
	mov al,byte[es:di]
	add al,3
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,00000110b

	mov byte[gs:si],dl
	inc si
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	je .asm_set5@reg@var_word@no_offset

	call .asm@offset

	jmp near .end
.asm_set5@reg@var_word@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg@addr@var_word
	mov si,word[pointer_write]
	mov byte[gs:si],al
	inc si
	add di,2
	mov al,byte[es:di]
	add al,3
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,ah
	mov byte[gs:si],dl
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@reg@var_dword
	call test_clips
	and al,al
	jnz near .error_no_clips

	call format_address_16bit
	cmp ax,0xffff
	jne .asm_set5@reg@addr@var_dword

	call look4label
	and al,al
	jnz near .error_label

	mov si,word[pointer_write]
	mov byte[gs:si],0x66
	inc si
	add di,2
	mov al,byte[es:di]
	add al,3
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,00000110b

	mov byte[gs:si],dl
	inc si
	add word[pointer_write],3
	add word[act_offset],3

	cmp bx,-1
	je .asm_set5@reg@var_dword@no_offset

	call .asm@offset

	jmp near .end
.asm_set5@reg@var_dword@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg@addr@var_dword
	mov si,word[pointer_write]
	mov byte[gs:si],al
	inc si
	mov byte[gs:si],66h
	inc si
	add di,2
	mov al,byte[es:di]
	add al,3
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,ah
	mov byte[gs:si],dl
	add word[pointer_write],4
	add word[act_offset],4

	jmp near .end
.asm_set5@reg@reg_byte
	mov si,word[pointer_write]
	add di,2
	mov ah,byte[es:di]
	inc di

	shl al,3
	or al,11000000b
	or al,dl

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg@reg_word
	mov si,word[pointer_write]
	add di,2
	mov ah,byte[es:di]
	inc di

	inc ah
	shl al,3
	or al,11000000b
	or al,dl

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@reg@reg_dword
	mov si,word[pointer_write]
	add di,2
	mov ah,byte[es:di]
	inc di

	inc ah
	shl al,3
	or al,11000000b
	or al,dl

	mov byte[gs:si],0x66
	inc si
	xchg al,ah
	mov word[gs:si],ax
	add si,2
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@var_byte
	add si,4

	call test_clips
	and al,al
	jnz near .error_no_clips

	call format_address_16bit
	cmp ax,0xffff
	jne near .asm_set5@var_byte@addr@reg

	call look4label
	and al,al
	jnz near .error_label

	push si
	mov si,buffer_bef2

	call translate_8bit_reg
	pop si

	cmp al,0xff
	jne near .asm_set5@var_byte@reg

	push si
	mov si,buffer_bef2

	call format_numbers_8bit
	pop si
	jc near .error_opcode
.asm_set5@var_byte@number
	push ax
	mov si,word[pointer_write]
	mov ax,word[es:di]
	add di,2

	shl ah,3
	or ah,00000110b

	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	jne .asm_set5@var_byte@offset
.asm_set5@var_byte@no_offset
	add si,2
	pop ax
	mov byte[gs:si],al

	mov al,1
	call add_offset2offset_table

	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@var_byte@offset
	mov word[gs:si],bx
	add si,2
	pop ax
	mov byte[gs:si],al

	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@var_byte@addr@reg
	mov si,word[pointer_write]
	mov byte[gs:si],al
	inc si
	add di,2
	mov al,byte[es:di]
	mov byte[gs:si],al
	inc si

	shl dl,3
	or dl,ah
	mov byte[gs:si],dl
	add word[pointer_write],3
	add word[act_offset],3

	jmp near .end
.asm_set5@var_byte@reg
	mov si,word[pointer_write]
	add di,2
	mov ah,byte[es:di]
	inc di

	shl al,3
	or al,00000110b

	xchg al,ah
	mov word[gs:si],ax
	add si,2
	add word[pointer_write],2
	add word[act_offset],2

	cmp bx,-1
	je .asm_set5@var_byte@reg@no_offset

	call .asm@offset

	jmp near .end
.asm_set5@var_byte@reg@no_offset
	mov al,1
	call add_offset2offset_table

	add word[pointer_write],2
	add word[act_offset],2

	jmp near .end
.asm_set5@var_word
	add si,4

	call test_clips
	and al,al
	jnz near .error_no_clips

	call format_address_16bit
	cmp ax,0xffff
	jne near .asm_set5@var_word@addr@reg

	call look4label
	and al,al
	jnz near .error_label

	push si
	mov si,buffer_bef2

	call translate_16bit_reg
	pop si

	cmp al,0xff
	jne near .asm_set5@var_word@reg

	push si
	mov si,buffer_bef2

	call format_numbers_

⌨️ 快捷键说明

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