--- np2/bios/bios.c 2004/06/18 07:42:13 1.68 +++ np2/bios/bios.c 2007/11/11 13:54:14 1.77 @@ -56,7 +56,7 @@ const IODATA *pterm; gdc_biosreset(); p = iodata; - pterm = iodata + (sizeof(iodata) / sizeof(IODATA)); + pterm = iodata + NELEMENTS(iodata); while(p < pterm) { iocore_out8(p->port, p->data); p++; @@ -82,12 +82,13 @@ static void bios_memclear(void) { static void bios_reinitbyswitch(void) { - BYTE prxcrt; - BYTE prxdupd; - BYTE biosflag; + UINT8 prxcrt; + UINT8 prxdupd; + UINT8 biosflag; + UINT8 extmem; UINT8 boot; - if (!(np2cfg.dipsw[2] & 0x80)) { + if (!(pccore.dipsw[2] & 0x80)) { #if defined(CPUCORE_IA32) mem[MEMB_SYS_TYPE] = 0x03; // 80386〜 #else @@ -100,13 +101,13 @@ static void bios_reinitbyswitch(void) { mem[MEMB_BIOS_FLAG0] = 0x01; prxcrt = 0x08; - if (!(np2cfg.dipsw[0] & 0x01)) { // dipsw1-1 on + if (!(pccore.dipsw[0] & 0x01)) { // dipsw1-1 on prxcrt |= 0x40; } if (gdc.display & (1 << GDCDISP_ANALOG)) { prxcrt |= 0x04; // color16 } - if (!(np2cfg.dipsw[0] & 0x80)) { // dipsw1-8 on + if (!(pccore.dipsw[0] & 0x80)) { // dipsw1-8 on prxcrt |= 0x01; } if (grcg.chip) { @@ -118,7 +119,7 @@ static void bios_reinitbyswitch(void) { if (grcg.chip >= 3) { prxdupd |= 0x40; } - if (!(np2cfg.dipsw[1] & 0x80)) { // dipsw2-8 on + if (!(pccore.dipsw[1] & 0x80)) { // dipsw2-8 on prxdupd |= 0x20; } mem[MEMB_PRXDUPD] = prxdupd; @@ -128,11 +129,16 @@ static void bios_reinitbyswitch(void) { biosflag |= 0x80; } biosflag |= mem[0xa3fea] & 7; - if (np2cfg.dipsw[2] & 0x80) { + if (pccore.dipsw[2] & 0x80) { biosflag |= 0x40; } mem[MEMB_BIOS_FLAG1] = biosflag; - mem[MEMB_EXPMMSZ] = (BYTE)(pccore.extmem << 3); + extmem = pccore.extmem; + extmem = min(extmem, 14); + mem[MEMB_EXPMMSZ] = (UINT8)(extmem << 3); + if (pccore.extmem >= 15) { + mem[0x0594] = pccore.extmem - 15; + } mem[MEMB_CRT_RASTER] = 0x0f; // FDD initialize @@ -151,9 +157,10 @@ static void bios_reinitbyswitch(void) { mem[MEMB_F2DD_MODE] = 0xff; #if defined(SUPPORT_CRT31KHZ) - mem[MEMB_CRT_BIOS] = 0x80; + mem[MEMB_CRT_BIOS] |= 0x80; #endif #if defined(SUPPORT_PC9821) + mem[MEMB_CRT_BIOS] |= 0x04; // 05/02/03 mem[0x45c] = 0x40; #endif @@ -186,23 +193,38 @@ static void bios_screeninit(void) { REG8 al; al = 4; - al += (np2cfg.dipsw[1] & 0x04) >> 1; - al += (np2cfg.dipsw[1] & 0x08) >> 3; + al += (pccore.dipsw[1] & 0x04) >> 1; + al += (pccore.dipsw[1] & 0x08) >> 3; bios0x18_0a(al); } +static void setbiosseed(UINT8 *ptr, UINT size, UINT seedpos) { + + UINT8 x; + UINT8 y; + UINT i; + + x = 0; + y = 0; + for (i=0; i