【1】
assume cs:code
code segment
start:
mov ax,cs
mov ds,ax
mov si,offset showbegin
mov ax,0000
mov es,ax
mov di,0200h
cld
mov cx,offset showend-offset showbegin
rep movsb
mov ax,0000h
mov ds,ax
mov word ptr ds:[7ch*4],0200h
mov word ptr ds:[7ch*4+2],0000h
mov ax,4c00h
int 21h
showbegin:
push ax
push bx
push cx
push es
mov ax,160
mul dh
mov bx,ax
mov ax,2
mul dl
add bx,ax;存放了在显存中的偏移地址
mov ax,0b800h
mov es,ax
mov al,cl
showjmp:
mov cl,[si]
mov ch,0
jcxz ok
mov es:[bx],cl
mov es:[bx+1],al
inc si
add bx,2
jmp short showjmp
ok:
pop es
pop cx
pop bx
pop ax
iret
showend:
nop
code ends
end start
;测试程序
assume cs:code,ds:data
data segment
db 'Welcome to masm!',0
data ends
code segment
start:
mov dh,10
mov dl,10
mov cl,02h
mov ax,data
mov ds,ax
mov si,0
int 7ch
mov ax,4c00h
int 21h
code ends
end start
【2】
assume cs:code
code segment
start:
mov ax,cs
mov ds,ax
mov si,offset loopbegin
mov ax,0000h
mov es,ax
mov di,0200h
cld
mov cx,offset loopend-offset loopbegin
rep movsb
mov ax,0000h
mov ds,ax
mov word ptr ds:[7ch*4],0200h
mov word ptr ds:[7ch*4+2],0000h
mov ax,4c00h
int 21h
loopbegin:
push bp
mov bp,sp
dec cx
jcxz ok
add [bp+2],bx
ok:
pop bp
iret
loopend:
nop
code ends
end start
;测试程序
assume cs:code
code segment
start:
mov ax,0b800h
mov es,ax
mov di,160*12
mov al,02h
mov bx,offset showbegin-offset showend
mov cx,80
showbegin:
mov byte ptr es:[di],'!'
mov byte ptr es:[di+1],al
add di,2
int 7ch
showend:
nop
mov ax,4c00h
int 21h
code ends
end start
【3】
assume cs:code
code segment
s1:
db 'Good,better,best,','$'
s2:
db 'Never let it rest','$'
s3:
db 'Till good is better','$'
s4:
db 'And better,best.','$'
s:
dw offset s1,offset s2,offset s3,offset s4
row:
db 2,4,6,8
start:
mov ax,cs
mov ds,ax
mov bx,offset s
mov si,offset row
mov cx,4
show:
mov ah,2
mov bh,0
mov dh,[si]
mov dl,15
int 10h
mov dx,[bx]
mov ah,9
int 21h
inc si
add bx,2
loop show
mov ax,4c00h
int 21h
code ends
end start
inc si
add bx,2
jmp short showjmp
ok:
pop es
pop cx
pop bx
pop ax
iret
showend:
nop
code ends
end start
王爽 汇编 实验13:编写、应用中断进程
最新推荐文章于 2021-10-21 07:06:02 发布