"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, 11011111 b ; 转大写
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, 4 c00h
int 21 h
codesg ends
end start