newbrain: Added character ROM and more accurate video output. [Curt Coder]

This commit is contained in:
Curt Coder 2017-01-08 18:27:40 +02:00
parent 5220572228
commit eee3f456c0
2 changed files with 44 additions and 41 deletions

View file

@ -862,8 +862,8 @@ ROM_START( newbrain )
ROM_REGION( 0x400, COP420_TAG, 0 ) ROM_REGION( 0x400, COP420_TAG, 0 )
ROM_LOAD( "cop420.419", 0x000, 0x400, CRC(a1388ee7) SHA1(5822e16aa794545600bf7a9dbee2ef467ca2a3e0) ) ROM_LOAD( "cop420.419", 0x000, 0x400, CRC(a1388ee7) SHA1(5822e16aa794545600bf7a9dbee2ef467ca2a3e0) )
ROM_REGION( 0x1000, "chargen", ROMREGION_ERASE00 ) ROM_REGION( 0x1000, "chargen", 0 )
ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 bad dump! ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x1000, CRC(6a38b7a2) SHA1(29f3e672fc41792ac2f2b405e571d79235193561) ) // 8248R7
ROM_END ROM_END
@ -887,7 +887,7 @@ ROM_START( newbrainmd )
ROM_LOAD( "cop420.419", 0x000, 0x400, CRC(a1388ee7) SHA1(5822e16aa794545600bf7a9dbee2ef467ca2a3e0) ) ROM_LOAD( "cop420.419", 0x000, 0x400, CRC(a1388ee7) SHA1(5822e16aa794545600bf7a9dbee2ef467ca2a3e0) )
ROM_REGION( 0x1000, "chargen", 0 ) ROM_REGION( 0x1000, "chargen", 0 )
ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x0a01, BAD_DUMP CRC(46ecbc65) SHA1(3fe064d49a4de5e3b7383752e98ad35a674e26dd) ) // 8248R7 ROM_LOAD( "char eprom iss 1.ic453", 0x0000, 0x1000, CRC(6a38b7a2) SHA1(29f3e672fc41792ac2f2b405e571d79235193561) ) // 8248R7
ROM_END ROM_END

View file

@ -1,5 +1,13 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Curt Coder // copyright-holders:Curt Coder
/*
TODO:
- GR is always 0
*/
#include "includes/newbrain.h" #include "includes/newbrain.h"
#include "rendlay.h" #include "rendlay.h"
#include "newbrain.lh" #include "newbrain.lh"
@ -70,72 +78,68 @@ void newbrain_state::screen_update(bitmap_rgb32 &bitmap, const rectangle &clipre
int gr = 0; int gr = 0;
uint16_t videoram_addr = m_tvl; uint16_t videoram_addr = m_tvl;
uint8_t rc = 0; int rc = 0;
uint8_t vsr = 0;
uint8_t grsr = 0;
for (int y = 0; y < 200; y++) for (int y = 0; y < 240; y++) {
{
int x = 0; int x = 0;
for (int sx = 0; sx < columns; sx++) for (int sx = 0; sx < columns; sx++) {
{ uint8_t rd = m_ram->pointer()[(videoram_addr + sx) & 0x7fff];
uint8_t videoram_data = m_ram->pointer()[(videoram_addr + sx) & 0x7fff];
uint8_t charrom_data;
if (gr) bool rc3 = BIT(rc, 3);
{ bool txt = !(BIT(rd, 6) || BIT(rd, 5));
/* render video ram data */ bool txtq = m_ucr || txt;
charrom_data = videoram_data;
int rc_ = rc & 0x07;
if (rc3 && txt) {
rc_ = 7;
} }
else
{ uint16_t charrom_addr = (m_ucr << 11) | (rc_ << 8) | ((BIT(rd, 7) && m_fs) << 7) | (rd & 0x7f);
/* render character rom data */ uint8_t crd = m_char_rom->base()[charrom_addr & 0xfff];
uint16_t charrom_addr = (rc << 8) | ((BIT(videoram_data, 7) && m_fs) << 7) | (videoram_data & 0x7f); bool crd0 = BIT(crd, 0);
charrom_data = m_char_rom->base()[charrom_addr & 0xfff];
if ((videoram_data & 0x80) && !m_fs) bool ldvsr = !(((!rc3 ^ crd0) || gr) || txtq);
{
/* invert character */
charrom_data ^= 0xff;
}
if ((videoram_data & 0x60) && !m_ucr) if (!ldvsr && !gr) {
{ vsr = (crd & 0xfe) | (crd0 && txtq);
/* strip bit D0 */
charrom_data &= 0xfe;
}
} }
for (int bit = 0; bit < 8; bit++) if (!ldvsr && gr) {
{ grsr = rd;
int color = BIT(charrom_data, 7) ^ m_rv; }
for (int i = 0; i < 8; i++) {
uint8_t sr = gr ? grsr : vsr;
int color = BIT(sr, 7) ^ m_rv;
bitmap.pix32(y, x++) = m_palette->pen(color); bitmap.pix32(y, x++) = m_palette->pen(color);
if (columns == 40) if (columns == 40) {
{
bitmap.pix32(y, x++) = m_palette->pen(color); bitmap.pix32(y, x++) = m_palette->pen(color);
} }
charrom_data <<= 1; grsr <<= 1;
vsr <<= 1;
} }
} }
if (gr) if (gr)
{ {
/* get new data for each line */ // get new data for each line
videoram_addr += columns; videoram_addr += columns;
videoram_addr += excess; videoram_addr += excess;
} }
else else
{ {
/* increase row counter */
rc++; rc++;
if (rc == (m_ucr ? 8 : 10)) if (rc == (m_ucr ? 8 : 10)) {
{
/* reset row counter */
rc = 0; rc = 0;
// get new data after each character row
videoram_addr += columns; videoram_addr += columns;
videoram_addr += excess; videoram_addr += excess;
} }
@ -183,7 +187,6 @@ MACHINE_CONFIG_FRAGMENT( newbrain_video )
MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green()) MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::green())
MCFG_SCREEN_UPDATE_DRIVER(newbrain_state, screen_update) MCFG_SCREEN_UPDATE_DRIVER(newbrain_state, screen_update)
MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(640, 250) MCFG_SCREEN_SIZE(640, 250)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249) MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)