实验9
1.补全t1.asm的源代码:
assume cs:code,ds:data 2 data segment 3 db 12 4 db 0,0 5 data ends 6 code segment 7 start: 8 mov ax,data 9 mov ds,ax 10 11 mov ah,0 12 mov al,ds:[0] 13 mov bl,10 14 div bl 15 mov ds:[1],al 16 mov ds:[2],ah 17 18 mov ah,2 19 mov dl,ds[1] 20 21 add dl,30h 22 int 21h 23 24 mov ah,2 25 mov dl,ds:[2] 26 mov dl,30h 27 int 21h 28 29 mov ax,4c00h 30 int 21h 31 code ends 32 end start
运行得到10;
2 t2.asm
assume cs:code, ds:data 2 data segment 3 db 12,35,96,55,67 4 db 0,0,0,0,0,0,0,0,0,0 5 data ends 6 code segment 7 start: 8 mov ds,ax 9 mov bx,0 10 mov cx,5 11 s:mov al,ds:[bx] 12 mov ah,0 13 mov dl,10 14 div dl 15 or ah,00110000b 16 or al,00110000b 17 mov ds:[bx+5],al 18 mov ds:[bx+6],ah 19 mov ah,2 20 mov dl,ds:[bx+5] 21 int 21h 22 mov ah,2 23 mov dl,ds:[bx+6] 24 int 21h 25 mov ah,2 26 mov dl,' ' 27 int 21h 28 inc bx 29 loop s 30 mov ax,4c00h 31 int 21h 32 code ends 33 end start
运行结果:
3.
3 assume ds:data, cs:code 4 data segment 5 db 'welcome to masm!' db 2H,24H,71H 7 data ends 8 9 code segment 10 start: mov ax,data 11 mov ds,ax 12 13 mov ax,0b800H 14 mov es,ax 15 mov cx,16 16 mov bx,0 17 mov dx,0 18 s1: mov bx,dx 19 mov al,ds:[bx] 20 add bx,bx 21 mov es:[bx],al 22 add bx,1 23 mov al,ds:[16] 24 mov es:[bx],al 25 inc dx 26 loop s1 27 mov cx,16 28 mov bx,0 29 mov dx,0 30 mov si,0a0h 31 s2: mov bx,dx 32 mov al,ds:[bx] 33 add bx,bx 34 mov es:[bx+si],al 35 add bx,1 36 mov al,ds:[17] 37 mov es:[bx+si],al 38 inc dx 39 loop s2 40 mov cx,16 41 mov bx,0 42 mov dx,0 43 mov si,140h 44 s3: mov bx,dx 45 mov al,ds:[bx] 46 add bx,bx 47 mov es:[bx+si],al 48 add bx,1 49 mov al,ds:[18] 50 mov es:[bx+si],al 51 inc dx 52 loop s3 53 mov ax,4c00h 54 int 21h 55 code ends 56 end start
运行结果
实验总结:难起来了,发现如果想要搞懂每个程序到底是怎么实现的有点困难,我觉得弄懂老师给的问题就行了吧,但是还是有一些地方不太明白的,尤其是div和新学的一部分内容。还是得多多看书,向老师同学请教。