• Please review our updated Terms and Rules here

EGA video corruption?

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
On EGA and the Paradise PVGA1A, and maybe others, display start is latched at the falling edge, and PEL panning is NOT LATCHED AT ALL. PEL panning can be updated while visible scanlines are put out and the change is seen immediately (or at scanline start).

Yes, this is EXACTLY what you want. Most other systems work like that as well, such as C64 and Amiga.
This allows you to do clever Tech Tech effects and if combined with display start updates, you can also use it for bitmap zooming/planar texturemapping etc.
The trick is to have multiple pre-scaled bitmaps, eg at 16 pixel intervals. The 'inbetween' scaling is done by adjusting the scroll register a few times per scanline, so you skip some pixels.

Basically the latching is in the way of all kinds of cool effects. But with the trick that reenigne developed for 8088 MPH, we may be able to get around it. He figured out that you can create frames of 2 scanlines high, with no vblank at all, so you can 'stack' them... 100 of these frames construct an image of 200 scanlines high. This allows you to set a new display start every 2 scanlines.
On EGA/VGA it should even be possible at every scanline, because the 2-scanline thing is a 6845 limitation with the even and odd bitplanes (it only supports 127 rows, because it was never meant for graphics, only text).
 

H-A-L-9000

Experienced Member
Joined
Aug 27, 2009
Messages
120
Location
Bavaria / Germany
One VGA demo trick I've seen (Panic demo and others) is to use the offset register (it defines the width of a virtual screen) to sort of 'jump' in video memory. This register isn't latched even on VGA. You would wait for horizontal retrace [or "/OFF], update the offset, and after the next scanline it will start from a different portion of video memory than it normally would. Of course this uses a lot of CPU and thus you have a static logo at the bottom of the screen where the CPU 'can take a breath' (handle sound and prepare next frame).

The Copper and GBU demos have one part where horizontal zooming is shown, they may also use the offset register.
 

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
Ah yes, offset is like the modulo of Amiga screens. CGA didn't have that yet.
Another interesting way to hack your framebuffer address :)
 

Great Hierophant

Veteran Member
Joined
Mar 22, 2006
Messages
1,921
Location
Massachusetts, USA
On EGA and the Paradise PVGA1A, and maybe others, display start is latched at the falling edge, and PEL panning is NOT LATCHED AT ALL. PEL panning can be updated while visible scanlines are put out and the change is seen immediately (or at scanline start). The game Beverly Hills Cop (by Tynesoft) uses this to show a screen with text with sine wave effect. This works on EGA but not on VGA (except on the Paradise card).

As this exact latching behaviour is totally undocumented, programmers who were not aware of it and trusted backwards compatibility produced bad games for the EGA. Also hardware manufacturers who didn't bother to test their compatibility 100% exactly produced incompatible cards, such as Paradise and Matrox and I think I've also seen problems on some AGPish ATI models.

So we should expect to see stuttering on PVGA1A-based VGA cards? That is very disheartening to hear.
 

H-A-L-9000

Experienced Member
Joined
Aug 27, 2009
Messages
120
Location
Bavaria / Germany
So we should expect to see stuttering on PVGA1A-based VGA cards? That is very disheartening to hear.

Yes, just tried:
- Matrox Mystique has the keen shaking bug
- PVGA1A has it
- other suspects are in the basement

Fortunately they have not that much of a market share ;)

- WD90C11 doesn't have the bug (weren't they said to have bought Paradise?).

The SVGA fix option in Keen addresses a different issue. On some SVGA cards (a famous one being ET4000) the video memory doesn't wrap as on a compatible VGA with 256kb, but displays something in the 256-512k range instead. The game doesn't expect this and thus garbage or a black screen are shining through. The fix probably has a preformance penalty.
 

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
Yes, just tried:
- Matrox Mystique has the keen shaking bug
- PVGA1A has it
- other suspects are in the basement

Fortunately they have not that much of a market share ;)

Do you have a real IBM PS/2 VGA machine to test against?
I've never acutally used a real IBM VGA chip. Wonder Matrox and WD got it wrong, or if all others did, but there were so many that it became the de facto standard :)

- WD90C11 doesn't have the bug (weren't they said to have bought Paradise?).

Yes, WD bought Paradise, but back in 1986 according to wikipedia, so all VGA cards were released after it was already WD-owned.
 

H-A-L-9000

Experienced Member
Joined
Aug 27, 2009
Messages
120
Location
Bavaria / Germany
Nope, I don't have any type of original IBM VGA. It could be that someone on vogons did some tests back then.

It could also be that Paradise took their EGA core and added VGA capabilities.
 

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
I have some problems to follow the discussion... did I get it right?

The game Beverly Hills Cop (by Tynesoft) uses special undocumented feature of an EGA-Card that produces Text with stutterfree sinus waves.
This could be seen with EGA but not with VGA in EGA-Displaying-Mode. (The Game has only EGA) Only some VGA-Cards (Paradise) could show it too.
Yesterday I tested this on my 286/EGA and the Scrolling and the Text with Sinuswave are absolutely stutterfree and look perfect to me.
I'll test this game on my second 286/12,5 witch has an ATI-VGA Onboard.

The other thing is Keen1-3 and 4-x. Keen is EGA but it runs terrible on EGA. It stutters all the time. Keen 1-3 are bad according to stutterfree scrolling,
Keen4-x are horrible. Why can't it be like beverlyhillscop...?

Have I mixed something up, or is it the same source with the latching ?

Doc
 

H-A-L-9000

Experienced Member
Joined
Aug 27, 2009
Messages
120
Location
Bavaria / Germany
Yes, same source. It appears they got it right in Keen Dreams. It has no problems on MGA, EGA, Matrox.

In the source code for Keen Dreams we find this:
Code:
PROC	VW_SetScreen  crtc:WORD, pel:WORD
PUBLIC	VW_SetScreen

if waitforvbl

	mov	dx,STATUS_REGISTER_1

;
; wait util the CRTC just starts scaning a diplayed line to set the CRTC start
;
	cli

@@waitnodisplay:
	in	al,dx
	test	al,01b
	jz	@@waitnodisplay

@@waitdisplay:
	in	al,dx
	test	al,01b
	jnz	@@waitdisplay

endif

;
; set CRTC start
;
; for some reason, my XT's EGA card doesn't like word outs to the CRTC
; index...
;
	mov	cx,[crtc]
	mov	dx,CRTC_INDEX
	mov	al,0ch		;start address high register
	out	dx,al
	inc	dx
	mov	al,ch
	out	dx,al
	dec	dx
	mov	al,0dh		;start address low register
	out	dx,al
	mov	al,cl
	inc	dx
	out	dx,al

if waitforvbl

;
; wait for a vertical retrace to set pel panning
;
	mov	dx,STATUS_REGISTER_1
@@waitvbl:
	sti     		;service interrupts
	jmp	$+2
	cli
	in	al,dx
	test	al,00001000b	;look for vertical retrace
	jz	@@waitvbl

endif

;
; set horizontal panning
;
	mov	dx,ATR_INDEX
	mov	al,ATR_PELPAN or 20h
	out	dx,al
	jmp	$+2
	mov	al,[BYTE pel]		;pel pan value
	out	dx,al

	sti

	ret

ENDP

The first part with the horrible spelling could be the fix.
 

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
does this mean this could be fixed for my EGA-card? :) (changing the code in order to get it stutterfree and recompile it)
i'll test keen-dreams :)
 

H-A-L-9000

Experienced Member
Joined
Aug 27, 2009
Messages
120
Location
Bavaria / Germany
Source code seems to be available only for Keen Dreams. There is still a chance for binary patching. If one knows how to add more code to an existing binary, and if really only this part is missing...
 

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
KeenDreams is really better, but not top-notch.

https://youtu.be/Kuqw8RrcpCU
https://youtu.be/--4XmCKyPqo

Ah, I remember that FBI intro... One of the first on PC that felt like classic C64/Amiga stuff with the graphics style, colour cycling and smooth scrolling.
Note though that scrolling a whole game is more difficult than just moving a logo from left to right on a part of the screen.
In fact, I might reverse-engineer that FBI intro later. I think it should be possible without actually moving memory around, by just reprogramming the screen offset and scroll register (and using the auto-reset feature of both to keep the bottom of the screen solid... which means the scrolling text is probably bruteforce). If you do it like that, even a 4.77 MHz 8088 should be able to run it at full speed.
So I wonder how they implemented it.

Also, you linked to the ball video twice, I think you meant to paste another link the third time?
 

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
I corrected that. The game BeverlyHillsCop has real smooth scrolling (for an ega-game)!
 
Last edited:

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
In fact, I might reverse-engineer that FBI intro later. I think it should be possible without actually moving memory around, by just reprogramming the screen offset and scroll register (and using the auto-reset feature of both to keep the bottom of the screen solid... which means the scrolling text is probably bruteforce). If you do it like that, even a 4.77 MHz 8088 should be able to run it at full speed.
So I wonder how they implemented it.

Right, so I've been poking around in their code a bit, and indeed, they just update the start address register and scroll register to move the logo. It's very fast and smooth, even on a very slow PC.
The text scrolling is done 'bruteforce': all bytes are read from video memory and rotated 1 bit through carry.
The approach I took in 1991 Donut would probably speed up the text scrolling quite a bit, but since there's nothing else going on, it should be fast enough even on an 8088 I guess. I'd have to test it on one of my machines with VGA installed.
 

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
Those smooth scrolling-animations are quite rare for the PC. Especially when it comes to EGA! Mostly cracktros only support VGA.
Another thing that is quite rar, is cool chip tune-music. I already guessed about making some sort of Disk-Menu with Scrollertext and Chiptunemusic.
(For OLD! machines, like the Schneider 286/EGA or the Tandy1000RL)

But I am lightyears away from any type of programming, all I can do is a stupid batch-file with a loop and a black/white-Disk with ASCII code.
The chiptunes run fine on my PII-333/Win98SE. I don't know how low the cpu-speed for these kind of music can be, but I think a pentium is truly required for that.
In fact, there are only Win9x/NT players as far as I see. So no Dos and therefore no real old machines.
 

Attachments

  • AHX-Music.zip
    49.7 KB · Views: 1
  • AHX-Player.zip
    58.2 KB · Views: 1
Last edited:

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
If that is the same AHX as on the Amiga, then it will be reasonably CPU-heavy: http://www.pouet.net/prod.php?which=13329
AHX is an early 'softsynth' format, where the CPU generates waveforms and performs filtering.
Early versions on Amiga required at least an 68020. Later versions do work on a stock 68000 Amiga, but they have to build all sorts of tables, which can take up to 45 seconds before the music can start.
And an Amiga still has 4 hardware audio channels. So on a PC you need even more CPU power to also do software mixing.
So I wouldn't be surprised that you need a Pentium at least, if they went for a high-quality synth/filter/mixer.
Of course you could trade in quality for speed and get it faster, but it's quite a bit more heavy than a mod player at least, so a low-end 286 would probably be too slow.
 
Last edited:

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
Do I get it right that:
- These AHX Files sound like a SID or AtariST Music-file.
- These machines have chips that do this type of sound without consupting a lot of cpu-speed. they do have very limited cpu-speed either.
- In order to recreate such type of sound you need a fast PC.

AHX-Player need about 4% CPU-Speed at a P200 (do I read this somewhere?)

So as you said it is quite impossible to do these type of music/sounds with a very limited 286 :(
I did not know, that generating Waveforms cost so much CPU-Power. I thoght about the C64 and the ST and theire CPU-Power, but it's all about the custom soundchips :(

Doc
 

Scali

Veteran Member
Joined
Dec 13, 2014
Messages
2,024
Location
The Netherlands
Do I get it right that:
- These AHX Files sound like a SID or AtariST Music-file.
- These machines have chips that do this type of sound without consupting a lot of cpu-speed. they do have very limited cpu-speed either.
- In order to recreate such type of sound you need a fast PC.

Yes, something like that.
AHX was designed to sound somewhat like SID music, but optimized for use on Amiga.
The key to the SID sound is realtime filtering of waveforms. Amiga has no adjustable audio filters, it can only play back samples. So the CPU has to generate filtered samples in realtime to simulate SID-like sounds.

So as you said it is quite impossible to do these type of music/sounds with a very limited 286 :(

It may be possible, but you'd need a specially optimized player, with limited quality.
You can play back the music on an 68000 at 7 MHz, which is slower than a 286 at 10 MHz. If you use a decent sound card with DMA, like an SB2.0/Pro or even better, a GUS, then you should be able to get acceptable results on such a machine, but I doubt that such a player exists.
The first version of the AHX tracker was introduced in 1995, long after 286 went out of use.
 

dr.zeissler

Experienced Member
Joined
Jan 4, 2014
Messages
396
Location
Germany
It's nice to be able to play back this type of music on a PII, but my main wish is to do so on a 286 :)
 
Last edited:
Top