⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 small_vesa_text.inc

📁 TestOS - 带简单GUI的DOS扩展OS// 源代码// ASM// 英文
💻 INC
字号:
;=========================================================;
; Small_vesa_Text                                11/12/03 ;
;---------------------------------------------------------;
; DOS EXTREME OS V0.01                                    ;
; by Craig Bamford.                                       ;
;                                                         ;
; Vesa small text functions for uses in programs.         ;                          
;=========================================================;

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''';
 ; Draw Char small ; draws smal char from al in vesa. ;
 ;----------------------------------------------------;
 ;                                                    ;
 ;  Input:                                            ;
 ;      Al Ascii character to write.                  ;
 ;                                                    ;
 ; Output:                                            ;
 ;      None.                                         ;
 ;....................................................;

Draw_Char_small:
 
        mov   dl,[Row]  
        cli          
        cld 
        push  edi                    
GetData:             
        lodsb 
        shl   ax,8                  
        mov   bx,ax          
        mov   cl,8          
CheckBit:                
        test  bx,8000h        
        jz    ZeroBit       
      
        push  ebx 

        mov   ebx,0xff0000fF		                             ;blue
	mov   dword [es:edi],ebx  
        add   edi,4
        sub   edi,[bpp]

        pop   ebx 
             
        jmp   Skip            
ZeroBit:
        add	edi,4
        sub     edi,[bpp]             
                   
Skip:                 
        shl   bx,1            
        loop  CheckBit         
        add   edi,2528    
        cmp   [bpp],1
        jne   bbf
        sub   edi,632
bbf:                           
        dec   dl                
        jnz   GetData 
        pop   edi
        sti    
        ret

 ;----------------------------------------------------;
 ; Converts a string from text to vesa mode.          ;
 ;----------------------------------------------------;

Convert_Text_Small: 

        push  eax
	push  esi

        mov   al,[tchar]
        call  get_text

        mov   [tcolor],0ah
        mov   byte [Row],7
       
        call  get_vesa_screen_pointer
       
        call    Draw_Char_small   
      
        call   inc_vesa_screen_pointer
       
        pop   esi
	pop   eax
 
        ret

 ;'''''''''''''''''''''''''''''''''''''''''''''''''''';
 ; Prints vesa string ; does what it say's on the box ;
 ;----------------------------------------------------;
 ;                                                    ;
 ;  Input:                                            ;
 ;      es:esi points to asciiz string to write.      ;
 ;                                                    ;
 ; Output:                                            ;
 ;      None.                                         ;
 ;....................................................;

print_vesa_string_small:                                   
	push  eax
	push  esi
abloop:
	mov   al,[esi]
        mov   [tchar],al
	cmp   al,0				           ; 0x00 = end of string
	je    gbend
	cmp   al,0x0D				           ; 0x0d = CR ( = \n )
	jne   nbo_cr
	call  cage_return
	jmp   ab1
nbo_cr:

	call  Convert_Text_Small
ab1:	inc   esi
      	jmp   abloop
gbend:
       
	pop   esi
	pop   eax
	ret
 ;----------------------------------------------------;
 ; render's graphic screen.                           ;
 ;----------------------------------------------------;

render_screen:
        
        mov   edi,[ModeInfo_PhysBasePtr]     
        mov   ecx,640*480
        mov   eax, [color]
       
        cld
        cli
bbe:
        stosd
        sub   edi,[bpp]
        loop  bbe      
        sti

        ret
;----------------------------------------------------
get_vesa_screen_pointer:                                     
	
	push  eax                                          ; edi += screen_x * 2 + screen_y * 160
	push  ebx
        mov   edi,[ModeInfo_PhysBasePtr]
	xor   ebx,ebx
       
	mov   ebx,[vesa_fontsmall_x]
	shl   ebx,2
        cmp   [bpp],1
        jne   bbk
        sub   ebx,[vesa_fontsmall_x]
bbk:       
	add   edi, ebx
	mov   ebx,[vesa_fontsmall_y]
	mov   eax,0xA00       
        cmp   [bpp],1
        jne   bbj
        sub   eax,0x280
bbj:
	mul   ebx
	add   edi,eax
    	pop   ebx
	pop   eax
       
	ret
;------------------------------------------------------
inc_vesa_screen_pointer:
	push  eax
	cld

	mov   eax,[vesa_fontsmall_x] ;[screen_x]
	cmp   ax,630
	jb    no4_incy

	call  cage_return
	jmp   d1end

no4_incy:
	add   eax,7
	mov   [vesa_fontsmall_x],eax

d1end:	pop   eax
	ret
;--------------------------------------------------------
cage_return:
	push  eax
	mov   [vesa_fontsmall_x], dword 0
	mov   eax,[vesa_fontsmall_y] ;[screen_y]     
	cmp   eax,467                 
	jb    no_scrl

	mov   [vesa_fontsmall_x],0
        mov   [vesa_fontsmall_y],0
        add   [vesa_fontsmall_y],1
	jmp   cend1
no_scrl:
	add   eax,12    
	mov   [vesa_fontsmall_y],eax     

cend1:	pop   eax
	ret



 ;----------------------------------------------------;
 ; Some data.                                         ;
 ;----------------------------------------------------;

vesa_fontsmall_x dd 0                              ;By x7 ( STARTS AT 0)
vesa_fontsmall_y dd 0                              ;BY X12 9STARTS AT 1)
textx      dw 0
texty      dw 0
Row        db 0
tcolor     db 0
tchar      db 0
color      dd 0  
red        dd 0
blue       dd 0   

⌨️ 快捷键说明

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