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

📄 stereotype.txt

📁 自己开发的c0文法编译器
💻 TXT
字号:
printf_int	proc	near		
	push	AX
	push	SI
	push	DX
	push	CX
	push	BX

	sub	SI, SI
	cmp	AX, 8000H
	jb	printf_int_if_end
	
	mov	BX, AX
	mov	AH, 2
	mov	DL, 2DH
	int	21H
	mov	AX, BX
	
	neg	AX			

printf_int_if_end:

	sub	CX, CX
	mov	BX, 000AH

printf_int_while_start1:
	cmp	AX, 0000H
	jna	printf_int_while_end1

	sub	DX, DX
	idiv	BX

	push	DX
	inc	CX
	
	jmp	printf_int_while_start1

printf_int_while_end1:	

	cmp	CX, 0000H
	jnz	printf_int_if_end2

	sub	DX, DX
	push	DX
	inc	CX
printf_int_if_end2:

	mov	AH, 2

printf_int_output:
	pop	DX
	add	DL, 30H
	int	21H

	loop	printf_int_output

	pop	BX
	pop	CX
	pop	DX
	pop	SI
	pop	AX
	ret
printf_int	endp
scanf_int	proc	near		
	push	BX
	push	CX
	push	DX
	push	DI

	xor	CX, CX
	xor	BX, BX
	mov	BL, bufp
	mov	CL, buf[BX]

scanf_int_while_cmp_start1:
	cmp	CL, 32
	je	scanf_int_while_start1
	
	cmp	CL, 9
	je	scanf_int_while_start1

	cmp	CL, 13
	jne	scanf_int_while_end1

scanf_int_while_start1:

	cmp	CL, 13
	je	scanf_int_if_end
	
	inc	BX
	mov	CL, buf[BX]

scanf_int_if_end:

scanf_int_while_start0:

	cmp	CL, 13
	jne	scanf_int_while_end0
	
	call	scanf_line
	xor	BX, BX
	mov	CL, buf[BX]

	jmp	scanf_int_while_start0

scanf_int_while_end0:

	jmp	scanf_int_while_cmp_start1

scanf_int_while_end1:
	
	xor	SI, SI
	cmp	CL, '-'
	jne	scanf_int_if_end1
	
	inc	SI
	inc	BX
	mov	CL,  buf[BX]

	cmp	CL, 30H
	jb	scanf_int_if_start2
	
	cmp	CL, 39H
	jna	scanf_int_if_end2

scanf_int_if_start2:

	dec	BX

scanf_int_if_end2:

scanf_int_if_end1:

	xor	AX, AX
	mov	DI, 10

scanf_int_while_cmp_start2:	
	cmp	CL, 30H
	jb	scanf_int_while_end2

	cmp	CL, 39H
	ja	scanf_int_while_end2

	imul	DI
	sub	CX, 30H
	add	AX, CX

	inc	BX	
	mov	CL, buf[BX]

	jmp	scanf_int_while_cmp_start2

scanf_int_while_end2:

	mov	bufp, BL

	cmp	SI, 0
	je	scanf_int_if_end3
	
	neg	AX			; AX = -AX	

scanf_int_if_end3:

	pop	DI
	pop	DX
	pop	CX
	pop	BX
	ret
scanf_int	endp
scanf_line	proc	near
	push	AX
	push	DX

	lea	DX, buflen
	mov	AH, 0AH
	int	21H

	mov	AH, 2
	mov	DL, 10
	int	21H

	pop	DX	
	pop	AX
	ret
scanf_line	endp

⌨️ 快捷键说明

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