diff --git a/f256lib/bitmap.c b/f256lib/bitmap.c index 7219c90..040dd10 100644 --- a/f256lib/bitmap.c +++ b/f256lib/bitmap.c @@ -36,8 +36,9 @@ static byte _BITMAP_CLUT[3]; static byte _color; static byte _active; // Current drawing page. +#define bitmapPutPixelIOSet(x, y) FAR_POKE((_BITMAP_BASE[_active] + mathUnsignedAddition(mathUnsignedMultiply(y, _MAX_X), (int32_t)x)), _color) -static void bitmapPutPixelIOSet(uint16_t x, uint16_t y); +//static void bitmapPutPixelIOSet(uint16_t x, uint16_t y); void bitmapClear(void) { @@ -143,6 +144,7 @@ void bitmapPutPixel(uint16_t x, uint16_t y) { } +/* // This does the actual pixel setting but depends on the I/O being umapped. static void bitmapPutPixelIOSet(uint16_t x, uint16_t y) { uint32_t pixelRAM; @@ -154,6 +156,7 @@ static void bitmapPutPixelIOSet(uint16_t x, uint16_t y) { POKE(SWAP_SLOT, block); POKE(SWAP_ADDR + pixelRAM, _color); } +*/ void bitmapReset(void) { diff --git a/f256lib/f256.c b/f256lib/f256.c index d54e445..8a8c0b5 100644 --- a/f256lib/f256.c +++ b/f256lib/f256.c @@ -81,3 +81,18 @@ byte FAR_PEEK(uint32_t address) { return result; } + + + +void FAR_POKE(uint32_t address, byte value) { + byte block; + + SWAP_IO_SETUP(); + + block = address / EIGHTK; + address &= 0x1FFF; // Find offset into this block. + POKE(SWAP_SLOT, block); + POKE(SWAP_ADDR + address, value); + + SWAP_IO_SHUTDOWN(); +} diff --git a/f256lib/f256.h b/f256lib/f256.h index b38e60b..4784441 100644 --- a/f256lib/f256.h +++ b/f256lib/f256.h @@ -58,7 +58,7 @@ typedef unsigned char bool; // Our stuff. #define SWAP_SLOT MMU_MEM_BANK_5 -#define SWAP_ADDR ((SWAP_SLOT - MMU_MEM_BANK_0) * 0x2000) +#define SWAP_ADDR ((uint16_t)(SWAP_SLOT - MMU_MEM_BANK_0) * (uint16_t)0x2000) // This is an attempt to allow us to free up slot 5 and use slot 6 for paging // RAM in and out. Currently, it does not work. @@ -145,6 +145,7 @@ typedef struct colorS { void f256Init(void); byte FAR_PEEK(uint32_t address); +void FAR_POKE(uint32_t address, byte value); #include "kernel.h"