Skip to content

Commit

Permalink
Merge pull request #5494 from maron2000/fix_pc98ttf
Browse files Browse the repository at this point in the history
Fix blank screen when output=ttf on PC-98 mode
  • Loading branch information
joncampbell123 authored Feb 15, 2025
2 parents 2b73929 + 3536a78 commit 6210372
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
33 changes: 25 additions & 8 deletions src/ints/bios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3819,15 +3819,13 @@ static Bitu INT18_PC98_Handler(void) {
}
#endif
#if defined(USE_TTF)
if(ttf.inUse)
ttf_reset();
else {
if(!finish_prepare){
conf_output= static_cast<Section_prop*>(control->GetSection("sdl"))->Get_string("output");
if(!finish_prepare && conf_output == "ttf") { // Workaround for blank BIOS screen in TTF mode
toOutput("surface");
toOutput("ttf");
ttf_switch_off(true);
if(conf_output == "ttf") { // BIOS screen does not like TTF mode, switch it on later
toOutput("ttf");
ttf_switch_off(true);
is_ttfswitched_on = true;
//LOG_MSG("TTF output is temporary switched off");
}
}
#endif
Expand Down Expand Up @@ -10907,7 +10905,26 @@ class BIOS:public Module_base{
reg_edx = 0x0000; // byte position
CALLBACK_RunRealInt(0x18);

bios_pc98_posx = x;
bios_pc98_posx = x;

reg_eax = 0x4200; // setup 640x400 graphics
reg_ecx = 0xC000;
CALLBACK_RunRealInt(0x18);

IO_Write(0x6A, 0x01); // enable 16-color analog mode (this makes the 4th bitplane appear)
IO_Write(0x6A, 0x04); // but we don't need the EGC graphics
IO_Write(0xA4, 0x00); // display page 0
IO_Write(0xA6, 0x00); // write to page 0

// setup palette for TTF mode
for(unsigned int i = 0; i < 16; i++) {
unsigned int bias = (i & 8) ? 0x5 : 0x0;

IO_Write(0xA8, i); // DAC index
IO_Write(0xAA, ((i & 2) ? 0xA : 0x0) + bias); // green
IO_Write(0xAC, ((i & 4) ? 0xA : 0x0) + bias); // red
IO_Write(0xAE, ((i & 1) ? 0xA : 0x0) + bias); // blue
}
}
else {
reg_eax = 3; // 80x25 text
Expand Down
3 changes: 2 additions & 1 deletion src/shell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern const char* RunningProgram;
extern int enablelfn, msgcodepage, lastmsgcp;
extern uint16_t countryNo;
extern unsigned int dosbox_shell_env_size;
extern bool is_ttfswitched_on;
bool outcon = true, usecon = true, pipetmpdev = true;
bool shellrun = false, prepared = false, testerr = false;

Expand Down Expand Up @@ -830,7 +831,7 @@ bool finish_prepare = false;
void DOS_Shell::Prepare(void) {
if (this == first_shell) {
#if defined(USE_TTF)
if(CurMode->type == M_TEXT) ttf_switch_on(true); // Initialization completed, M_TEXT modes can switch to TTF mode from now on.
if(CurMode->type == M_TEXT || (IS_PC98_ARCH && is_ttfswitched_on)) ttf_switch_on(true); // Initialization completed, M_TEXT modes can switch to TTF mode from now on.
if(ttf.inUse) {
int cols = static_cast<Section_prop*>(control->GetSection("ttf"))->Get_int("cols");
int lins = static_cast<Section_prop*>(control->GetSection("ttf"))->Get_int("lins");
Expand Down

0 comments on commit 6210372

Please sign in to comment.