vesagraphics.inc

来自「TestOS - 带简单GUI的DOS扩展OS// 源代码// ASM// 英文」· INC 代码 · 共 100 行

INC
100
字号
;=========================================================;
; VesaGraphics                                   11/12/03 ;
;---------------------------------------------------------;
; DOS EXTREME OS V0.01                                    ;
; by Craig Bamford.                                       ;
;                                                         ;
; Vesa Graphics functions for uses in programs.           ;                          
;=========================================================;

 ;----------------------------------------------------;
 ; PutBmp                    ;put a bmp pic on screen ;
 ;----------------------------------------------------;

PutBmp:
        cmp   [ModeInfo_BitsPerPixel],24
        jne   Try32bits
        call  PutBmp24
        jmp   wehavedone1
Try32bits:
        cmp   [ModeInfo_BitsPerPixel],32
        jne   wehavedone1
        call  PutBmp32 
wehavedone1:
        ret 

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''';
 ; PutBmp32              ; puts a 32bit bmp to screen ;
 ;----------------------------------------------------;
 ;                                                    ;
 ;  Input:                                            ;
 ;                                                    ;
 ;                                                    ;
 ; Output:                                            ;
 ;                                                    ;
 ;....................................................;

PutBmp32:      
        mov   ax,linear_sel
	mov   es,ax
        xor   edi,edi      
        mov   edi,[ModeInfo_PhysBasePtr]
        mov   esi,0x200000
        add   esi,640*3*479
        add   esi,ebx
newln32:
        push  esi
        push  edi
        mov   ecx,640         
        cld
        cli
lets_do_a_loop1:
        movsd
        dec   esi
        loop  lets_do_a_loop1
        sti
        pop   edi
        pop   esi
   
        sub   esi,640*3
        add   edi,640*4
        cmp   esi,0x200000
        jge   newln32 

        ret

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''';
 ; PutBmp24              ; puts a 24bit bmp to screen ;
 ;----------------------------------------------------;
 ;                                                    ;
 ;  Input:                                            ;
 ;                                                    ;
 ;                                                    ;
 ; Output:                                            ;
 ;                                                    ;
 ;....................................................;

PutBmp24:
        mov   ax,linear_sel
	mov   es,ax
        xor   edi,edi      
        mov   edi,[ModeInfo_PhysBasePtr]
        mov   esi,0x200000
        add   esi,640*3*479
        add   esi,ebx
newln24:
        push  esi
        push  edi
        mov   ecx,480         
        cld
        cli
        rep   movsd
        sti
        pop   edi
        pop   esi
        sub   esi,640*3
        add   edi,640*3
        cmp   esi,0x200000
        jge   newln24

        ret             

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?