Had to remove the CBM font.

This commit is contained in:
Stephen White 2018-05-21 19:12:59 +10:00
parent 6dc9452b2a
commit c94ce4c519
6 changed files with 76 additions and 11 deletions

View file

@ -746,7 +746,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
char name[17] = { 0 };
unsigned char buffer[260] = { 0 };
int charIndex;
u32 fontHeight = screen.GetCBMFontHeight();
u32 x = 0;
u32 y = 0;
char bufferOut[128] = { 0 };
@ -799,7 +799,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
x += 8;
bits <<= 1;
}
y += 8;
y += fontHeight;
}
for (; bamTrack < lastTrackUsed; ++bamTrack)
{
@ -810,7 +810,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
screen.PrintText(true, x, y, bufferOut, usedColour, bgColour);
x += 8;
}
y += 8;
y += fontHeight;
}
x = 0;
y = 0;
@ -820,7 +820,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
snprintf(bufferOut, 128, "\"%s\" %c%c%c%c%c%c", name, buffer[162], buffer[163], buffer[164], buffer[165], buffer[166], buffer[167]);
screen.PrintText(true, x, y, bufferOut, bgColour, textColour);
x = 0;
y += 8;
y += fontHeight;
if (track != 0)
{
@ -879,7 +879,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
modifier = screen2petscii(60);
snprintf(bufferOut, 128, "%s%c", fileTypes[fileType & 7], modifier);
screen.PrintText(true, x, y, bufferOut, textColour, bgColour);
y += 8;
y += fontHeight;
}
entryOffset += 32;
}
@ -895,7 +895,7 @@ void FileBrowser::DisplayDiskInfo(DiskImage* diskImage, const char* filenameForI
//DEBUG_LOG("%d blocks free\r\n", blocksFree);
snprintf(bufferOut, 128, "%d BLOCKS FREE.\r\n", blocksFree);
screen.PrintText(true, x, y, bufferOut, textColour, bgColour);
y += 8;
y += fontHeight;
}
DisplayStatusBar();

View file

@ -17,7 +17,6 @@
// along with Pi1541. If not, see <http://www.gnu.org/licenses/>.
#include "Screen.h"
#include "CBMFont.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -35,6 +34,8 @@ extern "C"
extern u32 RPi_CpuId;
extern unsigned char* CBMFont;
static const int BitFontHt = 16;
static const int BitFontWth = 8;
@ -182,20 +183,41 @@ void Screen::Clear(RGBA colour)
ClearArea(0, 0, width, height, colour);
}
u32 Screen::GetCBMFontHeight()
{
if (CBMFont)
return 8;
else
return BitFontHt;
}
static char vga2screen(char c)
{
if ((u8)c == 160)
c = ' ';
else if ((u8)c == 209)
c = 'X';
else if ((u8)c == 215)
c = 'O';
return c;
}
void Screen::WriteChar(bool petscii, u32 x, u32 y, unsigned char c, RGBA colour)
{
if (opened)
{
u32 fontHeight;
const unsigned char* fontBitMap;
if (petscii)
if (petscii && CBMFont)
{
fontBitMap = CMBFont;
fontBitMap = CBMFont;
fontHeight = 8;
c = petscii2screen(c);
}
else
{
if (petscii)
c = vga2screen(c);
fontBitMap = avpriv_vga16_font;
fontHeight = BitFontHt;
}
@ -261,7 +283,7 @@ u32 Screen::PrintText(bool petscii, u32 x, u32 y, char *ptr, RGBA TxtColour, RGB
int len = 0;
u32 fontHeight;
if (petscii) fontHeight = 8;
if (petscii && CBMFont) fontHeight = 8;
else fontHeight = BitFontHt;
if (width) *width = 0;

View file

@ -64,6 +64,8 @@ public:
u32 Width() const { return width; }
u32 Height() const { return height; }
u32 GetCBMFontHeight();
private:
typedef void (Screen::*PlotPixelFunction)(u32 pixel_offset, RGBA Colour);

View file

@ -73,6 +73,10 @@ const long int tempBufferSize = 1024;
char tempBuffer[tempBufferSize];
ROMs roms;
const long int CBMFont_size = 4096;
unsigned char CBMFontData[4096];
unsigned char* CBMFont = 0;
//u8 s_u8Memory[0x800];
u8 s_u8Memory[0xc000];
@ -921,6 +925,7 @@ static void LoadOptions()
u32 widthScreen = screen.Width();
u32 heightScreen = screen.Height();
u32 xpos, ypos;
const char* ROMName;
res = f_open(&fp, "options.txt", FA_READ);
if (res == FR_OK)
@ -957,13 +962,42 @@ static void LoadOptions()
if (!splitIECLines)
invertIECInputs = false;
ROMName = options.GetRomFontName();
if (ROMName)
{
//DEBUG_LOG("%d Rom Name = %s\r\n", ROMIndex, ROMName);
res = f_open(&fp, ROMName, FA_READ);
if (res == FR_OK)
{
u32 bytesRead;
screen.Clear(COLOUR_BLACK);
snprintf(tempBuffer, tempBufferSize, "Loading ROM %s\r\n", ROMName);
screen.MeasureText(false, tempBuffer, &widthText, &heightText);
xpos = (widthScreen - widthText) >> 1;
ypos = (heightScreen - heightText) >> 1;
screen.PrintText(false, xpos, ypos, tempBuffer, COLOUR_WHITE, COLOUR_RED);
SetACTLed(true);
res = f_read(&fp, CBMFontData, CBMFont_size, &bytesRead);
SetACTLed(false);
f_close(&fp);
if (res == FR_OK && bytesRead == CBMFont_size)
{
CBMFont = CBMFontData;
}
//DEBUG_LOG("Read ROM %s from options\r\n", ROMName);
}
}
int ROMIndex;
for (ROMIndex = ROMs::MAX_ROMS - 1; ROMIndex >= 0; --ROMIndex)
{
roms.ROMValid[ROMIndex] = false;
const char* ROMName = options.GetRomName(ROMIndex);
if (ROMName[ROMIndex])
if (ROMName[0])
{
//DEBUG_LOG("%d Rom Name = %s\r\n", ROMIndex, ROMName);
res = f_open(&fp, ROMName, FA_READ);

View file

@ -131,6 +131,7 @@ Options::Options(void)
, invertIECInputs(0)
, splitIECLines(0)
{
strcpy(ROMFontName, "chargen");
ROMName[0] = 0;
ROMNameSlot2[0] = 0;
ROMNameSlot3[0] = 0;
@ -217,6 +218,10 @@ void Options::Process(char* buffer)
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
splitIECLines = nValue;
}
else if ((strcasecmp(pOption, "Font") == 0))
{
strncpy(ROMFontName, pValue, 255);
}
else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0))
{
strncpy(ROMName, pValue, 255);

View file

@ -46,6 +46,7 @@ public:
unsigned int GetDeviceID() const { return deviceID; }
unsigned int GetOnResetChangeToStartingFolder() const { return onResetChangeToStartingFolder; }
const char* GetRomFontName() const { return ROMFontName; }
const char* GetRomName(int index) const;
unsigned int GetExtraRAM() const { return extraRAM; }
unsigned int GetDisableSD2IECCommands() const { return disableSD2IECCommands; }
@ -73,6 +74,7 @@ private:
unsigned int invertIECInputs;
unsigned int splitIECLines;
char ROMFontName[256];
char ROMName[256];
char ROMNameSlot2[256];
char ROMNameSlot3[256];