1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
byte readVRAMdirect(VGA_Type *VGA, uint_32 start, uint_32 offset) //Used in 256 color mode!
{
if (!VGA->VRAM_size) return 0; //No size!
return VGA->VRAM[SAFEMOD((start*4)+offset,VGA->VRAM_size)]; //The full protected offset!
}
void writeVRAMdirect(VGA_Type *VGA, uint_32 start, uint_32 offset, byte value) //See readVRAMdirect above!
{
if (!VGA->VRAM_size) return; //No size!
VGA->VRAM[SAFEMOD((start*4)+offset,VGA->VRAM_size)] = value; //Write with overflow protection!
}
byte readVRAMplane(VGA_Type *VGA, uint_32 start, byte plane, uint_32 offset) //Read from a VRAM plane!
{
uint_32 fulloffset = SAFEMOD(start+(offset*4)+(3-plane),VGA->VRAM_size); //Full offset!
return VGA->VRAM[fulloffset];
}
void writeVRAMplane(VGA_Type *VGA, uint_32 start, byte plane, uint_32 offset, byte value) //Write to a VRAM plane!
{
uint_32 fulloffset = SAFEMOD(start+(offset*4)+(3-plane),VGA->VRAM_size); //Full offset!
VGA->VRAM[fulloffset] = value;
}
byte getBitPlaneBit(VGA_Type *VGA, uint_32 start, int plane, uint_32 offset, byte bit)
{
return GETBIT(readVRAMplane(VGA,start,plane,offset),bit); //Give the bit!
}
void setBitPlaneBit(VGA_Type *VGA, uint_32 start, int plane, uint_32 offset, byte bit, byte on)
{
writeVRAMplane(VGA,start,plane,offset,BITON(SETBIT0(readVRAMplane(VGA,start,plane,offset),bit),(on<<bit))); //Set the bit!
}
|