larsbrinkhoff / terminal-simulator

Simulation of VT52 and VT100 terminal hardware.
GNU General Public License v3.0
113 stars 17 forks source link

Render fixes #29

Closed SegHaxx closed 3 years ago

SegHaxx commented 3 years ago

Hi, I fixed some rendering issues. First one is, the "dot stretcher" needs to happen after "widening" for correct rendering of double-width chars.

Second is #28. I tried the obvious fix, scroll - 1, but then it still wasn't quite right. After staring at vttest's character set screen a bit I figured out the first scanline of a cell was showing up on the next char, so if (scroll == 0) ++c; did the trick.

I suspect the root of this is some mixed up address lines in the char gen roms? Is something clever being done in the hardware? A cleaner fix would be to re-order the rom the way the code expects, but I wanted to confer with hardware experts before doing so.

Looking at the raw bits in GIMP confirms the ROM image itself is off. As the upper row is only visible in a few special chars, this would be easy for whoever dumped the ROM to overlook.

image

This all looks "more correct" to me but I do not have a real VT100 or any experience with one so this should be qualified against a real one. :)

My only experience with real text terminals was Wyse terminals at the library. If anyone is working on emulating Wyse terminals, let me know. I haven't even been able to find any ROM dumps for those. :(

larsbrinkhoff commented 3 years ago

Thanks! Contributions are very welcome.

the "dot stretcher" needs to happen after "widening" for correct rendering of double-width chars.

I have checked this against a real VT100. What information do you have about this?

larsbrinkhoff commented 3 years ago

I also checked a real VT220 and it does the stretching after.

larsbrinkhoff commented 3 years ago

I suspect the root of this is some mixed up address lines in the char gen roms? Is something clever being done in the hardware?

I just got the ROM images off the net, so I can't say for sure. I have read the Technical Manual but I didn't see anything about this. Your examination using GIMP certainly makes the image look odd.

larsbrinkhoff commented 3 years ago

FYI @masswerk

SegHaxx commented 3 years ago

Hmmm interesting. I was looking at this page yeah: https://www.masswerk.at/nowgobang/2019/dec-crt-typography which probably nicked it from here https://vt100.net/dec/vt220/glyphs ?

A big problem I've had is most screenshots of old video terminals on the web are a bit vintage themselves, too fuzzy and low rez for accurate pixel peeping. Some well-exposed, sharp reference photos of some good reference screens with a modern DSLR would be very helpful.

SegHaxx commented 3 years ago

Okay dug through the technical docs, and I may have figured out how this got confused. This block diagram implies the dot stretch happens last, maybe?

image

Going through the schematics, all I can gather is that most of this happens inside some opaque custom chips which doesn't tell us much.

However the important bit is in the tech docs, the dot stretcher is explained like this:

image

The dot stretcher is clocked by Dot Clock. So what does Dot Clock do during double-wide chars?

image

It's halved. Long story short, doing dot stretch before widening is effectively correct. I've corrected the patch.

larsbrinkhoff commented 3 years ago

I collected some screenshots here, and begged people to send me their photos: https://github.com/larsbrinkhoff/terminal-simulator/issues/5

I have since acquired a VT100 of my own so I can make reference photos.

larsbrinkhoff commented 3 years ago

I think "VID IN" is essentially the character graphics, which is fist passed to "DOT STRETCH DELAY". After that comes the "ATTRIBUTE LOGIC" which applies reverse video, underline, dim/bright, and blink.

masswerk commented 3 years ago

Hmmm interesting. I was looking at this page yeah: https://www.masswerk.at/nowgobang/2019/dec-crt-typography which probably nicked it from here https://vt100.net/dec/vt220/glyphs ?

"probably nicked it" is a funny way of putting it – there are named credits and source links for every single image (2 in total), as well as remarks on how they were used/altered.

A big problem I've had is most screenshots of old video terminals on the web are a bit vintage themselves, too fuzzy and low rez for accurate pixel peeping. Some well-exposed, sharp reference photos of some good reference screens with a modern DSLR would be very helpful.

This is literally the opening proposition of that post.

larsbrinkhoff commented 3 years ago

Photo from real VT100. 20210713_180816 Closeup to show details. Clearly the little gaps in n, d, h, and g aren't there. 20210713_181223

larsbrinkhoff commented 3 years ago

Merged the "font ROM" fix. Thanks!

SegHaxx commented 3 years ago

The plot thickens. I agree, definitely looks correct for VT-10x, but that photo of a VT-220:

https://user-images.githubusercontent.com/775050/119037360-2a4def80-b9b2-11eb-981b-5a6c81c4927a.jpg

Its showing the gaps? Oh well we can worry about that when we get to VT-220 emulation. :)

hisdeedsaredust commented 2 years ago

The chargen ROM as dumped (MAME, for instance) is correct. The Technical Manual explains how the low 4 bits of the chargen address are calculated: https://vt100.net/docs/vt100-tm/chapter4.html#S4.6.3.4

In short, the glyph scan addresses are 15, 0, 1, 2, ..., 8.