|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- assume cs:code
- code segment
- start:
- mov ax,cs
- mov ds,ax
- mov si,offset do0
- mov ax,0
- mov es,ax
- mov di,200h ;将do0写到0:200处
- mov cx,offset do0end-offset do0
- cld
- rep movsb
-
- ;设置中断向量表
- mov ax,0
- mov es,ax ;将es指向中断向量表
- mov word ptr es:[7ch*4],200h ;发生7ch中断时跳转到0:200处执行
- mov word ptr es:[7ch*4+2],0
-
- mov ax,4c00h
- int 21h
-
-
- ;(1)清屏
- ;(2)设置前景色
- ;(3)设置背景色
- ;(4)向上滚动一行
- ;参数:
- ;ah:功能号,0清屏,1设置前景色,2设置背景色,3向上滚动一行
- ;针对1,2号功能,用al传递颜色值,0<=al<=7
- do0: jmp short set
- table: dw 200h+offset sub1-offset do0,200h+offset sub2-offset do0,200h+offset sub3-offset do0,200h+offset sub4-offset do0
- set:
- cmp ah,3
- ja sret
-
- push es
- push si
- push ax
- push cx
- push bx
- push di
-
- mov cx,0B800H
- mov es,cx
- mov si,0
- add ah,ah ;word两字节,ah*2
- mov cx,0
- mov cl,ah
- mov bx,200h+offset table-offset do0
- add bx,cx
- call word ptr cs:[bx] ;调用对应的功能子程序
-
- pop di
- pop bx
- pop cx
- pop ax
- pop si
- pop es
-
- sret: iret
-
- sub1:
- mov ax,0020H ;' '
- mov cx,80*25 ;每页80*25个字符
- s0: mov es:[si],ax
- add si,2
- loop s0
- ret
-
- sub2:
- mov cx,80*25 ;每页80*25个字符
- cmp al,1
- jb rsub2
- cmp al,7
- ja rsub2
-
- s1:
- mov bh,es:[si+1]
- and bh,11111000b ;前景色清零
- or bh,al
- mov es:[si+1],bh
- add si,2
- loop s1
- rsub2: ret
-
- sub3:
- mov cx,80*25 ;每页80*25个字符
- cmp al,1
- jb rsub3
- cmp al,7
- ja rsub3
- shl al,1
- shl al,1
- shl al,1
- shl al,1
-
- s2:
- mov bh,es:[si+1]
- and bh,10001111b ;被景色清零
- or bh,al
- mov es:[si+1],bh
- add si,2
- loop s2
- rsub3: ret
- sub4:
- mov cx,80*24
- mov di,160
- s3:
- mov ax,es:[di]
- mov es:[si],ax
- add si,2
- add di,2
- loop s3
-
- mov cx,80 ;清空最后一行
- mov bh,20H
- s4: mov es:[si],bh
- add si,2
- loop s4
- ret
- do0end: nop
- code ends
- end start
复制代码
心情不太好,感觉有点乱糟糟的,懒得改了 |
|