第四篇 操作80*25彩色字元顯示緩衝區

來源:互聯網
上載者:User

這篇博文將要簡單介紹下,如何在螢幕上顯示字元的各種效果。

註:博文中的圖片來自王爽《組合語言》,代碼出自博主。

一:要求

二、對顯示緩衝區的簡單介紹

三、對字元屬性位元組的簡單介紹

四、一個簡單的例子,有助於理解

五、解決該題

1、按照題意,只要想緩衝區一個接一個地寫入字元及其屬性就可以在螢幕上顯示了。

代碼:

data segmentcharacters db 77h,65h,6ch,63h,6fh,6dh,65h,20h,74h,6fh,20h,6dh,61h,73h,6dh,21h      ;welcome to masm!color1 db 02h      ;綠色color2 db 24h      ;綠底紅色color3 db 71h      ;白底藍色data endscode segmentassume cs:code,ds:datastart:mov ax,datamov ds,ax;顯示綠色mov di,0mov al,color1call display;顯示綠底紅色mov di,00a0hmov al,color2call display;顯示白底藍色mov di,0140hmov al,color3call displaymov ah,4chint 21hdisplay proc nearpush sipush cxpush bx;顯示確定段地址mov bx,0b800hmov es,bx;將字元及其屬性寫到記憶體相關地區mov si,0mov cx,16again:mov bl,characters[si]mov es:[di],blinc dimov es:[di],alinc diinc siloop againpop bxpop cxpop siretdisplay endpcode endsend start

2、這裡要注意的是,博主在win7旗艦版系統上無法看到結果,在XP系統上顯示結果。結果會依次顯示在

螢幕的最前三行。

3、結果


 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.