我正在尝试链接一些程序集文件,但我遇到了一些问题。我使用 nasm 并使用以下内容制作我的目标文件:
nasm program.asm -f bin -o program.exe
书中的代码
%include "io.mac"
.DATA
name_prompt db "Please type your name: ",0
out_msg db "Your name in capitals is: ",0
.UDATA
in_name resb 31
.CODE
.STARTUP
PutStr name_prompt ; request character string
GetStr in_name,31 ; read input character string
PutStr out_msg
mov EBX,in_name ; EBX = pointer to in_name
process_char:
mov AL,[EBX] ; move the char. to AL
cmp AL,0 ; if it is the NULL character
je done ; conversion done
cmp AL,’a’ ; if (char < ’a’)
jl not_lower_case ; not a lowercase letter
cmp AL,’z’ ; if (char > ’z’)
jg not_lower_case ; not a lowercase letter
lower_case:
add AL,’A’-’a’ ; convert to uppercase
not_lower_case:
PutCh AL ; write the character
inc EBX ; EBX points to the next char.
jmp process_char ; go back to process next char.
done:
nwln
.EXIT
此代码在 Windows XP 上对我有效,但在 Windows 7 上无效,这是错误日志 错误。请帮我找出错误。