/* * Copyright (C) 2002 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "dosbox.h" #include "video.h" #include "vga.h" /* This Should draw a complete 16 colour screen */ void VGA_Render_GFX_2(Bit8u * * data) { *data=vga.buffer; VGA_DrawGFX2_Full(vga.buffer,vga.draw.width); vga.config.retrace=true; } void VGA_Render_GFX_4(Bit8u * * data) { *data=vga.buffer; VGA_DrawGFX4_Full(vga.buffer,vga.draw.width); vga.config.retrace=true; } void VGA_Render_GFX_16(Bit8u * * data) { *data=&vga.buffer[vga.config.display_start*8+vga.config.pel_panning]; vga.config.retrace=true; } void VGA_Render_GFX_256U(Bit8u * * data) { *data=&vga.mem.linear[vga.config.display_start*4+vga.config.pel_panning]; vga.config.retrace=true; } void VGA_Render_GFX_256C(Bit8u * * data) { *data=memory+0xa0000; vga.config.retrace=true; } void VGA_Render_TEXT_16(Bit8u * * data) { *data=vga.buffer; if (!vga.draw.resizing) VGA_DrawTEXT(vga.buffer,vga.draw.width); vga.config.retrace=true; } void VGA_DrawGFX2_Full(Bit8u * bitdata,Bitu pitch) { Bit8u * reader=HostMake(0xB800,0); Bit8u * draw; for (Bitu y=0;y>3;x++) { Bit8u val=*(tempread++); *(draw+0)=(val>>7)&1; *(draw+1)=(val>>6)&1; *(draw+2)=(val>>5)&1; *(draw+3)=(val>>4)&1; *(draw+4)=(val>>3)&1; *(draw+5)=(val>>2)&1; *(draw+6)=(val>>1)&1; *(draw+7)=(val>>0)&1; draw+=8; } bitdata+=pitch; }; vga.config.retrace=true; } void VGA_DrawGFX4_Full(Bit8u * bitdata,Bitu pitch) { Bit8u * reader=HostMake(0xB800,0); Bit8u * draw; for (Bitu y=0;y>2;x++) { Bit8u val=*(tempread++); *(Bit32u *)draw=CGAWriteTable[val]; draw+=4; } bitdata+=pitch; }; vga.config.retrace=true; } /* Draw the screen using the lookup buffer */ //TODO include split screen or something void VGA_DrawGFX16_Fast(Bit8u * bitdata,Bitu next_line) { Bit8u * reader=&vga.buffer[vga.config.display_start*8+vga.config.pel_panning]; for (Bitu y=0;y>2;x++) { for (Bit32u dx=0;dx<4;dx++) { (*bitdata++)=vga.mem.paged[xreader][dx]; } xreader++; } yreader+=vga.config.scan_len*2; bitdata+=next_line; }; vga.config.retrace=true; }; void VGA_DrawGFX256_Fast(Bit8u * bitdata,Bitu pitch) { /* For now just copy 64 kb of memory with pitch support */ Bit8u * reader=memory+0xa0000; for (Bitu y=0;y> 4); Bit8u * draw=draw_char; for (Bitu y=0;y<16;y++) { Bit8u bit_mask=*findex++; #include "font-switch.h" draw+=pitch; }; draw_char+=8; }; draw_start+=16*pitch; }; vga.config.retrace=true; /* Draw a cursor */ if ((vga.draw.cursor_col*8)>=vga.draw.width) return; if ((vga.draw.cursor_row*16)>=vga.draw.height) return; Bit8u * cursor_draw=bitdata+(vga.draw.cursor_row*16+15)*pitch+vga.draw.cursor_col*8; if (vga.draw.cursor_count>8) { for (Bit8u loop=0;loop<8;loop++) *cursor_draw++=15; } vga.draw.cursor_count++; if (vga.draw.cursor_count>16) vga.draw.cursor_count=0; };