Tilemap colors are now being properly assigned. Still doesn't work.

This commit is contained in:
Scott Duensing 2024-01-15 16:53:33 -06:00
parent 86f4063006
commit fbefb2b551
3 changed files with 39 additions and 9 deletions

View file

@ -32,20 +32,20 @@
int main(void) {
byte x;
byte r;
byte g;
byte b;
byte *c;
byte x;
byte r;
byte g;
byte b;
uint32_t c;
f256Init();
// Set up CLUT0.
c = (byte *)TILES_CLUT;
c = TILES_CLUT;
for (x=0; x<16; x++) {
b = *c++;
g = *c++;
r = *c++;
b = FAR_PEEK(c++);
g = FAR_PEEK(c++);
r = FAR_PEEK(c++);
c++;
graphicsDefineColor(0, x, r, g, b);
}

View file

@ -63,3 +63,32 @@ void f256Init(void) {
randomSeed(0); //***TODO*** Use clock or something.
}
byte FAR_PEEK(uint32_t address) {
byte block;
byte mmu;
byte ram;
byte result;
// Hoping the compiler optimizes this out when not needed. :-)
if (SWAP_SLOT == MMU_MEM_BANK_6) {
mmu = PEEK(MMU_IO_CTRL); // Get current MMU state.
ram = PEEK(MMU_MEM_BANK_6); // Get current slot 6 contents.
asm("sei");
POKE(MMU_IO_CTRL, 4); // Turn off I/O window.
}
block = address / EIGHTK;
address &= 0x1FFF; // Find offset into this block.
POKE(SWAP_SLOT, block);
result = PEEK(SWAP_ADDR + address);
if (SWAP_SLOT == MMU_MEM_BANK_6) {
POKE(MMU_MEM_BANK_6, ram); // Restore slot 6.
POKE(MMU_IO_CTRL, mmu); // Restore MMU state.
asm("cli");
}
return result;
}

View file

@ -102,6 +102,7 @@ typedef struct colorS {
void f256Init(void);
byte FAR_PEEK(uint32_t address);
#include "kernel.h"