"Assembly Language" - Reading Notes - Program in Experiment 6 Practical Course

1. Debug all the programs explained in the course on the computer, use Debug to track their execution process, and further understand the content in the process.

"Assembly Language" - Reading Notes - Chapter 7 - A More Flexible Method of Locating Memory Addresses

2. Programming, complete the program in question 7.9.

assume cs:codesg,ss:stacksg,ds:datasg

stacksg segment				;16字节
	dw 0,0,0,0,0,0,0,0
stacksg ends

datasg segment				;64字节
	db '1. display      '	;16字节
	db '2. brows        '	;16字节
	db '3. replace      '   ;16字节
	db '4. modify       '   ;16字节
datasg ends

codesg segment			
start:	mov ax, stacksg		
		mov ss, ax			; 定义栈段
		mov sp, 16			; 定义栈顶指针
		mov ax, datasg		
		mov ds, ax			; 定义数据段
		
		mov bx, 0			; 行偏移。相当于外层循环的i
		mov cx, 4			; 外层循环,对应4行字符。	
 fori: 	push cx				; 外层剩余循环次数压栈保存
		mov si,	0
		mov cx, 4			; 内层循环,对应要处理4个字母
		
 forj: 	mov al, [bx+si+3]	; 字符位置[bx行+从第3个字符开始+当前处理第si个字符]
		and al, 11011111b	; 转大写
		mov [bx+si+3], al	; 送回内存
		inc si				; j++ 下一个字符
		loop forj			; cx--; cx != 0 继续循环,内层循环结束

		add bx, 16			; i++ 下一行(每行16所以要偏移16字节)
		pop cx				; fori 执行完,回到forj
		loop fori			; cx--; cx != 0 继续循环,外层循环结束
		
		mov ax, 4c00h
		int 21h
codesg ends                   
end start

insert image description here

Guess you like

Origin blog.csdn.net/jx520/article/details/130925150