Previous Thread
Next Thread
Print Thread
Page 3 of 4 1 2 3 4
Vas Crabb #113628 06/29/18 11:39 AM
Joined: Apr 2012
Posts: 344
Likes: 63
Pernod Offline OP
Senior Member
OP Offline
Senior Member
Joined: Apr 2012
Posts: 344
Likes: 63
Originally Posted by Vas Crabb
If you've got horizontal resolution changes within a line, you need to render at lowest common multiple. A per-pixel timer would kill performance.
I now think a per-pixel timer would be overkill. The CRTC registers are defined in characters, so a per-character timer should be sufficient. Typical values would be 128 horizontal characters of which 80 are displayed. Would this appease your performance concerns?

Originally Posted by Vas Crabb
If you need to render per-pixel, you'd be better off making the video chip implement device_execute_interface and letting the scheduler deal with it.
If I need to take this option could you elaborate on what it would involve, any examples of it's usage?

I'd prefer to implement something like MC6845_UPDATE_CHAR that enhances the use of the 6845, but doesn't affect machines using MC6845_UPDATE_ROW that don't make changes during scanline.

Last edited by Pernod; 06/29/18 11:41 AM.

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Pernod #113629 06/29/18 02:10 PM
Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
I still think a timer per character cell is going to be a lot of overhead. All the CPUs and various other things like the POKEY sound chip implement device_execute_interface. If you go this way, you can cause synchronisation when things actually change rather than running a pessimistic timer.

Alternatively you could use a timer that triggers at the end of a scanline, but trigger partial updates when something happens that affects rendering. You can check the time in the current executable device's domain at the point where you get a register change etc. to work out how far through the line you are. This would work well enough if only a single executable device (e.g. CPU) can cause register changes,

Pernod #114389 12/03/18 08:11 PM
Joined: Apr 2012
Posts: 344
Likes: 63
Pernod Offline OP
Senior Member
OP Offline
Senior Member
Joined: Apr 2012
Posts: 344
Likes: 63
Can someone explain what screen->update_partial(vpos) actual does, and when/how it should be used?


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Pernod #114390 12/03/18 08:15 PM
Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
update_partial() draws the screen until the specified vertical position. You use it when video parameters change (e.g. on systems that can rewrite the palette per-line or something of that nature).

Pernod #114396 12/04/18 10:54 PM
Joined: Apr 2012
Posts: 344
Likes: 63
Pernod Offline OP
Senior Member
OP Offline
Senior Member
Joined: Apr 2012
Posts: 344
Likes: 63
I simply don't have the understanding of the video hardware and timing, to tackle this properly yet.
I can mix the screen modes, as shown here in Elite, but the black band is constantly moving suggesting a timing issue. At this point I don't know whether the issue is with how I've setup the screen or something with how I'm using the 6845, or the 6845 itself.
I keep returning to it every few months in the hope that I'll get a little further with every fresh look.
[Linked Image from i.imgur.com] [Linked Image from i.imgur.com] [Linked Image from i.imgur.com] [Linked Image from i.imgur.com]


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Pernod #114397 12/05/18 12:19 AM
Joined: May 2004
Posts: 1,772
Likes: 34
H
Very Senior Member
Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,772
Likes: 34
I guess you need to study the game code to see how it's deciding when to change the parameters?

it could be some horrible case where it depends on precise emulation of waitstates etc. if the software has no real way to know the beam position from the hardware outside of manual cycle counting

it's also possible you're not forcing a partial update when the relevant video registers change (because really, using force partial updates is an optimization so that drivers don't have to draw the entire screen line by line in all cases) There are things like 'VIDEO_UPDATE_SCANLINE' if you want to force MAME to do a partial update for every single line (which is still really not 100% accurate to hardware, as some can update during the horizontal scan too, there's a SNES game that quite famously uses horizontal and vertical timing effects to change the palette for a handful of pixels in order to make a shadow, then changes it back, and no, MAME doesn't handle that case)

Accurate timing and video emulation built around it is hard on many levels tho, and for quite a few cases MAME isn't best suited to handle it.

Haze #114398 12/05/18 02:48 AM
Joined: Apr 2012
Posts: 344
Likes: 63
Pernod Offline OP
Senior Member
OP Offline
Senior Member
Joined: Apr 2012
Posts: 344
Likes: 63
Originally Posted by Haze
Accurate timing and video emulation built around it is hard on many levels tho, and for quite a few cases MAME isn't best suited to handle it.
I realise that, but my lack of screen/video knowledge is not helping either smile I already use VIDEO_UPDATE_SCANLINE in the Electron driver which works great, but don't think this helps when using the mc6845 device.

In mc6845_device::recompute_parameters the last thing it does is to reset m_line_counter = 0. This is definitely not helping my use case, removing it gives me a stable image but I lose the lower part of the screen after the resolution change. Feels like a step in the right direction, not sure yet how this would affect any other machines.

Last edited by Pernod; 12/05/18 02:48 AM.

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Pernod #123919 11/21/24 10:33 PM
Joined: Apr 2012
Posts: 344
Likes: 63
Pernod Offline OP
Senior Member
OP Offline
Senior Member
Joined: Apr 2012
Posts: 344
Likes: 63
Wow, over 6 years since I last posted to this topic.

I have Elite fully working, and many others that change screen resolution mid-screen, with minimal changes to mc6845_device (just remove the m_line_counter = 0 at the end of recompute_parameters).

[Linked Image from i.imgur.com]

Ideally I also want to use set_show_border_area(true) but am now convinced this is fundamentally flawed as it changes the visarea which then breaks the vblank timing when screen->reset_origin() is called. Anything that then relies on accurate VSYNC interrupts is then broken.

Wouldn't it make more sense to have the show_border_area property at a lower level, in screen_device? This would allow screen_device to allocate the correctly sized bitmap without disrupting visarea and derived timings.


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Pernod #123920 11/21/24 11:15 PM
Joined: Feb 2004
Posts: 2,603
Likes: 307
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,603
Likes: 307
The screen device is already flawed when it comes to the timings based on visible area. If you need accurate timing for sync signals, etc. you really need to generate them from the CRTC device itself. Does the 6845 device provide vertical blanking and/or sync signals independent of the screen device?

Vas Crabb #123921 11/21/24 11:51 PM
Joined: Dec 2015
Posts: 173
Likes: 12
A
AJR Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2015
Posts: 173
Likes: 12
The 6845 doesn't have a meaningful vertical blanking signal, but it does produce VSYNC, and a lot of systems rely on that.

6845 visible area configuration, as currently emulated, is fundamentally flawed because of the way some software abuses the device by reconfiguring the screen many times per frame.

Page 3 of 4 1 2 3 4

Link Copied to Clipboard
Who's Online Now
2 members (R. Belmont, 1 invisible), 205 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,328
Posts122,128
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com