第五章学习结束啦, 习题也做了不少, 今天编写了一段小程序,算是个总结吧。
【将一段连续地址存贮的数据倒序排列, 比如将地址2000:0 f 反过来排列】
------------------------------------------------------------------------------
d:\asm>type 59b.asm
assume cs:code
code segment
mov ax,2000h
mov ds,ax
mov si,0
mov di,0fh
mov cx,8
s: mov al,[si]
mov ah,0
mov ah,[di]
mov [di],al
mov al,[di]
mov [si],ah
inc si
sub di,1
loop s
mov ah,4ch
int 21h
code ends
end
----------------------------------------------------------------------------
实验结果:
d:\asm>debug 59b.exe
-e 2000:0 0 1 2 3 4 5 6 7 8 9 a b c d e f
-d 2000:0 f
2000:0000 00 01 02 03 04 05 06 07-08 09 0A 0B 0C 0D 0E 0F ................
-
(过程略)
结果:
-p
Program terminated normally
-d 2000:0 f
2000:0000 0F 0E 0D 0C 0B 0A 09 08-07 06 05 04 03 02 01 00 ................
- |