汇编题目:编写包含多个功能子程序的中断例程
生活随笔
收集整理的這篇文章主要介紹了
汇编题目:编写包含多个功能子程序的中断例程
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
安裝一個(gè)新的int? 7ch中斷例程,為顯示輸出提供如下的功能子程序。
?(1)清屏。
?(2)設(shè)置前景色。
?(3)設(shè)置背景色。
?(4)向上滾動(dòng)一行
(一)用ah寄存器傳遞功能號(hào):0表示清屏,1表示設(shè)置前景色,2表示設(shè)置背景色,3表示向上滾動(dòng)一行;
(二)對(duì)于2、3號(hào)功能,用al傳遞顏色值,(al)∈{0,1,2,3,4,5,6,7}。
代碼如下:
;功能:安裝一個(gè)新的int7ch中斷例程,實(shí)現(xiàn)一個(gè)子程序 setScreen ,提供如下功能: ; ?(1)清屏。 ; ?(2)設(shè)置前景色。 ; ?(3)設(shè)置背景色。 ; ?(4)向上滾動(dòng)一行; 入口參數(shù)說明: ; ?(1)每個(gè)子程序用 ah 寄存器傳遞功能號(hào): ; ?(2)對(duì)于2、3號(hào)功能,用al傳送顏色值, assume cs:code,ds:datadata segment err db ' ~~~~~ ah args is error! ~~~~~','$'init dw 10 dup(0)data endscode segmentstart:mov ax,datamov ds,axmov ax,0mov es,axmov ax,es:[7ch*4]mov init[0],axmov ax,es:[7ch*4+2]mov init[1],axmov es:[7ch*4],offset setScreenmov es:[7ch*4+2],csmov ax,102hint 7ch;call breakPointmov ax,201hint 7ch;call breakPointmov ax,300hint 7ch;call breakPointmov ax,0hint 7chmov ax,400hint 7chmov ax,0mov es,axmov ax,datamov ds,axmov ax,init[0]mov es:[7ch*4],axmov ax,init[1]mov es:[7ch*4+2],axok: mov ax,4c00hint 21hsetScreen:jmp short setmainlist dw sub0,sub1,sub2,sub3setmain:cmp ah,3ja subErrmov bl,ahmov bh,0shl bx,1call word ptr list[bx]iretsub0: ;清屏mov cx,0b800hmov es,cxmov cx,2000mov bx,0sub0s:mov byte ptr es:[bx],' 'add bx,2loop sub0sretsub1: ;設(shè)置前景色。mov cx,0b800hmov es,cxmov cx,2000mov bx,1sub1s:and byte ptr es:[bx],11111000bor es:[bx],aladd bx,2loop sub1sretsub2: ;設(shè)置背景色。mov cx,0b800hmov es,cxmov cx,2000mov bx,1shl al,1shl al,1shl al,1shl al,1sub2s:and byte ptr es:[bx],10001111bor es:[bx],aladd bx,2loop sub2sretsub3: ;向上滾動(dòng)一行mov cx,0b800hmov es,cxmov ds,cxmov di,0mov si,160climov cx,24sub3s:push cxmov cx,160rep movsbpop cxloop sub3smov cx,160mov bx,0sub3s1:mov byte ptr es:3840[bx],' 'add bx,2loop sub3s1retsubErr: ;顯示錯(cuò)誤信息mov ax,datamov ds,axmov ah,9mov dx,offset errint 21hjmp okbreakPoint: ;設(shè)置斷點(diǎn),用于調(diào)試pushfpop bxor bh,3push bxpopfretcode endsend start?
總結(jié)
以上是生活随笔為你收集整理的汇编题目:编写包含多个功能子程序的中断例程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Win10 IIS本地部署网站运行时图片
- 下一篇: HashMap vs Concurren