Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel 8275 unitialized behaviour not emulated #13188

Open
RetroAND opened this issue Jan 6, 2025 · 19 comments
Open

Intel 8275 unitialized behaviour not emulated #13188

RetroAND opened this issue Jan 6, 2025 · 19 comments

Comments

@RetroAND
Copy link

RetroAND commented Jan 6, 2025

MAME version

mame0272-367-g8907baff125-dirty

System information

Not required for this issue

INI configuration details

No response

Emulated system/software

IBM System/23 Datamaster

Incorrect behaviour

I am writing a driver for the foresaid computer but it gets stuck in a test because the implementation of the Intel 8275 is incomplete. The current behaviour makes the device do nothing. This means that the counters are not enabled and therefore an interrupt cannot be generated.

Expected behaviour

The counters should be running at random timings before the reset command is issued. This way the interrupt would get generated and the test would succeed.

Steps to reproduce

Issue the the enable interrupt command to the CRTC without issuing the reset device command beforehand. Then loop reading the status register of the 8275 until the interrupt request flag is set.

Additional details

This error was found during development of a driver that will be added but the issue is within the libraries of emulated video devices.

@angelosa
Copy link
Member

angelosa commented Jan 7, 2025

As per also reading https://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=124049#Post124049 , the root problem is that screen_device doesn't have a way to define floating beamx / beamy, and, by chain reaction, h/vsync signals. It starts and it never stops unless user hijacks with reset_origin() or other misc hacks like machine/smpc.cpp or snk/hng64_v.cpp

This is obviously a legacy short-sight which roots back to #5801

@RetroAND
Copy link
Author

RetroAND commented Jan 7, 2025

Actually I was able to solve the issue by initializing the internal registers of the 8275 with valid data at device_start.

@angelosa
Copy link
Member

angelosa commented Jan 7, 2025

That's not solving, that's working around the problem :)

@RetroAND
Copy link
Author

RetroAND commented Jan 8, 2025

Unfortunately I am not knowledgeable enough to resolve the root of the issue, do you mind if I PR the modified i8275.cpp in order to make it work?

@pmackinlay
Copy link
Contributor

Given the response prior, that PR will likely not be accepted, however I suggest you keep it as a local workaround in your tree so you can progress on other work until you find a more correct solution.

@startaq
Copy link
Member

startaq commented Jan 8, 2025

I don't think there is anything wrong with the solution, this is independent from any screen_device shenanigans. The chip is powered up with random values and starts counting and this is what the PR would presumably implement.

@RetroAND
Copy link
Author

RetroAND commented Jan 8, 2025

The only difference with the real hardware is that I was told to use valid data instead of random or dummy values. So They passed me an Intel Application Note and extracted the values from there.

@cracyc
Copy link
Member

cracyc commented Jan 8, 2025

I think it's fine as long as it doesn't break anything else.

@RetroAND
Copy link
Author

RetroAND commented Jan 8, 2025

Okay. I will PR it, but the PR includes the unfinished driver. Should I wait until the driver is more complete and cancel the current PR or fix the 8275 asap?

@cuavas
Copy link
Member

cuavas commented Jan 8, 2025

Taking a step back, has anyone else debugged this as a sanity check? It seems rather odd, particularly for sticklers for rules like IBM. Not programming the CRTC before POST is liable to fry the monitor.

@RetroAND
Copy link
Author

RetroAND commented Jan 8, 2025

This computer checks first if the data bus is in conditions (test 00) by writing and reading to a 8255. Then checks the CPU itself and also the state of the SID line (test 01). Then performs CRC checks to the boot ROM (test 02). Test 03 does not exist, as the number is skipped. The first 16KB of RAM are checked in three different ways and an input port is read (test 04). The 8275 is detected by checking its interrupt flag, then the CRT is activated and both 8275 and 8257 are initialized, for some reason after that it seeks for a light pen (all of this test 05). Before test 07 the test number has to be checked with a probe which can be as simple as eight LEDs.

@cuavas
Copy link
Member

cuavas commented Jan 8, 2025

Doesn’t answer the question – has anyone else debugged this as a sanity check?

@angelosa
Copy link
Member

angelosa commented Jan 8, 2025

It's currently in PR #13191 so no most likely.

This computer checks first if the data bus is in conditions (test 00) by writing and reading to a 8255.

Port C by any chance? Perhaps expecting a Power On Reset bit high from there?

@RetroAND
Copy link
Author

RetroAND commented Jan 8, 2025

No, it's port A from the same 8255 that manages the keyboard. No, it does not expect a special bit from there, just reads and wites back from the register. I have seen it being used also in test 05, so I suspect that it also has some video-related usage.

@RetroAND
Copy link
Author

RetroAND commented Jan 9, 2025

Continuing the development of the driver found another issue (not me, but Golden Child at bannister) where GPA0 and GPA1 attributes were lost in certain cases. There may be other issues in the light pen section as well.

As a result I will withdraw my PR until both the component controller and the driver are more mature.

@Robbbert
Copy link
Contributor

Robbbert commented Jan 9, 2025

You probably should either close it, or change to draft, so that someone doesn't accidently commit it.

@RetroAND
Copy link
Author

RetroAND commented Jan 9, 2025

Done

@angelosa
Copy link
Member

angelosa commented Jan 9, 2025

Or, undraft and let other people look at it.
At this point I'm fairly positive there's 1+ core bugs here, not having the SW handy will make them to linger forever unless planet alignment occurs.

@RetroAND
Copy link
Author

RetroAND commented Jan 9, 2025

Or, undraft and let other people look at it. At this point I'm fairly positive there's 1+ core bugs here, not having the SW handy will make them to linger forever unless planet alignment occurs.

Sorry, I closed it before receiving your answer. But if you need to take a look on the code I could always make a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants