Teletext...
...for DOS!

Logo

If you are using Windows - then you might be interested to try WinTTX...?


If If you use Teletext for DOS within the !PC environment on a RiscPC's x86 co-processor, you can now (with the help of the ARMEdit module) access the RISC OS IIC system directly - no more changing leads around!
Sorry, this doesn't work on 'real' PCs, you'll need to build/use the parallel lead described. :-)


For somebody who spent five years attending an all-boys boarding school, it is amazing how many things really bug me at night. One such thing is the noise of my computer. The fans, the harddiscs, whatever. During the day it's a minor background noise. When I'm trying to go to sleep, it's like having my bed stuck in the central-reservation of the M25 at rush hour...

I understand the concept of stress - mechanical, mental, whatever. So in order to simply 'look' and see what's on teletext, I don't really fancy powering up my RiscPC unless I plan to use it for a while. That left me with two choices. I could either use one of the myriad of other RISC OS machines; or I could use my laptop...

In favour of the RISC OS machines was that my software already existed, would fit on a floppy, and would work.
The minus point? No available monitor. I didn't fancy any plug swapping.

In favour of the laptop... Well, it had a built-in display (well, three quarters of a built-in display, the lower quarter doesn't work!). And, well, that was, like, totally, IT!
No software, no lead, hell this thing didn't even have an IIC port!
Which sounds, to me, like an interesting challenge.

My first step was to construct an IIC lead. After a look at my options, we were down to parallel or serial. I only needed two inputs and two outputs (yes, I've wired the clock as an input, it isn't beyond the realms of possibility that the laptop AND the RiscPC will daisy-chain the IIC bus in the future). Looking at it, I decided on the parallel port. Mainly because I had a spare printer lead I could cannibalise. That, hooked to half of an old Econet lead, and there we had it...

Parallel wiring
The parallel wiring. I've not yet bothered to unsolder the parallel part.
Note the diodes, third and fourth pins from the left, on the parallel port.
Do you think you can build one of these?
You'll need to in order to use this software!

If the diode seems "wired weird", remember the IIC bus floats high and we're interested in protecting our hardware from an external source pulling it low while we've set it high.

I don't know a thing about 80x86 assembler, and after suffering it for a few days at college (nearly ten years ago), I DON'T even want to learn it. So I cobbled together some bit-bashing software in C.
I make it sound simple. Actually it was a few days of pure hell, trying to correlate the IIC specification to code, while keeping in mind that control signals on the parallel port are sometimes inverted just to p*ss off us programmers.

One thing went out the window immediately, and that was the whole concept of timing. The "sleep()" function works in seconds, and the "delay()" function works in milliseconds. The BIOS is no good, it's timer is something really weird like eighteen-and-a-quarter ticks per second.

I tried a couple of experiments. Writing bits to a memory array was fast, writing bits to the parallel control register was slower; this proving to me that the parallel port was clocked slower than the main memory... good.

The IIC bus can operate up to a maximum of 100kbit/s. The minimum LOW period should be 4.7µs and the minimum HIGH period should be 4µs - so obviously I should try bit-bashing the data right to the port. I had a brief worry that it'd be too slow, but then I remembered that there was a parallel lead for my teletext receiver when I first bought it. If an 8MHz A3000 (ARM2) and discrete-logic parallel port can fake an IIC bus, surely-to-god this thing can do it.
[A week later... I ran the IIC stuff in single-stepping mode in the debugger, which must have achieved about one bit per second (and giving me RSI!), and it still worked!
Interestingly running Teletext (for DOS) in a DOS window within Windows 3.11 on the PC co-pro froze Windows nastily. Oh dear! I put this down to an "emulation issue"
]

The greatest thing about IIC is that the master (that's us) clocks data received from the slave (that's the teletext receiver). So we don't need to worry about losing sync along the way. If, at the end of a 'line' we spend a few extra processor cycles resetting stuff, it's no big deal, we're providing the clock so it'll wait for us. Not forever, I don't think, but for long enough.

You can't imagine the joy when, after setting the teletext receiver up on the RiscPC (my code didn't tune yet), and then running TELETEXT.EXE after swapping leads, I got a dump of CNN's rolling header. Yay!

This was cobbled together into a basic frame-fetch loop, and thus Rick's Teletext v0.00 was born.
Quite frankly, the rest wasn't difficult. :-)

PC screenshot
My Teletext (for DOS) running in a window, via the PC card.
You can also see !Teletext displaying a reduced-size version of the picture as it is supposed to appear;
that's Larry King (in case you didn't know), CNN p208.
One thing that was slightly more difficult was the tuning control. After disassembling the module, I was faced with rather a lot of code to change channels. Originally I started tracing through the code, but soon had the much better idea... patch into the module at the point of sending the bytes to the IIC bus, and intercept them.
There is one read from the CITAC that I've no idea what it does. Otherwise, it's a write to the CITAC. Twice. The values have a definite pattern, so after reading five, I knocked out some BASIC code to generate a C-style struct that I could write to a disc and drop straight in to my Teletext source. The Teletext module does not use a fixed lookup table for the channel tunings, so I guess all that the code is, at least in part, related to converting the channel number (21-69) into the actual tuning values.

I don't know if similar software already exists. I like to think this is something a little bit special because, not only does it do colour (and flashing text), it also attempts to convert the teletext 6-block mosaic to something vaguely-akin in the PC-ANSI character set. And, talking of character sets, this supports the "national option" characters for England, Sweden, Germany, France, Spain, and Italy (the 'western european set') - so viewing a German-language page will show the correct thing, like "überbabe" instead of "¾berbabe", or something...

PC screenshot
Teletext (for DOS) displayed on the screen of my laptop.
Here, we are looking at Hessentext's index. Note the correctly accented letters, like "börse".


What's new since the last release?

The last public release was v0.11 on 2004/05/02. Since then...

 


Software status:

  Software name        : Teletext (for DOS)
  Latest version       : 0.15

  Archive size         : 118806 bytes (Zip deflate archive)
  Classification       : Freeware
  Registration cost    : None

  MS-DOS compatible    : Yes
  Windows 3.xx compat. : Yes, in a DOS window
  Windows 9x++ compat. : Untested, should work...

  Requires...          : 80286 or later, and DOS with hardware access to
                         the parallel port. This is most 'common' PCs,
                         but there may be 'issues' with NT or DOSEMU if
                         they restrict parallel port access.

                         YOU'LL NEED TO BUILD YOUR OWN PARALLEL LEAD
                         IN ORDER TO USE THIS SOFTWARE... INSTRUCTIONS
                         INCLUDED WITHIN THE ARCHIVE.

  Written in           : C (compiled with TurboC++ v1.0)
  Libraries            : Standard, ARMEdit, and my IIC driver library

 


Teletext download
ttxd015.zip (116K) Version 0.15
2004/06/25
Teletext (for DOS) v0.15 with some examples.
THIS SOFTWARE DOES NOT WORK UNDER RISC OS!
IT REQUIRES SOME SORT OF PC RUNNING (MS-)DOS.

 
  Aleph One's !PC works fine, make sure it has direct access to the printer port. In the Config file, make sure that it says:
# Use Host's parallel port for PC
DirectParallel On
Alternatively... Use the ARMEdit module to access the RISC OS IIC directly!
 

 

If you aren't entirely sure about the parallel wiring, here is a diagram (this is also supplied with the software):

Wiring diagram; GIF 6K
This image has been taken from the wiring.exe software, which is why it says to press 'I' or 'PrintScr', etc...

The WinTTX parallel wiring is slightly different - in this case, pins 15 and 16 are joined to allow auto-detection of the teletext cable. WinTTX will work with the lead as detailed above, it will just ask you to check that the lead is connected every time you start the program.

 

Easter eggs

People that know me will know I'm fond of Easter Eggs.
This software has a few.
All I'll say is... press Shift and F1 together. That oughta give you a good head start!

 


Return to Teletext software index
Copyright © 2004 Richard Murray