Advertisement

开发 32 位 assembly language scanf function

阅读量:

以下呈现的是采用汇编语言编写实现scanf函数的完整代码内容。

复制代码
    include vcIO.inc
    
    GetStdHandle proto,:DWORD
    ReadConsoleA proto,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
    ReadConsole equ <ReadConsoleA>
    STD_INPUT_HANDLE=-10
    
    .data
    	_insize dword ?
    	; 设置输入缓冲区最大255个字符
    	_inbuffer byte 255 dup(0)			
    	msg1 byte "请输入字符:" , 0ah, 0
    	msg2 byte "请输入字符串:" , 0ah, 0
    	msg3 byte "请输入整型:" , 0ah, 0
    	msg4 byte "请输入短整型:" , 0ah, 0
    	msg_error byte "非法字符!" , 0ah, 0
    	;输入类型
    	type_char byte "%c", 0ah, 0	
    	type_string byte "%s", 0ah, 0
    	type_int byte "%d", 0ah, 0
    	type_sho

全部评论 (0)

还没有任何评论哟~