Games turn off interlace mode

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
AnsemEco
Posts: 1
Joined: Sat Mar 11, 2017 8:11 pm

Games turn off interlace mode

Postby AnsemEco » Tue May 30, 2017 8:18 pm

Hello,

I have been using an FPGA emulation of the BEEB and I have noticed something strange when some games are executed (actually all as far as I tried eg. Snapper, meteors,..); they turn off the interlace mode in the 6845 (register 8 bit 1 and bit 0 are cleared). I have confirmed this using a live debugger.
To my understanding TVs were always meant to be used with interlaced mode. The FPGA implementation doesn't allow me to discover how it would look like on the real BEEB, but I've seen videos on YouTube of the actual games and they seem fine on the display. So I'm wondering why am I not seeing interlaced black stripes because of wider gaps between scan lines. Or is it the case that shouldn't happen in the first place (register 8 bits shouldn't be cleared). Can anyone confirm the state of register 8 when playing any of these games.

joachim
Posts: 95
Joined: Wed Jun 21, 2006 1:20 am

Re: Games turn off interlace mode

Postby joachim » Thu Jun 01, 2017 6:42 pm

I believe the BBC turns off interlace by default in MODEs other than MODE 7.

(Edit: you're right, it doesn't.)
Last edited by joachim on Sun Jun 04, 2017 2:12 am, edited 1 time in total.

User avatar
Lardo Boffin
Posts: 584
Joined: Thu Aug 06, 2015 6:47 am

Re: Games turn off interlace mode

Postby Lardo Boffin » Thu Jun 01, 2017 7:48 pm

There is a command *TV0,1 which switches off interlaced mode (except in Mode 7 of course) once you changed mode.

I found that it gave a much improved picture on a high res cub monitor when I used it (until the monitor died :( ) but I had to actively use it to get rid of the interlace.

I don't know if any games changed the setting for you - I suspect some of them may have but I remember (this was over a year - I have had to use an LCD TV since) having to switch it manually myself for most of them.
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Retroclinic Datacentre + HDD, matchbox co-proc, Viglen twin 40/80 5.25" discs, acorn cassette
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc, Acorn 6502 coproc

User avatar
tricky
Posts: 1811
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Games turn off interlace mode

Postby tricky » Thu Jun 01, 2017 7:56 pm

Mine all turn interlace off, they probably should give you the choice, but I prefer the look and the timing makes more sense ;)

paulb
Posts: 761
Joined: Mon Jan 20, 2014 9:02 pm

Re: Games turn off interlace mode

Postby paulb » Thu Jun 01, 2017 9:21 pm

AnsemEco wrote:So I'm wondering why am I not seeing interlaced black stripes because of wider gaps between scan lines. Or is it the case that shouldn't happen in the first place (register 8 bits shouldn't be cleared).


Being an Electron person, I am not familiar with the Beeb's video system, but I imagine that disabling interlacing does not disable one of the fields (there being two fields per frame, as I'm sure you already know), but instead merely indicates that each field is not going to be controlled separately and will therefore be the same as its counterpart. With mode 7, the SAA5050 outputs different things for each field, thus providing the higher resolution characters. But in modes 0 to 6, the output from both fields should be the same.

User avatar
1024MAK
Posts: 6667
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: Games turn off interlace mode

Postby 1024MAK » Fri Jun 02, 2017 9:26 am

The description of the 6845 interlace mode settings is not very clear. To fully understand, I would tell you to look at the pictures in the data sheet, however, most datasheet files are scans and are of poor quality... :(

There are a number of things to keep in mind:-
A standard 625 line, 50 Hz interlaced TV picture is made up of two fields transmitted one after the other. When combined they make one frame. 50 fields are transmitted per second, not 50 frames. Wikipedia has a fuller description here.
Computers can either transmit a full specification TV signal - full interlaced video (with different picture information in the odd and even fields), transmit the odd and even fields but with the same picture information, or transmit just one field repeatedly (this works because most TVs are designed to accept an analogue signal with a wide range of tolerance). In the last case, the second field is never displayed, so you can see "gaps" or horizontal lines in the picture.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
hoglet
Posts: 6352
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Games turn off interlace mode

Postby hoglet » Fri Jun 02, 2017 9:37 am

In non-interlaced modes, the Beeb is definitely repeating the same 312-line field twice, giving a field rate of 50.08Hz.

What I'm not sure about is whether this is technically the odd frame or the even frame that is being repeated.

Dave

User avatar
1024MAK
Posts: 6667
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: Games turn off interlace mode

Postby 1024MAK » Fri Jun 02, 2017 10:08 am

Okay, found a better quality data sheet :D

Extracts:-
6845 Raster Scan System (non-interlace).png
6845 Raster Scan System (non-interlace)
6845 Raster Scan System (interlace).png
6845 Raster Scan System (interlace)
6845 Character Display on the Screen and Video Signal.png
6845 Character Display on the Screen and Video Signal
6845 Interlace Control.png
6845 Interlace Control


Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
1024MAK
Posts: 6667
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: Games turn off interlace mode

Postby 1024MAK » Fri Jun 02, 2017 10:34 am

The Advanced User Guide wrote:2.20 *TVx,y (no abbreviation) OSBYTE with A=&90 (144)

The *TV command allows the vertical position of the screen to be altered and interlace to be switched on or off. The first parameter causes the vertical position to be altered; a value of 0 causes no change, a value of 1 would cause the screen to be moved up one line and a value of 255 would cause the screen to be moved down one line. The second parameter should be 0 or 1, a value of 0 causes interlace to be enabled and a value of 1 causes interlace to be switched off. Any change of interlace or screen position will only come into effect at the next mode change and will remain until a further *TV command or a hard reset. Interlace cannot be turned off in mode 7.

(It is possible to switch off interlace in mode 7 but the character set stored in the SAA 5050 is designed to be used with interlace on. Type in,

Code: Select all

VDU23,0,8,&90;0;0;0,23,0,9,&09;0;0;0
and you will see why the operating system disallows this. See chapter 18 for more information about programming the 6845 video controller chip.)

The Advanced User Guide wrote:18.6 Interlace and delay register (R8)

This 6 bit write only register controls the raster scan mode and cursor/display delay. The interlace options are:

18.6.1 Interlace modes (bits 0,1)

Code: Select all

Interlace mode    Description
register
Bit 1   Bit 0

0       0         Normal (non-interlaced) sync mode (figure 18.2a)
1       0         Normal (non-interlaced) sync mode (figure 18.2a)
0       1         Interlace sync mode (figure 18.2b)
1       1         Interlace sync and video (figure 18.2c)

All BBC microcomputer screen modes are interlaced sync only except for mode 7 which is interlaced sync and video. The default values can easily be changed using *TV (*FX 144) followed by a 0 to turn interlacing on or a 1 to turn interlacing off.
p364.gif
p365.gif

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

hexwab
Posts: 23
Joined: Wed Jul 08, 2015 8:27 pm

Re: Games turn off interlace mode

Postby hexwab » Sat Jun 03, 2017 1:08 pm

AnsemEco wrote:To my understanding TVs were always meant to be used with interlaced mode. The FPGA implementation doesn't allow me to discover how it would look like on the real BEEB, but I've seen videos on YouTube of the actual games and they seem fine on the display. So I'm wondering why am I not seeing interlaced black stripes because of wider gaps between scan lines.

You absolutely should see wider gaps between scan lines, at least on a CRT. However, the overall brightness is the same, so that might mask the effect. It's very display-dependent. LCDs and emulators tend to do line doubling, and since filming a CRT is fraught with difficulty, I imagine most youtubers will be using an emulator or possibly a video capture card.

paulb wrote:Being an Electron person, I am not familiar with the Beeb's video system, but I imagine that disabling interlacing does not disable one of the fields (there being two fields per frame, as I'm sure you already know), but instead merely indicates that each field is not going to be controlled separately and will therefore be the same as its counterpart. With mode 7, the SAA5050 outputs different things for each field, thus providing the higher resolution characters. But in modes 0 to 6, the output from both fields should be the same.

Interlace does not change what's displayed during a field. All that changes is the vertical offset. But whether the display is interlaced or not, the field data can of course be updated at 50Hz.

1024MAK wrote:In the last case, the second field is never displayed, so you can see "gaps" or horizontal lines in the picture.

No, the second field is overlaid on top of the first field.

hoglet wrote:In non-interlaced modes, the Beeb is definitely repeating the same 312-line field twice, giving a field rate of 50.08Hz.
What I'm not sure about is whether this is technically the odd frame or the even frame that is being repeated.

It's the even field, I believe (i.e. the one that isn't offset downwards by half a line). But it's only the timing that is being repeated, not the data!

User avatar
1024MAK
Posts: 6667
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...

Re: Games turn off interlace mode

Postby 1024MAK » Sat Jun 03, 2017 1:46 pm

hexwab wrote:
1024MAK wrote:In the last case, the second field is never displayed, so you can see "gaps" or horizontal lines in the picture.

No, the second field is overlaid on top of the first field.

For a CRT, the same phosphors are scanned for each field (as the non-standard sync means the display treats it as a succession of say, 'even' fields) so the phosphors that would normally be scanned and activated when the 'odd' field would normally be displayed don't get an electron beam scanning them to activate them, they are missed.
So instead of even field scan, odd field scan, even field scan, etc, you get even field scan, even field scan, even field scan, etc.

Hence you can sometimes see "gaps". Granted, how visible this is (or not) very much depends on the focus of the electron beam(s), the brightness setting, the size and shape of the phosphors, the construction of the shadowmask (if a colour CRT) etc.

What actual picture information is in each field is another matter. If the CPU can change the data in the display memory fast enough, each field can have different data. The 6845 CRTC only does the timing, syncs and addressing, it does not care what data is in the memory, and hence what data is actually displayed.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
tricky
Posts: 1811
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Games turn off interlace mode

Postby tricky » Sat Jun 03, 2017 7:19 pm

Is it possible on the beeb to know which field is being displayed from software?

User avatar
Rich Talbot-Watkins
Posts: 1078
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Games turn off interlace mode

Postby Rich Talbot-Watkins » Sat Jun 03, 2017 10:13 pm

No - all you can do is use interlaced sync and video mode so that alternate scanlines are sent to each field.

joachim
Posts: 95
Joined: Wed Jun 21, 2006 1:20 am

Re: Games turn off interlace mode

Postby joachim » Sat Jun 03, 2017 10:23 pm

tricky wrote:Is it possible on the beeb to know which field is being displayed from software?

Couldn't you keep count of the frames since the last MODE change?

User avatar
Rich Talbot-Watkins
Posts: 1078
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Games turn off interlace mode

Postby Rich Talbot-Watkins » Sun Jun 04, 2017 8:30 am

It's actually an interesting point. Does changing interlace mode (CRTC R8) actually reset the internal CRTC state which determines whether it's generating an odd or even field? Would have to do some tests with a scope to see what happens I guess. I've always assumed that MODE changes don't reset this but that might not be the case.

SarahWalker
Posts: 1036
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: Games turn off interlace mode

Postby SarahWalker » Sun Jun 04, 2017 11:54 am

You can determine odd/even field, by measuring the time between vsync. One field will appear to be one line longer than the other (I forget which one!).

User avatar
hoglet
Posts: 6352
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Games turn off interlace mode

Postby hoglet » Sun Jun 04, 2017 6:02 pm

SarahWalker wrote:You can determine odd/even field, by measuring the time between vsync. One field will appear to be one line longer than the other (I forget which one!).

If you do this, I think you'll find each field is actually 312.5 lines, or damn close to 20ms.

This is because the VSYNC pulse for the odd frame is actually delayed exactly by half a line (32us).

At least, this is my current understanding of things from poking around with a scope. I could of course be wrong....

Dave

hexwab
Posts: 23
Joined: Wed Jul 08, 2015 8:27 pm

Re: Games turn off interlace mode

Postby hexwab » Sun Jun 04, 2017 6:11 pm

hoglet wrote:
SarahWalker wrote:You can determine odd/even field, by measuring the time between vsync. One field will appear to be one line longer than the other (I forget which one!).

If you do this, I think you'll find each field is actually 312.5 lines, or damn close to 20ms.

This is because the VSYNC pulse for the odd frame is actually delayed exactly by half a line (32us).

Exactly this.

Attached is a program that prints the approximate number of (2MHz) cycles between vsync interrupts. The timing is the same for both fields, being around 40000 (312.5*128) with interlace on and 39936 (312*128) with it off. Tested on real hardware, as well as b-em and jsbeeb. So no, it's not that simple (although I have reason to believe it is possible).
Attachments
videotime.zip
(555 Bytes) Downloaded 12 times

SarahWalker
Posts: 1036
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: Games turn off interlace mode

Postby SarahWalker » Sun Jun 04, 2017 7:23 pm

Hmm, must be misremembering then.It might work as I described on the Electron?

User avatar
davidb
Posts: 1824
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Games turn off interlace mode

Postby davidb » Sun Jun 04, 2017 8:25 pm

SarahWalker wrote:Hmm, must be misremembering then.It might work as I described on the Electron?

Possibly. That's what I did with my palette and vertical scrolling routines on the Electron. :)

paulb
Posts: 761
Joined: Mon Jan 20, 2014 9:02 pm

Re: Games turn off interlace mode

Postby paulb » Sun Jun 04, 2017 8:26 pm

SarahWalker wrote:Hmm, must be misremembering then.It might work as I described on the Electron?


davidb will be able to say, given that his palette switching and Firetrack-style scrolling relies on distinguishing between the fields, if I remember correctly. Thus, there really is a 312/313-line distinction on the Electron.

Edit: I see he beat me to a response!

ThomasHarte
Posts: 327
Joined: Sat Dec 23, 2000 5:56 pm

Re: Games turn off interlace mode

Postby ThomasHarte » Tue Jun 06, 2017 9:06 pm

If my understanding is correct then on an Electron, where video is always interlaced, it should be possible to determine which frame you're in by counting the period between the display end interrupt and the real-time clock interrupt as end-of-display is always tied to the display activity, so will be at a fixed position within the timing of a line, but the real-time clock is always 40,000 cycles apart.

I may have the exact numbers wrong because they're derived from other information rather than measured directly (and, in particular, I'm not exact on where within a line the end-of-display fires) but in my implementation relative timing is:

cycle 0: real-time clock interrupt
cycle 20288: end-of-display interrupt
cycle 40000: real-time clock interrupt
cycle 59968: end-of-display interrupt
cycle 80000: back to cycle 0

As to the rest of the topic: no, you won't necessarily see empty lines. As mentioned, it depends on the intended width of your TV's phosphor gun, and its focus. Interlacing works because by the time the gun comes close to the same spot as a field ago, the phosphors have faded. It's overpainting, but offset a little, both in space and time. So the ideal TV would have a raster that was exactly wide enough so that it exactly met the boundary of itself from 64µs ago. Don't leave a gap for the next field because you'll be faded by then anyway. Anything else is just shipping a TV that's less bright than it needs to be. But you don't want the two adjacent scans to overlap or you'll get brightened areas there, so practical reality means it's often just a little smaller.


Return to “emulators”

Who is online

Users browsing this forum: No registered users and 4 guests