From 4eebc6c7f6e391f3325cc978050053ec3e5795b3 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Sun, 11 Sep 2005 13:04:21 +0000 Subject: [PATCH] add patch 1240134 from cyberwalker. (initialize some registers). Report a periodic interrupt occured when the timer is active and one occurs(status reg 0xC). Fixes contraption Zack and friends Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2307 --- src/hardware/cmos.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/hardware/cmos.cpp b/src/hardware/cmos.cpp index c7ade821..3ee978ef 100644 --- a/src/hardware/cmos.cpp +++ b/src/hardware/cmos.cpp @@ -46,7 +46,10 @@ static struct { static void cmos_timerevent(Bitu val) { PIC_ActivateIRQ(8); - if (cmos.timer.enabled) PIC_AddEvent(cmos_timerevent,cmos.timer.delay); + if (cmos.timer.enabled) { + PIC_AddEvent(cmos_timerevent,cmos.timer.delay); + cmos.regs[0xc] = 0xC0;//Contraption Zack (music) + } } static void cmos_checktimer(void) { @@ -94,6 +97,9 @@ static void cmos_writereg(Bitu port,Bitu val,Bitu iolen) { if (val&0x10) LOG(LOG_BIOS,LOG_ERROR)("CMOS:Updated ended interrupt not supported yet"); cmos_checktimer(); break; + case 0x0d:/* Status reg D */ + cmos.regs[cmos.reg]=val & 0x80; /*Bit 7=1:RTC Pown on*/ + break; case 0x0f: /* Shutdown status byte */ cmos.regs[cmos.reg]=val & 0x7f; break; @@ -115,7 +121,6 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) { Bit8u hdparm; time_t curtime; struct tm *loctime; - /* Get the current time. */ curtime = time (NULL); @@ -143,7 +148,7 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) { case 0x03: /* Minutes Alarm */ case 0x05: /* Hours Alarm */ return cmos.regs[cmos.reg]; - case 0x0a: /* Status register C */ + case 0x0a: /* Status register A */ if (PIC_TickIndex()<0.002) { return (cmos.regs[0x0a]&0x7f) | 0x80; } else { @@ -249,21 +254,24 @@ static Bitu cmos_readreg(Bitu port,Bitu iolen) { case 0x0b: /* Status register B */ + case 0x0d: /* Status register D */ case 0x0f: /* Shutdown status byte */ + case 0x14: /* Equipment */ + case 0x15: /* Base Memory KB Low Byte */ + case 0x16: /* Base Memory KB High Byte */ case 0x17: /* Extended memory in KB Low Byte */ case 0x18: /* Extended memory in KB High Byte */ case 0x30: /* Extended memory in KB Low Byte */ case 0x31: /* Extended memory in KB High Byte */ -// LOG(LOG_BIOS,LOG_NORMAL)("CMOS:Read from reg %F : %04X",cmos.reg,cmos.regs[cmos.reg]); +// LOG(LOG_BIOS,LOG_NORMAL)("CMOS:Read from reg %X : %04X",cmos.reg,cmos.regs[cmos.reg]); return cmos.regs[cmos.reg]; default: - LOG(LOG_BIOS,LOG_NORMAL)("CMOS:Read from reg %F",cmos.reg); + LOG(LOG_BIOS,LOG_NORMAL)("CMOS:Read from reg %X",cmos.reg); return cmos.regs[cmos.reg]; } } -void CMOS_SetRegister(Bitu regNr, Bit8u val) -{ +void CMOS_SetRegister(Bitu regNr, Bit8u val) { cmos.regs[regNr] = val; }; @@ -282,6 +290,12 @@ public: cmos_writereg(0x71,0x26,1); cmos.reg=0xb; cmos_writereg(0x71,0x2,1); //Struct tm *loctime is of 24 hour format, + cmos.reg=0xd; + cmos_writereg(0x71,0x80,1); /* RTC power on */ + // Equipment is updated from bios.cpp and bios_disk.cpp + /* Fill in base memory size, it is 640K always */ + cmos.regs[0x15]=(Bit8u)0x80; + cmos.regs[0x16]=(Bit8u)0x02; /* Fill in extended memory size */ Bitu exsize=(MEM_TotalPages()*4)-1024; cmos.regs[0x17]=(Bit8u)exsize;