skiselev / 8088_bios

BIOS for Intel 8088 based computers
GNU General Public License v3.0
515 stars 61 forks source link

apps dont see cmos chip #16

Closed nekochan777 closed 2 years ago

nekochan777 commented 2 years ago

me again ! i hope im not getting too annoying yet. i noticed some odd behavior of "diagnostic" software. for some reason programs like "checkit" and others when i try to do tests refuse to check cmos and clock. some just dont let me do those tests others show messages about "you dont have cmos clock" BUT I HAVE ! i can see time counting properly and i can see content of chip at ports 70/71 normally. is it some well known issue or actually real bug ? at first i was thinking maybe it is some sort of hardware issue so i add logging to dosbox and see what checkit does and it dont do anything odd. address port (0x70) is write only and data port (0x71) some read and some write access. so they dont do anything not implemented at board level (like maybe reading 0x70 or something). it is not issue of clock chip itself since i have another board (factory made SBC board) with socketed cmos chip and i can put my chip there and at that board checkit does see that same chip. so i put scope on one shot waiting mode to address strobe signal or data port read access for cmos chip and did few runs of checkit. it dont even try to access hardware. so for some reason checkit decide there is no cmos chip here and dont even try to access it. maybe some bits in bios data area should be set to indicate presence of cmos clock ? if its actually bug i can investigate further and report about my research ^_^

skiselev commented 2 years ago

RTC is implemented correctly and works properly. The implementation closely follows that of IBM AT - so yes, port 70h for selecting RTC address, and port 71h for reading or writing the RTC data. Since your system shows correct date and time, and keeps time while it is powered off, I wouldn't be concerned :)

It is quite possible that diagnostics software decides whether system has an RTC or not purely based on the system or processor type. For example, it might assume that only AT or PS/2 systems will have an RTC, and 8088-based PC/XT will not have it. If anything, it is a bug in that software ;)

nekochan777 commented 2 years ago

i got some news. it indeed looks like bad programing in that old diagnostics software, but there is still other possibility of what might be wrong. so what i did: i put Xi8088 bios in dosbox and did full cold boot process. it wasnt actually too hard its just some small fixes in dosbox code was needed because it looks like no one was thinking about doing cold boot there and they didnt implement some necessary features. here is video of boot process https://www.youtube.com/watch?v=pyoUddRdhKM Xi bios pretty almost original binary except here that kbc_init bitten me again since dosbox dont emulate 100% keyboard init process original binary would stuck halt at kbc_init, but i still got that experimental one i did for start without kbc. result: with dosbox emulated hardware and Xi8088 checkit now does see RTC clock chip! so it might be just very bad programming which just assumes 8086 cant have clock, and 486 always have clock, but there is still other possibility of maybe there is some obscure configuration bit or flag somewhere to indicate presence of clock chip, but it doesnt matter for newer processors since anything newer than 286 assumed to mandatory have clock. so im still not sure about answer to that question. gonna continue research

nekochan777 commented 2 years ago

i got some news on issue. was able to confirm key factor is indeed cpu type. if i alter emulation behavior in dosbox by altering cpu flags emulation to trick cpu detection routine into thinking cpu is 8086 or 80286 i indeed see cmos clock magically appear and disappear in "system configuration" section. so its indeed very bad code judging presence of clock by cpu detection in dos diagnostics apps. there is still possibility of some additional checks and flags which can indicate presence of clock even in 8086, but ignored for more recent processors, but i have no idea how to verify this possibility. it would require at least one known pc with 8086 and correctly detected clock. this seems like unsolvable task so i guess this issue couldnt be solved :( sadly