程序 想实现 大小写 字母 的转换。输入为 大写则转换 为小写, 输入 小写则转换为大写
编译 链接 通过 ,但输入 一个大写 或小写 回车 后, 出现应用程序错误。我实在不知道错在哪了,请高手指教
- Assembly code
.386.model flatExitProcess proto near32 stdcall, dwexitcode:dword ;include io.h ;cr equ 0dh;lf equ 0ah;.stack 4096;.data;prompt1 byte "This program will change the letters",cr,lf,lf ; value byte 16 dup (?) ;answer byte cr, lf,"The letter has changed:" ;clt byte 16 dup(?) ; byte cr,lf, 0 ;.code_start: start: output prompt1 ; input value ,16 ; mov al, value; int 21h cmp al, 'A' jb next cmp al, 'Z' ja next add al, 20h mov clt,al ; output answer ;next: mov dl, al sub dl,20h ; mov clt,dl ; output answer ; invoke ExitProcess,0 ; public _start ;end
------解决方案--------------------------------------------------------
前面的模式定义和对 ExitProcess() 系统函数的使用,都在表明你这应该是 Win32 类的程序,但程序里面怎么还使用上了 int21h 呢?
------解决方案--------------------------------------------------------
保护模式下不能使用BIOS中断,你输入一个数字后,运行到 int 21h ,当然会出现错误