maxY = 16;
maxY = 32;
void TileViewer::render(){  u16 *palette = (u16 *)paletteRAM;  u8 *charBase = &vram[this->charBase * 0x4000];   int maxY;  if(is256Colors) {    int tile = 0;    maxY = 16;    if(this->charBase == 3)      maxY = 8;    for(int y = 0; y < maxY; y++) {      for(int x = 0; x < 32; x++) {        if(this->charBase == 4)          renderTile256(tile, x, y, charBase, &palette[256]);        else          renderTile256(tile, x, y, charBase, palette);        tile += 2;      }    }    tileView.setSize(32*8, maxY*8);    w = 32*8;    h = maxY*8;    tileView.SetScrollSize(32*8, maxY*8);    if(tileView.getStretch())      tileView.SetScrollSize(1,1);  } else {    int tile = 0;    maxY = 32;    if(this->charBase == 3)      maxY = 16;    for(int y = 0; y < maxY; y++) {      for(int x = 0; x < 32; x++) {        renderTile16(tile, x, y, charBase, palette);            tile++;      }    }        tileView.setSize(32*8, maxY*8);    w = 32*8;    h = maxY*8;    tileView.SetScrollSize(32*8, maxY*8);    if(tileView.getStretch())      tileView.SetScrollSize(1,1);  }}