# 实验三 转移指令跳转原理及其简单应用编程

1.

s1编号所在的下一条语句为MOV dl [si] 所以cpu直接将程序跳转到 此条语句处

2

s1编号所在的下一条语句为MOV dx [si] 所以cpu直接将程序跳转到 此条语句处

1.ax=0021 bx=0026 cx=076c

2实验结果如图，call word ptr ds:[0] 将下一条指令的ip0021压入栈之后 pop ax后ax中的结果应该为0021

call dword ptr ds:[2] 指令将下一条指令的cs:ip压入栈，然后将ip 和cs依次出栈到bx,cx中，故bx-0026 cx=076c

assume cs:code, ds:data
data segment
x db 99,72,85,63,89,97,55
len equ $- x ;len = 7 data ends code segment start: mov ax, data mov ds, ax mov si, 0 mov bl, 0ah mov cx, len s: mov al, [si] mov ah, 0 call printNumber call printSpace inc si loop s jmp exit printNumber: div bl mov dl, ah mov dh, al add dl, 30h mov ah, 2 int 21h mov dl, dh add dl, 30h int 21h ret printSpace: mov dl, ' ' int 21h ret exit: mov ah, 4ch int 21h code ends end start  实验四 assume cs :code data segment str db 'try' len equ$ - str
data ends

stack segment
db 16 dup(0)
stack segment

stack ends

code segment
start:

mov ax, stack
mov ss, ax
mov sp, 16;初始化栈

MOV AX,0B800H
MOV es,AX		;使用 80x25 彩色字符模式，内存地址 0xB8000 - 0xBFFFFF
MOV di,0

mov bl, 02h
call printstr

mov bl, 0Ch
mov bh, 24
mov al, bh
mov dl, 0A0h
mul dl
mov di,ax
mov AX,0B800H
MOV es,AX
call printStr

mov ah,4ch
int 21h

printstr:

MOV CX,len
mov ax,data
mov ds,ax
mov si,0

s:
mov dx,[si]
MOV es:[di],DX	;显示 ASCII 字符
MOV es:[di],bl	;设置字符显示属性
inc si
LOOP s

ret

code ends
end start


assume cs:code,ds:data

data segment
stu_no db '201983290439'
len = \$ - stu_no
data ends

code segment
start:
mov ax,data
mov ds,ax
mov si,0
mov cx,len

mov ax,0B800H
mov es,ax
mov di,1

mov al, 25
mov dl, 80
mul dl
mov cx,ax

color:
mov al,17h
mov es:[di],al
loop color

mov bh, 24
mov al, bh
mov dl, 0A0h
mul dl
mov di,ax

mov bh, 24
mov al, bh
mov dl, 0A0h
mul dl
mov di,ax
mov AX,0B800H
MOV es,AX

mov ax,34
mov cx,ax
print1:
mov ax,'-'
mov es:[di],ax
mov es:[di+1],17h

loop print1

mov cx,len
print:
mov ax,[si]
mov es:[di],ax
mov es:[di+1],17h
inc si
loop print

mov ax,34
mov cx,ax
print3:
mov ax,'-'
mov es:[di],ax
mov es:[di+1],17h
loop print3
mov ah,4ch
int 21h

code ends
end start


posted on 2021-11-30 14:29  落叶千藩  阅读(27)  评论(5编辑  收藏  举报