marioballano / emudore

emudore, a Commodore 64 emulator
Apache License 2.0
303 stars 21 forks source link

38/40 col mode fix #6

Closed xlar54 closed 6 years ago

xlar54 commented 6 years ago

Control register 53270, bit 3 handles 38 or 40 column mode. POKE53270,0 should make it go 38 column and POKE53270,8 should return to normal.

Here's a patch you can apply to provide this function:

`void Vic::draw_raster_char_mode() { int rstr = raster_counter(); int y = rstr - kFirstVisibleLine; if((rstr >= kGFirstLine) && (rstr < kGLastLine) && !is_screen_off()) { / draw background / if(!ISSETBIT(cr2,3)) // 38 columns io_->screen_drawrect(kGFirstCol+8,y,kGResX-16,bgcolor[0]); else io_->screen_drawrect(kGFirstCol,y,kGResX,bgcolor[0]);

/* draw characters */
for(int column=0; column < kGCols ; column++)
{
  if(!ISSET_BIT(cr2_,3)) // 38 columns
  {
if(column == 0) continue;
if(column == kGCols-1) continue;
  }

  int x = kGFirstCol + column * 8;
  int line = rstr - kGFirstLine;
  int row = line/8;
  int char_row = line % 8;
  /* retrieve screen character */
  uint8_t c = get_screen_char(column,row);
  /* retrieve character bitmap data */
  uint8_t data = get_char_data(c,char_row);
  /* retrieve color data */
  uint8_t color  = get_char_color(column,row);
  /* draw character */
  if(graphic_mode_ == kMCCharMode && ISSET_BIT(color,3))
    draw_mcchar(x,y,data,(color&0x7));
  else
    draw_char(x,y,data,color);
}

} } `

marioballano commented 6 years ago

thanks for pointing this out Scott!, I just applied your patch and tested and it does indeed seem to work fine :D

xlar54 commented 6 years ago

No problem. Im running a bunch of test programs through the operating system and as I run into more patches, Ill send them your way.

Sent from Mail for Windows 10

From: Mario Ballano Sent: Monday, November 20, 2017 6:17 PM To: marioballano/emudore Cc: Scott Hutter; Author Subject: Re: [marioballano/emudore] 38/40 col mode fix (#6)

thanks for pointing this out Scott!, I just applied your patch and tested and it does indeed seem to work fine :D — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.