2 ;; -----------------------------------------------------------------------
4 ;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;; Boston MA 02111-1307, USA; either version 2 of the License, or
10 ;; (at your option) any later version; incorporated herein by reference.
12 ;; -----------------------------------------------------------------------
14 ; ----------------------------------------------------------------------------
15 ; VGA splash screen code
16 ; ----------------------------------------------------------------------------
20 ; Display a graphical splash screen.
24 ; SI = cluster/socket pointer
32 ; This is a cheap and easy way to make sure the screen is
33 ; cleared in case we were in graphics mode already
39 mov ax,xfer_buf_seg ; Use as temporary storage
43 call vgagetchunk ; Get the first chunk
45 ; The header WILL be in the first chunk.
46 cmp dword [es:xbs_vgabuf],0x1413f33d ; Magic number
48 mov ax,[es:xbs_vgabuf+4]
51 mov dx,xbs_vgabuf+8 ; Color map offset
52 mov ax,1012h ; Set RGB registers
53 xor bx,bx ; First register number
54 mov cx,16 ; 16 registers
58 mov ax,[es:xbs_vgabuf+6] ; Number of pixel rows
63 xor dx,dx ; Set column to 0
72 int 10h ; Set cursor below image
74 mov cx,[es:xbs_vgabuf+6] ; Number of graphics rows
76 mov si,xbs_vgabuf+8+3*16 ; Beginning of pixel data
82 mov di,xbs_vgatmpbuf ; Row buffer
83 call rledecode ; Decode one row
90 rep stosd ; Clear rest of row
91 mov di,0A000h ; VGA segment
96 add word [VGAPos],byte 80 ; Advance to next pixel row
109 ; Decode a pixel row in RLE16 format.
113 ; ES:DI -> output (packed pixel)
116 shl esi,1 ; Nybble pointer
117 xor dl,dl ; Last pixel
121 je .run ; Start of run sequence
165 cmp si,xbs_vgabuf+trackbufsize ; Chunk overrun
168 mov si,xbs_vgabuf ; Start at beginning of buffer
175 ; Get a new trackbufsize chunk of VGA image data
177 ; On input, ES is assumed to point to the buffer segment.
183 jz .eof ; EOF overrun, not much to do...
185 mov cx,[BufSafe] ; One trackbuf worth of data
191 .noteof: mov [VGACluster],si
198 ; Convert packed-pixel to VGA bitplanes
200 ; FS:SI -> packed pixel string
201 ; BP -> pixel count (multiple of 8)
205 mov dx,3C4h ; VGA Sequencer Register select port
206 mov al,2 ; Sequencer mask
207 out dx,al ; Select the sequencer mask
208 inc dx ; VGA Sequencer Register data port
220 rcl ch,1 ; VGA is bigendian. Sigh.
236 ; Enable VGA graphics, if possible; return ZF=1 on success
237 ; DS must be set to the base segment; ES is set to DS.
242 mov ax,1A00h ; Get video card and monitor
245 sub bl, 7 ; BL=07h and BL=08h OK
248 ; mov bx,TextColorReg
249 ; mov dx,1009h ; Read color registers
251 mov ax,0012h ; Set mode = 640x480 VGA 16 colors
254 mov ax,1002h ; Write color registers
256 mov [UsingVGA], byte 1
258 call use_font ; Set graphics font/data
259 mov byte [ScrollAttribute], 00h
267 ; Disable VGA graphics. It is not safe to assume any value
277 cmp [UsingVGA], byte 1
279 mov ax,0003h ; Return to normal video mode
281 ; mov dx,TextColorReg ; Restore color registers
284 mov [UsingVGA], byte 0
286 call use_font ; Restore text font/data
287 mov byte [ScrollAttribute], 07h
295 ; vgashowcursor/vgahidecursor:
296 ; If VGA graphics is enabled, draw a cursor/clear a cursor
301 jmp short vgacursorcommon
306 cmp [UsingVGA], byte 1
318 ; Map colors to consecutive DAC registers
319 linear_color db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0
324 GraphXSize resw 1 ; Width of splash screen file
325 VGAPos resw 1 ; Pointer into VGA memory
326 VGACluster resw 1 ; Cluster pointer for VGA image file
327 VGAFilePtr resw 1 ; Pointer into VGAFileBuf
328 TextColorReg resb 17 ; VGA color registers for text mode
330 VGAFileBuf resb FILENAME_MAX+2 ; Unmangled VGA image name
332 VGAFileBuf resb FILENAME_MAX ; Unmangled VGA image name
335 VGAFileMBuf resb FILENAME_MAX ; Mangled VGA image name