回 帖 发 新 帖 刷新版面

主题:帮帮忙吧 !!看一下这个程序哪里有问题

.model small
.data
capl db 'A','B','C','D','E','F'
smal db 'g','h','i','j','k','m'
caplres db 6 dup(?)
smalres db 6 dup(?)

.code
.startup

mov si ,offset capl
mov di ,offset caplres
mov cx ,6

again:
mov ax , [si]
add ax, 26
mov [di] ,al
add si,1
add di,1
loop again


mov si ,offset smal
mov di ,offset smalres
mov cx ,6

againtwo:
mov ax , [si]
sub ax, 26
mov [di] ,al
add si,1
add di,1
loop againtwo

.exit
End


每次我debug的时候masm就自动关了


1、在数据段定义字符串CAPL如下A,B,C,D,E,F;SMAL如下g,h,i,j,k,m
2、在程序里实现大小写串的转换
3、转换结果请保存至数据段预先定义的变量CAPLRES,SMALRES

回复列表 (共2个回复)

沙发

好象这种简写格式只能在MASM6.0才能编绎

板凳

.model small
.data
capl db 'A','B','C','D','E','F'
smal db 'g','h','i','j','k','m'
caplres db 6 dup(?)
smalres db 6 dup(?)

.code
;.startup    这里不能用这个 这个只能在MASM6.0里编绎
start:
mov ax,@data
mov ds,ax

mov si ,offset capl
mov di ,offset caplres
mov cx ,6

again:
mov ax , [si]
add ax, 20h  ;这里是20H因为大小写只差20H
mov [di] ,ax ;这里不能用AL
add si,1
add di,1
loop again


mov si ,offset smal
mov di ,offset smalres
mov cx ,6

againtwo:
mov ax , [si]
sub ax, 20h
mov [di] ,ax
add si,1
add di,1
loop againtwo

;.exit    ;这里同样
;End
mov ah,4ch
int 21h
end start


这样不知道符不符合你的原意

我来回复

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