回 帖 发 新 帖 刷新版面

主题:怎么回事?

晚上没事写了一个小小的程序,是关于小写字母转化成大写字母的,怎么老是不成功呢?
不过把相关的dos调用信息去掉后时能转化成功的,发个帖子找老手或者是有经验的给修正一下
谢谢
相关代码如下:
stack segment stack
 db 200 dup (?)
stack ends
data segment
buf1 db 'please input the xiao xie char:$'
buf2 db 0ah,0dh,'$'
buf3 db 'the da xie char is:$'
code segment
assume cs:code,ss:stack,ds:data
start:
mov ax,data
mov ds,ax
mov dx,offset buf1
mov ah,9
int 21h
mov dx,offset buf2
mov ah,9
int 21h
mov ah,1
int 21h
mov dx,offset buf2
mov ah,9
int 21h
mov dx,offset buf3
mov ah,9
int 21h
mov dx,offset buf2
mov ah,9
int 21h
sub al,20h
mov dl,al
mov ah,2
int 21h
mov ah,4ch
int 21h
code ends
end start

回复列表 (共2个回复)

沙发


stack segment stack
 db 200 dup (?)
stack ends
data segment 
buf1 db 'please input the xiao xie char:$'
buf2 db 0ah,0dh,'$'
buf3 db 'the da xie char is:$'
data ends
code segment
assume cs:code,ss:stack,ds:data
start:
mov ax,data
mov ds,ax
mov dx,offset buf1
mov ah,9
int 21h
mov dx,offset buf2
mov ah,9
int 21h
mov ah,1
int 21h
push ax
mov dx,offset buf2
mov ah,9
int 21h
mov dx,offset buf3
mov ah,9
int 21h
mov dx,offset buf2
mov ah,9
int 21h
pop ax
sub al,20h
mov dl,al
mov ah,2
int 21h
mov ah,4ch
int 21h
code ends
end start

改成这样就行了,好像dos功能调用会改变al的值。所以用堆栈把ax的值保存起来了

板凳

恩,解决了
谢谢。。。

我来回复

您尚未登录,请登录后再回复。点此登录或注册