汇编程序46:实验13 编写、应用中断例程(1)
1 assume cs:code 2 ;将数据段显示到屏幕上,安装程序 3 code segment 4 start: 5 mov ax,cs 6 mov ds,ax 7 mov si,offset sub1 8 mov ax,0020h 9 mov es,ax 10 mov di,0 11 mov bx,offset sub2 - offset sub1 12 cld 13 rep movsb 14 mov ax,0 15 mov es,ax 16 mov word ptr es:[7ch*4],200h 17 mov word ptr es:[7ch*4+2],0 18 mov ah,4ch 19 mov al,0 20 int 21h 21 sub1: 22 push si 23 s: 24 cmp byte ptr ds:[si],0 25 je s1 26 inc si 27 jmp short s 28 s1:
2x dec si 29 mov byte ptr ds:[si],'$' ;'$'为显示字符串的结束标志 30 pop si
3x mov dx,0 ;dx为指向数据串的起始位置 31 mov ah,9 ;第9号子程序 32 int 21h 33 iret 34 sub2: 35 nop 36 code ends 37 38 end start
1 assume cs:code 2 ;测试程序 3 data segment 4 db 'weclome to masm!','0' 5 data ends 6 7 code segment 8 start: 9 mov dh,10 ;行号 10 mov dl,10 ;列号 11 mov cl,2 ;颜色属性 12 mov ax,data 13 mov ds,ax 14 mov si,0 ;指向数据段开始 15 int 7ch ;显示的中断例程 16 mov ax,4c00h 17 int 21h 18 code ends 19 20 end start