汇编语言——练习题4.2

版权声明:未经本人同意,禁止转载。 https://blog.csdn.net/qq_34022601/article/details/89055440

题目:

   内容:从键盘输入一串字母并保存在string开始的地址单元,要求将该字符串中的大写字母转化为小写字母后用子程序实现在终端上依次显示该串字母的 ASCII码。

   string db   n  dup(?)

要求:熟练掌握子程序设计方法,画子程序、主程序流程图


函数说明:

ReadString:

edx: 存放字符串首地址

ecx:设置字符串最大长度

eax:是输入后的返回值——输入的字符串长度


流程图:


代码:

INCLUDE irvine32.inc
.data
	string db 150 dup(?)
	cnt dd 50
	len dd ?
.code
start :
	mov ecx,cnt
	lea edx,string
	call readstring
	mov len,eax
	mov ecx,len
	xor esi,esi
	xor eax,eax
	again:
		mov al,string[esi]
		cmp al,'a'
		jae next
		add al,32
		mov string[esi],al
	next:
		inc esi
		call writeint
		loop again
	call crlf
	lea edx,string
	call writestring
	exit
	
end start

结果:

猜你喜欢

转载自blog.csdn.net/qq_34022601/article/details/89055440