update ArduboyFX library

This commit is contained in:
Mr.Blinky 2022-11-18 17:26:53 +01:00
parent 8d5147ab86
commit bee1697dab
4 changed files with 24 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#pragma once
/**** FX data header generated by fxdata-build.py tool version 1.01 ****/
/**** FX data header generated by fxdata-build.py tool version 1.07 ****/
using uint24_t = __uint24;
@ -10,4 +10,10 @@ constexpr uint16_t FX_DATA_PAGE = 0xff65;
constexpr uint24_t FX_DATA_BYTES = 39470;
constexpr uint24_t mapGfx = 0x000000;
constexpr uint16_t mapGfxWidth = 816;
constexpr uint16_t mapGfxHeight = 368;
constexpr uint24_t whaleGfx = 0x0092A4;
constexpr uint16_t whaleGfxWidth = 107;
constexpr uint16_t whaleGfxHeight = 69;

View File

@ -1,5 +1,5 @@
name=ArduboyFX
version=1.0.3
version=1.0.4
author=Mr.Blinky
maintainer=mstr.blinky@gmail.com
sentence=The Arduboy FX library.

View File

@ -412,6 +412,15 @@ void FX::writeSavePage(uint16_t page, uint8_t* buffer)
disable();
}
void FX::waitWhileBusy()
{
enable();
writeByte(SFC_READSTATUS1);
while(readByte() & 1)
; // wait while BUSY status bit is set
disable();
}
void FX::drawBitmap(int16_t x, int16_t y, uint24_t address, uint8_t frame, uint8_t mode)
{
// read bitmap dimensions from flash
@ -443,7 +452,7 @@ void FX::drawBitmap(int16_t x, int16_t y, uint24_t address, uint8_t frame, uint8
{
skiptop = -y & -8; // optimized -y / 8 * 8
if (height - skiptop <= HEIGHT) renderheight = height - skiptop;
else renderheight = HEIGHT + (y & 7);
else renderheight = HEIGHT + (-y & 7);
skiptop >>= 3;//pixels to displayrows
}
else
@ -504,11 +513,11 @@ void FX::drawBitmap(int16_t x, int16_t y, uint24_t address, uint8_t frame, uint8
" ror %[mode] \n" // carry to mode dbfExtraRow
" \n"
" ldi %[rowmask], 0x02 \n" // rowmask = 0xFF >> (8 - (height & 7));
" sbrc %[height], 1 \n"
" sbrc %[renderheight], 1 \n"
" ldi %[rowmask], 0x08 \n"
" sbrc %[height], 2 \n"
" sbrc %[renderheight], 2 \n"
" swap %[rowmask] \n"
" sbrs %[height], 0 \n"
" sbrs %[renderheight], 0 \n"
" lsr %[rowmask] \n"
" dec %[rowmask] \n"
" breq .+4 \n"

View File

@ -26,7 +26,7 @@ constexpr uint8_t SFC_READSTATUS2 = 0x35;
constexpr uint8_t SFC_READSTATUS3 = 0x15;
constexpr uint8_t SFC_READ = 0x03;
constexpr uint8_t SFC_WRITE_ENABLE = 0x06;
constexpr uint8_t SFC_WRITE = 0x04;
constexpr uint8_t SFC_WRITE = 0x02;
constexpr uint8_t SFC_ERASE = 0x20;
constexpr uint8_t SFC_RELEASE_POWERDOWN = 0xAB;
constexpr uint8_t SFC_POWERDOWN = 0xB9;
@ -255,6 +255,8 @@ class FX
static void writeSavePage(uint16_t page, uint8_t* buffer);
static void waitWhileBusy(); // wait for outstanding erase or write to finish
static void drawBitmap(int16_t x, int16_t y, uint24_t address, uint8_t frame, uint8_t mode) __attribute__((noinline));
static void readDataArray(uint24_t address, uint8_t index, uint8_t offset, uint8_t elementSize, uint8_t* buffer, size_t length);