During the development of the ZX Spectrum SE, it was originally planned to replace the ULA (which creates the display) with something a little more advanced. However, it wasn't until nearly a decade later after the ULA was reverse engineered that this actually became possible. ULAplus was finally realized in an FPGA core by Alessandro Dorigatti in February 2011. This core is used in all of the current implementations.
FAQ
What is ULAplus?
ULAplus is a plug-in replacement ULA for the ZX Spectrum which increases the total palette to 260 colours. It is scheduled for inclusion in the production Harlequin SE, but you can use it right now in FPGA clones or via emulation.
How is this different from Spec256?
Spec256 was based on a non-existent 64-bit Z80 co-processor which cannot easily be achieved in real hardware. Every sprite in every game must be re-coloured individually by hand. A total of around 21 titles are supported by Spec256 and emulation is unreliable at best. A total of around 20,000 titles are supported by ULAplus and it is supported by mainstream emulators.
Which emulators support ULAplus?
Currently there are emulators available for Windows, Linux, MacOS X, and iOS and ULAplus is becoming a must-have feature. Among the first emulators to offer support were BASin (the Sinclair BASIC IDE), an older version of Fuse (via patches), SpecEmu, Spud, and ZXSpin.
Currently there are emulators available for Windows, Linux, MacOS X, and iOS and ULAplus is becoming a must-have feature. Among the first emulators to offer support were BASin (the Sinclair BASIC IDE), an older version of Fuse (via patches), SpecEmu, Spud, and ZXSpin.
How can I use Fuse with brand-x Linux?
The simplest way is to use the FBZX Debian package (with Debian based distributions), or to compile the source (with other distributions). If you want to use the patched version of Fuse (which is not the current version) the following applies. The Fuse link is for the 32-bit Ubuntu binary and it requires libspectrum. The source is also known to compile on CentOS. The source for libspectrum is available here. Note: On a default Ubuntu install you'll need to sudo apt-get install the following; bison, flex, libsdl1.2-dev, then ./configure --with-sdl. You need to build libspectrum first. If you are using Ubuntu 9.10 "Karmic Koala" be aware that there is a problem with the SDL sound system which causes Fuse to hang. A workaround is to install the libsdl1.2debian-pulseaudio package in place of the default ALSA one.
Does switching on ULAplus support in an emulator give games more colours?
Not by magic. You need to load a palette file first. There are individual palette files for some titles and generic palettes that should work with other games. Feel free to submit your own palette files.
How do I use the palette files?
To get the full 64 colours on screen a certain amount of hacking is required as most games do not use the FLASH and BRIGHT bits. However, up to around 32 colours are possible with no hacking at all. Simply load a palette file then load the game. In certain emulators you may need to switch-off auto-load to prevent the machine being reset. A generic palette file is available that should work reasonably well for most titles. Game-specific palette files will be added as they are released. You'll have to get the actual games elsewhere.
How do I recolour a game?
A palette editor is available to enable you to create your own palettes. Spud and ZXSpin also have built-in palette editors. The palette format is a BASIC file with an embedded machine code routine and the colour data. Just load the palette then load the game. Please submit any palettes you create for inclusion in this site to cheveron[at]gmail[dot]com. Improvements to existing palettes are also welcome.
Can I use it from BASIC?
Yes. Guesser has kindly produced a guide to using the mode in BASIC. Ref has kindly translated it into Turkish. If you're interested in the dark art of custom ROMs, you can install the SE Basic ROM which provides a default palette (similar to the standard Spectrum palette) and a PALETTE command to switch the mode on and off and set the colours.
Is it just a simple palette swap?
Yes.
Is there a way for the Spectrum to automatically detect if ULAplus is present?
Yes. Write a palette register, PAUSE 1, and then read it back. If FFh is returned then it's a normal ULA. OUT 48955,0: OUT 65339,0: PAUSE 1: IN 65339 will return 00h if ULAplus is present.
Does it remove attribute clash?
No.
Are there any tools for converting 24-bit images?
Yes. AY Chip has created SCRplus, a conversion tool for Linux and Windows which uses the SDL image library (and other unlisted dependencies). It is still a work in progress, but already the results are excellent. Ref and Claus Jahn have created their own Windows conversion tools based on the SCRplus code, and Dunny has created MakeSlideshow for building slideshows. Note: you can only click Add once, but you can select multiple items.
Yes.
Is there a way for the Spectrum to automatically detect if ULAplus is present?
Yes. Write a palette register, PAUSE 1, and then read it back. If FFh is returned then it's a normal ULA. OUT 48955,0: OUT 65339,0: PAUSE 1: IN 65339 will return 00h if ULAplus is present.
Does it remove attribute clash?
No.
Are there any tools for converting 24-bit images?
Yes. AY Chip has created SCRplus, a conversion tool for Linux and Windows which uses the SDL image library (and other unlisted dependencies). It is still a work in progress, but already the results are excellent. Ref and Claus Jahn have created their own Windows conversion tools based on the SCRplus code, and Dunny has created MakeSlideshow for building slideshows. Note: you can only click Add once, but you can select multiple items.
Have I seen some of those screen shots before?
Tom-Cat has developed a tool-chain for converting hi-res Commodore 64 pics. If you ask him nicely in coldfront IRC in #spin (ask for the entry code in #zx) he'll send you a copy.
Does ULAplus work on real hardware?
ULAplus is designed to work on real hardware. It has been available as an FPGA core since February 2011, but the plug-in replacement is not yet available.
How far advanced is the development of the ULAplus hardware?
The original ULA has been replicated with 100% accuracy in a CPLD.
How is the BORDER colour determined?
In the standard Spectrum display it has the same value as the equivalent BRIGHT 0/FLASH 0 PAPER colour. In the Timex hi-res display it has the same value as the equivalent BRIGHT 1/FLASH 0 PAPER colour.
Does ULAplus support models besides the 48K?
In emulation all models are supported. In hardware you will need a different version depending on your machine. The 48K ULA will be the first model.
When can I get a real one to plug into my Spectrum?
When it's ready.
How will games that make active use of FLASH be affected?
FLASH doesn't work in the 64-colour mode. You get extra colours instead.
How do you switch on the 64-colour mode?
OUT 48955,64: OUT 65339,1.
How is the BORDER colour determined?
In the standard Spectrum display it has the same value as the equivalent BRIGHT 0/FLASH 0 PAPER colour. In the Timex hi-res display it has the same value as the equivalent BRIGHT 1/FLASH 0 PAPER colour.
Does ULAplus support models besides the 48K?
In emulation all models are supported. In hardware you will need a different version depending on your machine. The 48K ULA will be the first model.
When can I get a real one to plug into my Spectrum?
When it's ready.
How will games that make active use of FLASH be affected?
FLASH doesn't work in the 64-colour mode. You get extra colours instead.
How do you switch on the 64-colour mode?
OUT 48955,64: OUT 65339,1.
How do you switch off the 64-colour mode?
OUT 48955,64: OUT 65339,0.
OUT 48955,64: OUT 65339,0.
Why is my screen black?
The hardware can't set the palette registers by itself. By default the whole palette is black. Set some colours before turning on 64-colour mode.
What drawing tools are available?
There's the palette editor and a 6-bit RGB palette for Artist III with more in development.
How many colours can I have on screen at once?
A static screen using no CPU time can have 64 colours on screen at once. Changing the palette while the screen is drawing enables you to have 256 colours on screen at once. Switching between the 64-colour mode and the standard mode gives you an additional four colours (BRIGHT 0/FLASH 0 INKs 1, 3, 5, and 7) which are not present in the standard palette for a total of 260 colours on screen.
Could Sinclair have done this back in the day?
Yes, but more than one ULA would have been required and it would have been much more complicated and therefore expensive. It would take "...gazillions of gates and flip-flops. 64 * 8 Flip-Flop/latches for the palette storage = 512, plus a 640 2-input-nor gates for the multiplexing (4*16*8 + 16*8 ). That would take 832 matrix cells of the ULA, plus the other necessary circuitry. The 5C000 ULA had 440 matrix cells in total, so you'd need at least two ULAs of that size. This is so impractical that external memory would have been required for the palette. Propagation delay will have been the major issue, leading to other colour effects similar to the two-levels-of-intensity effect and the edge-artifact with flashing cells. As devices are much larger and efficient these days, it is likely to fit into a reasonably cheap CPLD. Worse case, a small amount of external memory may be required, or FPGA is used instead, as this will have the internal memory required. The design has been proven, but not synthesized, so I don't know how big a CPLD/FPGA is required." -- Chris Smith.
How does ULAplus work and how do you get 256 colours on screen at once?
"It's not actually that complicated. Imagine there's a little imp, whose job it is to paint whatever is in the Spectrum's memory onto your TV. He starts at the top left of the screen, looks in the first screen memory location and discovers which colour he should be painting the first pixel. He then moves onto the second pixel on the first row, looks up the colour for that pixel, paints it, and moves on and on across the first row. When he's done all that, he has a little break, then moves onto the second row, and so on. On a normal Spectrum, the imp's got a paintbox which has 16 colours in it, and you can't give him new colours. The new ULA gives two new capabilities: firstly, it expands the imp's paintbox from 16 to 64 colours, and secondly it lets the programmer change the paintbox. The second effect is what's going on here: because the imp doesn't draw the entire screen at once, but takes a certain amount of time to do it, you can change his paintbox while he's in the middle of drawing the screen. If you switch his paintbox for a different one when he's a half way down the screen, he'll paint the lower half of the screen with different colours from the top half, and you can then switch it back again before he paints the top half. That gets you from 64 to 128 colours - to get to 256, you just need to switch his paintbox when he's 1/4, 1/2 and 3/4 of the way down the screen. (The new ULA has a limit of 256 colours it can ever display, so you can't do any better than that)." -- Philip Kendall
How many colours do you get in a remapped game without hacking?
From 17 to 32 colours in games that use BRIGHT, up to 64 for those that also use FLASH.
What about timings and contention?
Standard ULA timings will not change. Timings for reading and writing the palette registers are the same (and have the same contention) as reading and writing port #FE. Don't spend hours creating wonderful colour effects via palette updates until emulators have been updated to reflect the correct timing and contention.
Standard ULA timings will not change. Timings for reading and writing the palette registers are the same (and have the same contention) as reading and writing port #FE. Don't spend hours creating wonderful colour effects via palette updates until emulators have been updated to reflect the correct timing and contention.
Will any soldering be required?
The aim is to have a simple plug-in replacement that can be fitted by anyone who is moderately competent with a screwdriver. Fiddlyness will be kept to a minimum.
The aim is to have a simple plug-in replacement that can be fitted by anyone who is moderately competent with a screwdriver. Fiddlyness will be kept to a minimum.
Does ULAplus clash with any existing hardware?
It clashes with the ZX Printer, and nothing else. This can be resolved by making sure the ZX Printer is fully decoded on port #FB, perhaps with a small hardware bridge.
It clashes with the ZX Printer, and nothing else. This can be resolved by making sure the ZX Printer is fully decoded on port #FB, perhaps with a small hardware bridge.
Will the specification change?
The specification has been extended to include support for HSL and CMYK palettes. These are non-standard extensions and can safely be ignored by everything except the hardware that uses them. The RGB specification is mature. It will not change, even if it is "absolutely necessary" due to unforeseen issues with the hardware implementation.
The specification has been extended to include support for HSL and CMYK palettes. These are non-standard extensions and can safely be ignored by everything except the hardware that uses them. The RGB specification is mature. It will not change, even if it is "absolutely necessary" due to unforeseen issues with the hardware implementation.
Will ULAplus support any extra modes?
Not unless there is a compelling reason to do so. However, the Timex screen modes will also work with ULAplus in the Harlequin clone. To date the only additional mode is the HSL palette mode.
Not unless there is a compelling reason to do so. However, the Timex screen modes will also work with ULAplus in the Harlequin clone. To date the only additional mode is the HSL palette mode.
What's a CLUT?
It's an acronym for Colour Look-Up Table. ULAplus uses four separate CLUTs, selected using the attribute bits formerly used to select BRIGHT and FLASH.
It's an acronym for Colour Look-Up Table. ULAplus uses four separate CLUTs, selected using the attribute bits formerly used to select BRIGHT and FLASH.
How was the 256 colour palette chosen?
The palette gives you half of the 9-bit RGB palette. It does this by using 8 levels for red and green but only 4 levels for blue. This is because the human eye is less sensitive to the colour blue. This palette was also used in the MSX. The full 9-bit palette was used in the Atari ST.
Is there some way to enable FLASH?
Use palette cycling instead.
Why don't you use a more efficient I/O system using the high byte?
Because of the limitations of the original ZX Spectrum. A lot of thought went into ULAplus.
What is HAM256 mode?
This is a software video mode that changes the palette while the screen is being drawn. By restricting each of the 24 screen rows to two of the four CLUTs it is possible to update one pair of CLUTs while the other is being displayed. This gives a maximum of 32 colours per row and a theoretical limit of 256 colours on screen at once. A conversion tool and display code are in development
Site content Copyright (c) 2009 Andrew Owen. All rights reserved. The text on this site is licensed under the Creative Commons Attribution-Share Alike License 3.0 (Unported), except for the quote from Philip Kendall which is Copyright (c) 2009 Philip Kendall, and the quote from Chris Smith which is Copyright (c) 2009 Chris Smith.