added 2 color cga and some pitch fixes
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@124
This commit is contained in:
parent
b73647f308
commit
a17e267b62
1 changed files with 45 additions and 22 deletions
|
@ -23,6 +23,11 @@
|
|||
|
||||
|
||||
/* 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;
|
||||
|
@ -51,11 +56,38 @@ void VGA_Render_TEXT_16(Bit8u * * data) {
|
|||
vga.config.retrace=true;
|
||||
}
|
||||
|
||||
void VGA_DrawGFX2_Full(Bit8u * bitdata,Bitu pitch) {
|
||||
Bit8u * reader=real_host(0xB800,0);
|
||||
Bit8u * draw;
|
||||
for (Bitu y=0;y<vga.draw.height;y++) {
|
||||
Bit8u * tempread;
|
||||
tempread=reader;
|
||||
if (y&1) {
|
||||
tempread+=8*1024;
|
||||
reader+=80;
|
||||
};
|
||||
draw=bitdata;
|
||||
//TODO Look up table like in 4color mode
|
||||
for (Bit32u x=0;x<vga.draw.width>>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 next_line) {
|
||||
//TODO use vga memory handler
|
||||
void VGA_DrawGFX4_Full(Bit8u * bitdata,Bitu pitch) {
|
||||
Bit8u * reader=real_host(0xB800,0);
|
||||
Bit8u * draw;
|
||||
for (Bitu y=0;y<vga.draw.height;y++) {
|
||||
|
@ -68,23 +100,17 @@ void VGA_DrawGFX4_Full(Bit8u * bitdata,Bitu next_line) {
|
|||
draw=bitdata;
|
||||
for (Bit32u x=0;x<vga.draw.width>>2;x++) {
|
||||
Bit8u val=*(tempread++);
|
||||
/*
|
||||
*(draw+0)=(val>>6)&3;
|
||||
*(draw+1)=(val>>4)&3;
|
||||
*(draw+2)=(val>>2)&3;
|
||||
*(draw+3)=(val)&3;
|
||||
draw+=4;
|
||||
*/
|
||||
*(Bit32u *)draw=CGAWriteTable[val];
|
||||
draw+=4;
|
||||
}
|
||||
//TODO use scanline length and dword mode crap
|
||||
bitdata+=next_line;
|
||||
bitdata+=pitch;
|
||||
};
|
||||
vga.config.retrace=true;
|
||||
}
|
||||
|
||||
void VGA_DrawGFX16_Full(Bit8u * bitdata,Bitu next_line) {
|
||||
/* 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<vga.draw.height;y++) {
|
||||
memcpy((void *)bitdata,(void *)reader,vga.draw.width);
|
||||
|
@ -95,11 +121,10 @@ void VGA_DrawGFX16_Full(Bit8u * bitdata,Bitu next_line) {
|
|||
};
|
||||
|
||||
|
||||
/* This Should draw a complete 256 colour screen */
|
||||
|
||||
void VGA_DrawGFX256_Full(Bit8u * bitdata,Bitu next_line) {
|
||||
Bit16u yreader=vga.config.display_start*1;
|
||||
/* Now add pel panning */
|
||||
/* TODO add pel panning */
|
||||
for (Bitu y=0;y<vga.draw.height;y++) {
|
||||
Bit16u xreader=yreader;
|
||||
for (Bitu x=0;x<vga.draw.width>>2;x++) {
|
||||
|
@ -108,27 +133,25 @@ void VGA_DrawGFX256_Full(Bit8u * bitdata,Bitu next_line) {
|
|||
}
|
||||
xreader++;
|
||||
}
|
||||
//TODO use scanline length and dword mode crap
|
||||
yreader+=vga.config.scan_len*2;
|
||||
bitdata+=next_line;
|
||||
};
|
||||
vga.config.retrace=true;
|
||||
};
|
||||
|
||||
void VGA_DrawGFX256_Fast(Bit8u * bitdata,Bitu next_line) {
|
||||
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<vga.draw.height;y++) {
|
||||
memcpy((void *)bitdata,(void *)reader,vga.draw.width);
|
||||
bitdata+=vga.draw.width+next_line;
|
||||
bitdata+=pitch;
|
||||
reader+=vga.draw.width;
|
||||
}
|
||||
//memcpy((void *)bitdata,(void *)(memory+0xa0000),320*200);
|
||||
vga.config.retrace=true;
|
||||
};
|
||||
|
||||
|
||||
void VGA_DrawTEXT(Bit8u * bitdata,Bitu next_line) {
|
||||
void VGA_DrawTEXT(Bit8u * bitdata,Bitu pitch) {
|
||||
Bit8u * reader=real_off(0xB800,0);
|
||||
Bit8u * draw_start=bitdata;;
|
||||
/* Todo Blinking and high intensity colors */
|
||||
|
@ -144,18 +167,18 @@ void VGA_DrawTEXT(Bit8u * bitdata,Bitu next_line) {
|
|||
for (Bitu y=0;y<16;y++) {
|
||||
Bit8u bit_mask=*findex++;
|
||||
#include "font-switch.h"
|
||||
draw+=+next_line;
|
||||
draw+=+pitch;
|
||||
};
|
||||
draw_char+=8;
|
||||
};
|
||||
draw_start+=16*next_line;
|
||||
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)*vga.draw.width+vga.draw.cursor_col*8;
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue