New Breadboard 8088 PC V2 #11 CGA Video Controller

New Breadboard 8088 PC V2 #11 CGA Video Controller

Show Video

Welcome to breadboarding. In the previous video, we managed to get our PS2 keyboard controller configured and working. And we also relocated our serial port up to the top of this board here. And we also started to lay out the

floppy disc controller and the IDE hard disk controller, although those are not wired in at the moment. And we managed to actually get the BIOS output going to the serial port. So, we're able to see that this is the BIOS setup utility where we're able to set the real-time clock and configure things like floppy disc drives and stuff like that. But really, what we need to be able to do to be able to run MS DOSs is we need to be able to have an IBM PC compatible graphics card or video card. And what we're going to be doing in this video is starting to build out the CGA graphics adapter. So this is video 11 in the

breadboard PC 8088 version two series and this is our highle plan where we started off building a basic nanomp 8088 with an LED display and keypad and a built-in monitor that we could use for doing debugging when we built out our PC. And now we're coming to the end of the basic floppy disc PC where we just need to get our CGA video controller and the floppy disc controller built in order for us to be able to boot MS DOS off floppy disc. And then we'll be looking later on in the series in building out the hard disk, adding some of the graphics modes to the CG video card, adding a mouse, and then running early versions of Windows. So, our breadboard PC version 2 is kind of an Intel 8088 PCXT hybrid in that it is based pretty much on the original PCXT, but we do have more modern extension. So, for example, the PCAT

added the real-time clock and the more advanced serial ports that we' used in previous videos. It also introduced dual interrupt controller so we had enough interrupts to be able to handle the real-time clock and the mouse. And then the IBM PS2 range from around 1987 onwards that introduced a PS2 keyboard and mouse. And so we're making use of that. And when we come to look at the hard disk, then the compact Despro 386 I think was one of the earlier PCs to actually use ID hard disks. So this is an image of an original CGA video card. This comes from

minus0 degrees.net net and that's a great site if you want to look into a lot of documentation and detailed information about the original early IBM PCs. And you can see here that we've got a Motorola 6845 cathode radio controller chip. There is a character ROM. We have 16K of dynamic video RAM. So this is in

one bit by 6K dynamic RAM chips. And there was a composite video output and also a TTL CGA video output. So this just had digital outputs, ones and zeros effectively for the color signal coming out of here. And it used

69 chips in total of which eight were the RAM and there were about 59 TTL logic chips making up this card. So the CGA graphics adapter was available with the first PC in 1981. However, the IBM color display, the IBM 5153, which was compatible with CGA, was only brought out in 1983. And I believe up to that point, you probably had to use third party of multi-sync type monitors. The vertical refresh of the

displays in those days was 50 Hz or 60 Hz. And again, that would be tied in to the refresh frequency of TVs at the time when using TV output. and the horizontal synchronization refresh frequency was about 15.7 kHz. So again, modern monitors probably would struggle uh with some of these combinations. And the 14.3

MHz clock used on the original PC was actually a multiple of the NTSC color signal needed. The IBM PC in fact divided that clock by three to get the rather unusual 4.77 MHz that you might be familiar with. Now, CGA video support

is built into the original PC BIOS and the XI888 BIOS that we're using. And the 16K of video RAM, it starts at this address, B800 0, and is generally mapped to the full address range, although only uses 16K of that. And the monochrome display adapter only uses 4 GK of RAM and is slightly lower in RAM at the B0000. Now, in the first breadboard PC series, I did actually show how to produce a monochrome display adapter. And if you go to the channel playlists, you'll be able to actually see that video 13 and the original PC series is actually all about building out the monochrome display adapter and going into some of the background there. So, I include the link for that video at the top of the video up here if you want to go and have a look at that one.

So CGA outputs were digital red, green, blue, and intensity. And this was the type of connector it had. So it's different from the video connectors, the VGA video connectors we may be more familiar with. It supported 16 colors. And the IBM hardware display had special adjustment for dark yellow to make it appear as brown. So you'll notice that generally these colors have got AA but when we get to brown then rather than having AA here for dark yellow in fact it has a reduced green value here which makes it more of a brown rather than dark yellow. And if using the television composite output or RF modulator for NTSC television, then the colors weren't quite as vivid as they would have been on the digital monitor. And these charts

are actually in the Wikipedia CGA article there referenced at the bottom. Now, one issue is that the CGA text mode wasn't really as good as the monochrome display adapter. So, the MDA was really designed more for business usage and CGA was only using character cells of 8x8 pixels whereas the monochrome display adapter uses 9x4 and VGA in fact uses 8x6 or 9x6 in some cases. So these are some of the fonts and I'll reference where we get these fonts from a little bit later. So the original CGA default was would have been at 640x200 pixels and that would give us 25 lines of 8x8 pixels. Then there was a thin version of

that font. So the the wide version was really designed more for output to lower-end monitors and to TVs for example. and the thinner one perhaps was more suited to more modern monitors. So we can switch between those two depending on what we think. Then the monochrome display adapter was based on 9x14 pixels. So you

can see these characters are a bit more aesthetically pleasing. And then VGA was actually based on 8 * 16 or 9 by 16. 9's just a little bit awkward and uh we'll just stick with 8 x 16 in this series.

So, as far as the text and graphics modes, so the 40x 25 black and white and color modes are really designed more for outputting to TV screens and composite monitors cuz they are unlikely to be able to handle the higher frequency signals needed for the higher resolution 80 column modes. And we'll be looking at the graphics modes later on in the series. We're not going to worry too much about the graphics at this point in time. Although CGA graphics modes are quite limited, the AT88 MPH demo is able to actually use tricks such as changing the dynamic RAM timing and composite video tricks to get 256 colors or even 1,024 colors out of the base of 16. And

there's a couple of sites here, the links I'll include in the description below. So one explains how this was actually done. In particular, it's sort of using tricks of changing the color of dots when using the composite output. And there's also the link of the demo there itself. So, you can sort of uh see that if you want.

It's not just only the graphics, but also the sound as well. Now, trying to hook up CG hardware to modern video capture hardware is a bit tricky. So what I'm going to be doing is using VGA output. Now VGA was introduced in the IBM PS2 range around 1987. So about 6 years after the original PC. And the main difference

with this is it outputs analog red green blue color signals generally between about 0 volt and 0.7 volts. Whereas the CGA, EGA and earlier video standards were just using digital outputs either 0 5 volts. Now, there were TTL levels for the horizontal sync and vertical sync. And this really replaced the MDA, CGA, and EGA monitors, and is probably the video standard that, you know, most computers and monitors can probably still be backwardly compatible with. It's based on a 256 color palette out of a possible 262,000 colors based on six colors per bit, so 18 bits. And the fonts were available in nine wide or eight wide and 16 high. So generally they looked better

than the CGA fonts. And you'll notice the 15pin miniature subd connector. So female for the computer. And there's

some sites here where tinyvga.com where you can get the various video timings. So the 640x480 which is typically the resolution most people know VGA as runs at 60 Hz but that's generally only used actually at graphics modes. Uh if you used it with characters then you get 30 lines of 80 characters across the screen. So in fact when using the text

mode normally VGA is 640x 400 at 70 Hz and that gives us 25 by 80 characters. So, we're going to be using VGA output just because that's what we can use to plug into LCD monitors and video capture hardware. There are devices out there for CGA, but it seems unnecessary step to really do. We're not trying to build

a historically accurate CGA card, just a card that is able to run in our breadboard PC. Now, one of the chips that was used in a lot of early PCs was the Motorola 6845 cathode ray tube controller chip or CRTC. And it was used in a lot of the early computers. So, I believe it was used in the Commodore PET, the BBC Micro. And it is used in the monochrome display adapter and the color graphics adapter for the original PC. Now, the 6845 chip was a lot more

flexible and not as constrained as some of the later ones. So, there was a 6847 that was used in the Dragon 32 and the Tandy Color computers. And unfortunately, that was a bit more limited, wasn't as flexible. And I think that was probably one of the reasons why some of these computers that used it weren't as popular because the graphics modes, although they were simpler for the system designer, they weren't really quite as flexible as these other ones. So, the chip can address up to 16K in characters with up to 32 lines per character cell. And though the chip was designed

for character-based systems, it can be used for graphics. And in particular, the Hitachi chip that we're using here, and the ones that I would recommend you use, is able to actually work at higher frequencies than the original 6845. And it can act in fact work at over 3 MHz character clock, which happens to be the 25 MHz dot clock divided by 8.

When talking to some monitors, the horizontal sync and vertical sync signals may need to be inverted for some modes, although modern VGA hardware seems to be able to cope without actually having the inverted values. If you're using older monitors, then you may still need to worry about the inversion of this. And we're not going to be worrying about the light pen. Now, the chip actually takes up two addresses, and there's one register for the address of the register you want to talk to, and then the other one for the data. And there's up to about 19

registers in there. We're going to be using vertical sync. So the VS vertical sync uh probably with text mode 70 hertz refresh rate. The horizontal sync with the dot

plot we're using will be working out about 31 12 kHz. Now a lot of these timings and things are based on the original cathode ray tube controller sort of TV type monitors. And if you want to know a little bit more about that, if you've only ever used LCD monitors for example, then there's a good explanation of that the link there which explains yeah how the cathode ray tube was controlled by the magnetic coils and why all these various timings were necessary. And there's also a timing calculator. The various register values you can see down here that are necessary. If you type in the video refresh frequency you're looking at and the clock frequency, this little calculator here will work out what the various register values are.

Now, you tend to need to tweak these a little bit, but it gives you a good starting value. Now, with a chip, the MA0 to MA13 are the address outputs. We've got the D0 to D7 which are the data bus to the main CPU and the raster address 0 to raster address 4 that controls which line in a particular character which row of pixels we're actually going to be displaying at a point in time and we can actually make use of these addresses as well for doing graphics. So that's effectively chooses which line within a character cell we're currently addressing. Now the Hitachi chip that we're using has various additional settings. So in particular being able to delay the cursor and the display enable outputs. So the cursor and display

enable outputs are necessary to talk to the pallet chip and to provide the flashing cursor on the screen. And in fact within the text mode that the MA0 is not mapped directly to the zero address line of the video RAM. We actually map zero to one and vice versa all the way up the range. And the reason for that is we actually use the character clock divided by two as the video address zero to switch the RAM between the character and the attribute value. So each character cell takes up

two bytes, one for the character value and one for the attributes. So CJ has hard-coded ROM based fonts and 16K of video RAM. So the maximum resolution of CGA was 640 pixels across of 200 lines using 8 by8 characters at 60 Hz with the 14.3 MHz doc clock and it supported up to 80 columns by 25 rows with the one byte character one by attribute. So 4K of RAM was required for the text modes. Then

the 6845 was not capable of doing more than about 128 rows or addressing 128 rows. And so what the CGA graphics card did is limit it to 100 rows and use one of the RA raster address lines to switch between a lower 8K of RAM and a higher 8K of RAM. So effectively it sort of interlaced the lines on the screen were based off two chunks of 8K. The twocolor high resolution graphics mode required 16,000 bytes and the fourcolor mode which was at slightly lower resolution 320 dots per line was also 16,000 bytes.

Now, we're going to be using a VGA video digital analog converter pallet chip rather than using sort of resistor digital analog converters, which I did use in some of the early videos for the nanomp, but it's much simpler for video output for LCD monitors to actually use a modern VGA digital analog converter. And although we're building this to be completely CGA compatible from a software side of things, it will be producing VGA video output. they'll actually be doing 640 pixels across with 400 lines with an 8 by8 font. And what that will mean is that because CG originally was only 200 lines, what we will do is we'll double scan the lines to 400 and we'll effectively ignore the RA0 and we'll use RA1 instead. So

effectively what that means is we just have the same line output twice by ignoring RA0. Now some of the background information on here, the IBM color graphics adapter manual. I'll include these links in the description below the video. And there's also a Keycad

schematic diagram of the original CGA graphics adapter as well. So if you want to have a look at building a completely compatible one, the PCB and etc from here would actually help you to build one of those. And the fonts which are being used within the ROM here from the fonts at int10h.org or and the Frapped Font editor can also be used and the Wikipedia article here has the CJ graphics modes we'll be looking at in later on in the series. So the main reason why the IBM PC I think was such a success was because IBM published detailed information which would allow other companies actually to reproduce and to build similar compatible devices. So the

CGA or color graphics monitor adapter as it was called in the early stages is no different. And the information in here includes not only the low-level information you need and all the register details which we'll be reviewing in a minute. Includes also the 6845 register configurations. Now those aren't going to be useful for us because those would be for a CGA refresh frequencies which are not going to be appropriate for the VGA video output.

And then there's also the logic diagrams. Now, I'm not going to be going through these logic diagrams in as much detail as I did in the previous series. There'll be a link at the top right hand corner of the screen for the original CGA video adapter series. This started I think at around video 45 on the original breadboard PC series. So, that link will be at the top right hand corner of the screen and will be in the description. below. So, in

the first breadboard PC series, I went through the details of this in a lot more detail and I will still include the slides in presentation here, but we'll go over them quite quickly. But it's useful to be able to come back to should we need to. So, this is one of the overview diagrams and the main difference here really is the 6845 we're using the Hitachi chip. It's able to

actually go a bit faster than the original 6845. So up to about 3.7 MHz and has a few extra configuration options to delay some of the signals. We're not going to be using the overcan which is really was on TVs and things to allow the color border to be set around the image. Not really an issue with modern VGA hardware. And rather than having the color encoder doing the RGB and intensity, we're going to be using the VGA compatible video digital analog converter. And that is actually able to do up to 256 colors and uh 262,000 color palette. We're not going

to worry about the composite color generator cuz we don't have any compatible hardware to plug into it. So of all the registers we're going to be doing most of the registers although the light pen we're not going to be worrying about. This is the information about the alpha numeric mode. two bytes for the character and the attribute bite and which values are doing which. There is a jumper for determining whether or not we show the thin characters or the wider characters. The thin are I think five

pixels wide. The wide are 7 pixels wide. So the descenders tend to be 2 pixels wide. Graphics modes we're not going to be covering at this stage. And color select is not really that important for the text mode. But the mode control register is how we switch between the 40 column mode, 80 column mode, and the various graphics modes. So we will be needing to worry about that as we go through. There is a status register, but

generally there's only two bits there. One which says whether or not video sync or the horizontal sync I think is currently active. There are six logic diagrams and in the previous series which I'll have included the link up here and I have gone through this in a lot more detail. I'm not going to do that now cuz we've already got a design that works and all we're going to be doing is simplifying it. But there is a lot of background here and going through trying to work out how this works. So this is with the cathode radio controller chip and the various and the multiplexes for the video RAM. Then we

have a lot of the attribute and character latches going into the character generator ROM serializing the bits for the characters and then also serializing the graphics which we're not going to be woring too much about at this point in time. Color register as well which then outputs the video signals. The clock timing is quite complicated although we don't really need to worry about it too much because the clock timing here is different from what we're going to be worrying about. We need to worry about the video and IO port address decoding here. And in fact, one of the things that CGA does is that the blinking of the cursor and the character is not handled by the 6845 CRTC. It's actually done externally. I suspect it was so

that the cursor blink and the character blink could be coordinated. Most of this is related to the dynamic RAM refresh and timing and the mode control register which controls the various video modes. So this sheet is mainly to do all the color composite generation. So this is what was used in the AT88 MPH demo when using a composite video monitor, but we're not going to be worrying about that. And this is the bus interface with just the CPU data bus buffer. So let's take a look at the KeyCad schematic. This is the current

breadboard PC version 2 schematic. Now, the CGA video controller has not been modified really yet. And you can see down here, what I'm starting to do is to look at replacing some of the logic here with one of the 100pin PLLDs that I've been investigating on the PL series. So, in fact, this ATF50400 pin version has 64 macro cells, and that will hopefully allow me to replace the clock, the various video attribute outputs, the color latch, the attribute, the LD control register, the blink block, and also the attribute latch as well. So, this one chip, I think, should be able to replace these chips here. And a lot of the connections between here are because we don't have enough pins on these chips.

And so, hopefully it should be a lot simpler once it's all sorted out because a lot of these interconnections are no longer necessary because they're all done within the chip here. And then one of the 44 pin chips that I was also doing earlier in the PLLD series I think will be capable of replacing that PLLD that PLLD and this additional flip-flop. So that won't be quite as significant but that will again significantly simplify the wiring around here because the reason why we needed these multiple PLDs because of limitations of the flip-flops and only being able to have one clock on these chips. So if I have a look at the layout on the breadboard. So I've laid out the design

as it stands at the moment. This is how it was in the version one of the breadboard PC. So you can see we've got a 15 pin VGA connector up here. The video pallet, the CRTC here, the video RAMs down here. Then we've got some address buffering, data bus buffer, the IO address decoding over here. So, what I'm going to be doing is using one of these 100 pin chips on one of these breadboard adapters. So, this breadboard

adapter will go over here somewhere. I may need to add an extra power rail here to space the pins out appropriately. And then this is the 44 pin version of the chip on a DIP adapter and we should be able to plug that in down here particularly once we got rid of this chip here. So, I'm hoping that I certainly should be able to fit it in one less breadboard here. And I may even

be able to get rid of one of the breadboards here if I can shuffle things around. Most of these bits over here, there wasn't really any great advantage in replacing these chips with these complex PLLDs just because of the way how the pins and things worked out. So, I'm going to go off and design that and see if I can consolidate the output side of here onto this one chip here. And what I'm going to be doing in the next video, we're going to be building out basic video controller. So, I'll be wiring in the cathode rated controller, the IO port, going to start configuring the main output PLLD, which will include the clock. We're going to be using the 25 MHz dock clock from the main system board. So, this will mean

that the PC when running in turbo mode will be coordinated with the video logic here. And we'll also be wiring in the digital analog converter. And once we've actually configured this, all we're going to be doing is feeding the CRTC address output signals directly into the digital analog converter. And that will

just produce a fairly simple test pattern. And this is the memory map. We will be needing to add the VGA pallet registers earlier on in the CGA memory map. So this is not quite as compatible, but the BIOS will actually initialize all of this stuff. And then after the initialization, then this will look completely like a CG video card. And

this is the pattern we'll be expecting to see after we've got the video DAC configured. Then the next step is to actually build out the character generator ROM. We then need a shift register to take the individual raster images of each row of the character and output that being clocked by the dock clock. And now these various PLLDs we had previously, the attribute multiplexer, CGA control register, video out PLLD, attribute latch PLLD, and also CGA color register. These are all going to now be replaced by this one ATF-1504 complex program or logic device. So what goes on inside here will still be quite tricky, but the actual external interface to this is going to be a lot easier. again the IO port to be

unchanged from the previously we're making use of the CGA fonts out of inth.org and this would then be the sort of output we would expect to see. So there's no video RAM at this point in time. We're only going to be outputting the character generator ROM, but it does allow us to check that we've got the basics of the video circuit. So, I'm going to break the video here and in the next video, what we'll be doing is actually building out this so that we can actually get this test pattern. So, in the meantime, I'm going

to be redesigning our card here. So, we're using our 100pin ATF504 complex PL here and the 44 pin version over here. And hopefully you I might be able to shuffle things around a bit perhaps that we can actually move things around so that we don't need this board on the bottom here. So, thanks for

watching. If you don't want to miss out on future videos, then please hit subscribe and if you found the content interesting, please hit like. It just helps to make the videos available to more people. Thanks for watching.

2025-05-09 06:01

Show Video

Other news

Inside Railway Maintenance: Practices, Strategies & Future Technologies 2025-05-14 04:24
Browser Fingerprinting Masterclass: How It Works & How To Protect Yourself 2025-05-11 01:10
The rise of Cursor: The $300M ARR AI tool that engineers can’t stop using | Michael Truell 2025-05-10 04:13