永发信息网

汇编 高手 帮帮忙

答案:3  悬赏:60  手机版
解决时间 2021-05-05 23:55
  • 提问者网友:沉默的哀伤
  • 2021-05-05 07:23

就是输入一行字符 把有小a的转化为A

.386
.MODEL FLAT

ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

INCLUDE io.h ; header file for input/output

cr EQU 0dh ; carriage return character
Lf EQU 0ah ; line feed

.STACK 4096 ; reserve 4096-byte stack
.DATA ; reserve storage for data

prompt1 BYTE "String to search ?",0
prompy2 BYTE cr,Lf,0
target dword 80 DUP(?),0
key dword 61h
mark dword 41h
trgtLength DWORD ?
keyLength DWORD 1
number BYTE 80 DUP(?)


.CODE ; start of main program code
strlen PROC NEAR32
push ebp
mov ebp,esp
pushf
push ebx
sub eax,eax
mov ebx,[ebp+8]
whileChar: cmp BYTE PTR [ebx],0
je endWhileChar
inc eax
inc ebx
jmp whileChar
endWhileChar:
pop ebx
popf
pop ebp
ret 4
strlen ENDP

_start:

output prompt1

input target,80
lea eax,target
push eax
call strlen
mov trgtLength,eax

mov eax,1
lea ebx,target
whilePosn: cmp eax,trgtLength
jg endWhile
mov edx,key
cmp edx,[ebx]
je found
add ebx,4
inc eax
jmp whilePosn
found:
mov edx,mark
mov [ebx],edx

add ebx,4
inc eax
jmp whilePosn


endWhile:
lea ebx,target
mov ecx,trgtLength
loop1: output [ebx]
add ebx,4
loop loop1

INVOKE ExitProcess, 0 ; exit with return code 0
PUBLIC _start ; make entry point public

END ; end of source code

最佳答案
  • 五星知识达人网友:有你哪都是故乡
  • 2021-05-05 08:56
.386
.model flat, stdcall

includelib ..\lib\msvcrt.lib

.data
msg db 'Plz input a line of text:',0
buffer db 100 dup(?)

printf proto c :VARARG
gets proto c :DWORD
exit proto c :DWORD

.code
start:
invoke printf, offset msg
invoke gets, offset buffer
lea ebx, buffer
jmp ts
up:
inc ebx
ts:
mov al, [ebx]
cmp al, 0
jz done
cmp al, 'a'
jnz up
sub al, 20h
mov [ebx], al
jmp up
done:
invoke printf, offset buffer
invoke exit, 0
end start
全部回答
  • 1楼网友:蓝房子
  • 2021-05-05 11:22
恩,这个问题值得思考!让我再想想!
  • 2楼网友:雪起风沙痕
  • 2021-05-05 10:07
能不能用ASCIA码来解决? 把小a对应的数字 +32就变成大A了呢?
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯