Inside the STE Part1 - Introducing the STE
Copyright c.1991 A Greenwood
There is little doubt that Atari's STE is a significant improvement to the successful ST range, but many people are still unsure as to what this relatively new machine has to offer. As an introduction to a series of articles on programming the STE, this article explains just what Atari have added. Further articles will explain the tricks and techniques needed to program these extra features, with documented 68000 source code for example programs and STE utilities.
Overall, Atari made improvements in seven main areas on the STE:
- A new version of TOS, version 1.6 or 1.62
- The addition of the Blitter chip previously found on Mega STs
- A new DMA sound chip with volume and tone control
- An improved video shifter chip.
- A Cookie Jar to allow programmers to identify the machine.
- Two new ports supporting four extra joysticks plus paddles.
- Use of SIMM cards for easier memory expansion.
TOS 1.6 (and 1.62)
This version of TOS includes all the features of TOS 1.4, the latest version of TOS for the ST, but is slightly different internally to allow for the new hardware. The main difference from a user's point of view is the inclusion of a menu item to allow use of the blitter chip to be selected from the desktop, and the resulting improvements in speed when the blitter is on. Other enhancements, such as the new file selector and the MS-DOS compatible disc format, are the same as for TOS 1.4, and are explained in the STE addendum sheet supplied with the machine. TOS 1.62 is just TOS 1.6 with the bugs which were present in the original STEs corrected.
On the programming side, this version of TOS can be treated exactly as TOS 1.4, with the same additions to the GEM libraries. The changes made to accomodate new hardware are transparent to the programmer, ie they do not affect the way the operating system appears compared to TOS 1.4. For most commercial programming languages, for instance Devpac 2 and Lattice C, updated libraries and macros for using the new GEM calls are included in versions released after the new TOS.
Blitter Chip
All STEs have Atari's Blitter chip as standard, where previously it was only found on the Mega STs. The Blitter chip is a direct memory access (DMA) device which uses the STs bus to transfer data directly from one part of memory to another more quickly than is possible using the 68000 processor. It does this by using the DMA controller to take control of the 68000's bus, either in bursts interleaved with the CPU or until it has finished. In this way the Blitter chip can be used instead of the processor for fast movement of data.
The Blitter chip can also manipulate the data in several ways as it is transferred. Since data transfer is bit oriented, the source data can be shifted to produce the destination data, previously one of the hardest parts of bit-mapped graphics programming. The Blitter also applies one of 16 different combinations of logical operations to the source data (including straight copy, of course), and can also combine the source data with 16 word length half-tone RAM registers for special effects.
When copying data the Blitter chip can skip a specified number of bytes (only even numbers allowed, ie word boundary) after both source and destination words, which is useful when copying a single bit plane in low or medium resolution. The Blitter transfers data in lines, and can also skip a set number of words at the end of each line - again, this applies to both source and destination. The Blitter chip also allows the source and destination data to overlap, so if necessary a section of memory can be read, manipulated and written back to the same area of memory
When it is enabled, the Blitter is used by both GEM and some of the A-line routines, though not by the sprite routines. Use of the Blitter in this way can be selected either from the desktop by using the Blitter menu item or from within a program by using Xbios call 64, the blitmode call as found previously on the Mega ST. The Blitter can also be used directly, for example for custom graphics or sprite routines, which although complex at first can produce fast graphics with less code.
DMA Sound
The new DMA sound chip on the STE is in addition to, and not instead of, the original Yamaha PSG chip. The new hardware uses a digital to analogue converter (DAC) to play 8-bit sound samples at one of four different frequencies, from 6.25 to 50 kHz, in either stereo or mono. By comparison, CD players work at 47 kHz, but with 16-bit samples - this gives some idea of the quality of the sound produced.
The sound chip is another DMA device, fetching samples directly from memory for output. This means that less processor time is needed for sample playing, which is quicker and of better quality than with the original sound chip.
Playing a sample is achieved by loading the sound chip's address registers with the start and end address of the sample and then setting the enable register to either play the sample once or repeat it. The DMA sound chip is connected to Timer A, and this can be used in a similar way to the hblank interrupt to play a sample a specified number of times, and to link samples together to produce continous sound. The address registers on the sound chip are buffered, allowing the address of the next sample to be set while a sample is playing, thus allowing samples to be joined seamlessly.
Comprehensive volume/tone control is also provided using the new microwire interface connected to a volume/tone chip. This allows master volume, left and right volume, and bass and treble to be set through software. The sound output is via stereo RCA jacks on the back of the machine, ideal for connecting to a hi- fi.
So far, the sound chip has been the best used feature of the STE, with many samplers already compatible and more and more software appearing with DMA sound as an option. Hopefully this feature of the STE will also be used in conjunction with MIDI and computer music, where the ST is almost standard.
Improved Video Shifter Chip
The STE's video shifter chip is an enhancement of the old chip, providing access to a greater range of colours, vertical and horizontal hardware scrolling, and accepting an external sync.
The colour range has been increased from 512 to 4096 by using four bits instead of three to represent the red, green and blue components of each colour. To maintain combatibility with old machines, the least significant bit of the new 4-bit colour component is actually the most significant bit in the colour nibble - if this were not so all 3-bit colour values from old STs would appear at half intensity as the maximum intensity was 7 and is now 15. This feature is useful for graphics applications, particularly scanning and video digitizing where a full 16 shade grey scale can be obtained (see 'User cover disc 56).
Vertical scrolling is achieved by allowing the screen base to take any address, rather than being on a 512 byte boundary as before. This is done using an extra register for the low byte of the screen address, which does not affect the screen until the next vertical blank. This means the screen address can simply be changed to point to the next screen line, giving smooth vertical scrolling.
Horizontal scrolling is achieved through two new registers. The first sets the length of a screen line past the edge of the screen, allowing a screen in memory to be larger than the actual displayed screen. This means screen data can be scrolled on from the sides of the screen. The second register indicates which bit of the first screen word should be used as the first pixel on screen. This allows the screen to be bit scrolled horizontally up to 16 pixels, at which point the base address can be changed to continue scrolling.
Using vertical and horizontal scrolling together to produce four-way scrolling requires careful combination of both methods, due to the different way the registers are used. The horizontal scrolling registers take effect immediately, while the low byte of the screen address is not used until the next vertical blank.
Using the hardware scrolling on the STE, smooth full colour full screen scrolling is possible with very little code, and using only a small amount of processor time. However, this method usually requires more memory.
The external sync input provided via the monitor port allows the STE's video shifter to synchronise with another device. This is particularly useful in video genlocking, as the screen display can be synchronised with video equipment, and has already been used on at least one such device. Without this feature the video shifter chip often has to be prised out and a circuit board added to allow the genlock to synchronise the computer with the video device.
The Cookie Jar
The cookie jar is a welcome addition to the STs system variables which provides a list of 'cookies', each of which gives some information about the features available on a particular machine. This information includes which CPU the computer has (68000 - 68040), whether a Blitter chip is present, whether the machine has DMA sound and which model the machine is. This allows applications to selectively use these features if they are present, and should help with integrating STE features into ST software. Presumably the cookie jar has already been used in software which is STE compatible.
Another feature of the cookie jar is the provision for applications to add their own cookies. This means that other devices added to the ST can use the cookie jar to inform programs that they are present.
Controller Ports
The STE provides two new ports on the side of the machine which can be used in a variety of ways. The intended uses are either four standard joysticks (two per port), two paddles or a light pen or light gun. These ports are connected directly to the the 68000's bus, instead of adding extra controller chips, and can be written as well as read. The provision of four 8-bit Analogue to Digital Converters (ADCs) for the paddles, and the fact that the outputs are driven when the registers are written to will no doubt give rise to other uses for these ports.
Since the two ports both use 15-pin sockets adaptors will be needed to connect most controllers. How well used these ports become depends largely on games designers and programmers (for joystick, paddle or light gun use) and applications programmers (for light pen use) but the possibilities include up to six player games, analogue joysticks for flight simulators and light gun games. Another possibility is the use of enhanced joysticks, perhaps with more than one fire button.
SIMMS
RAM on the STE is on up to four Single Inline Memory Modules (SIMMs), which can hold either 1/4 megabyte or 1 megabyte each. These are easy to remove and install, and are cheaper than other ST memory upgrades. This allows the computer to be upgraded to 1 megabyte using 1/4 megabyte SIMMs or 4 megabytes using all 1 megabyte SIMMs. Mixing the two sizes of SIMM is possible, but requires extra software to ensure the computer knows how much memory it has. SIMMs are easy to fit by simply removing the STE's lid and carefully clipping the SIMMs into place.
It is often possible to get cheap 1/4 megabyte SIMMs, as anyone upgrading over 1 magabyte will have the old SIMMS left. This can make upgrading a 520 STE to one megabyte cheaper than buying a 1040, and may result in more software making use of extra memory, particularly with the memory overheads associated with sample playing and hardware scrolling.
Programming the STE
The rest of this series of articles will concentrate on programming the STE, covering hardware scrolling, colour, the Blitter chip, joystick ports, the cookie jar and GEM, and starting next month with DMA sound and volume/tone control.