Skip to Content

The ULA Layer: The Spectrum’s Screen, Extended

Load a 48K program on your Next, and it sees exactly the screen it expects: the same bytes at $4000, the same colours, the same border stripes, the same FLASH. Yet the very same ULA can put 512 dots on a line, give every 8 × 1 dots their own colours, show 64 colours at once, and scroll the whole screen smoothly by a single dot. So where does all that hide, and why does old software never trip over it?

It matters because the ULA is the screen almost every Spectrum program draws on, and the one most Next programs still use for text, menus and status lines. A new mode that broke one old game would be a bad trade, so every extension sits behind a switch that old software never touches. Learn the switches, and you get the familiar screen with its worst limits taken away: colour clash, eight colours per cell, and scrolling by moving thousands of bytes. The overview calls the ULA the veteran of the cast, and I think this is where the veteran shows it has learned new tricks without forgetting a single old one.

Everything here builds on ZX Spectrum: How the Screen Is Drawn, which explains the ULA itself: the bitmap and its attributes, the famous address order, how a line is read and drawn, contention and the floating bus. I will not repeat any of that; we only look at what the Next changes. You also need the series so far: the overview chapter for the layers and the pipeline, and the previous chapter, colours and palettes, for how an index becomes a colour.

The road ahead

We start with the memory behind the screen, which on the Next lives inside the FPGA, and why the Next has to imitate contention rather than suffer it. Then we watch the ULA read every line twice over, eight reads where the Spectrum made four, and find out what the extra four are for. The heart of the chapter comes next: the Timex modes, a second screen, hi-colour and hi-res, each shown on the machine. After that, two new ways of reading the attribute byte, ULANext and ULA+, and what each does to the border. Then the hardware scroll, dot by dot with the colours moving along, down to half a dot. We end with the clip window and switching the ULA off.

The pictures show the Next with only the ULA switched on, at 128K/+3 timing and 50 Hz. Each picture comes from a test that first checks the dots the text describes: the colours of a cell’s lines, the letters of the hi-res text, the dots a scroll moves.

The same ULA, new memory

Leave every new switch alone, and the Next’s ULA is the Spectrum’s: the 256 × 192 bitmap at $4000, the 768 attributes at $5800, INK, PAPER, BRIGHT and FLASH (16 frames on, 16 off), and the border from port $FE. It reads the same bytes at the same moments of the frame. The Spectrum display chapter’s The screen in memory and How the ULA draws a line hold for it word for word.

What differs is the memory behind it. On a Spectrum the screen is ordinary RAM that the ULA and the CPU take turns to use.

Why turns? Because the RAM can do only one thing at a time. The screen lives in the lower 16K, eight dynamic RAM chips with one set of address pins and one data line each: at any moment they can be given one address and deliver one byte, to the ULA or to the CPU, never to both. Memory that can serve two readers at once did exist, but it cost far more for each bit than the ordinary dynamic RAM of home computers, too much for a machine built to a price. So the ULA and the CPU share the RAM, and someone has to give way. It cannot be the ULA: the beam does not wait, and a byte fetched late is a dot drawn wrong. So the ULA always goes first, and the CPU is held up until it has finished. That is contention, and the Spectrum display chapter’s Sharing the memory explains the exact pattern.

The Next has no such limit. On the Next, bank 5, the 16K that normally appears at $4000–$7FFF, is kept in block RAM inside the FPGA, and so is the first half of bank 7, the 128K’s shadow screen. Block RAM is built with two ports at no extra cost: two independent sets of address and data lines into the same bytes. The CPU uses one, the ULA (and the tilemap) the other, and neither ever waits for the other. The ULA reads bank 5 directly, whichever banks the CPU has paged in. If you ask me, this is the change that makes every other one possible.

$4000$5800$6000$7800$8000bank 5bitmap, 6,144 bytessecond bitmap,or hi-colour’s coloursattributesattributesdisplay file 1display file 2 (Timex)+$0000+$1800+$2000+$4000bank 7shadow bitmapnot in block RAM:the ULA cannot see itfirst 8K in block RAM, shown with port $7FFD bit 3all of bank 5 is in the FPGA’s block RAM; each unit across is the same number of bytes
The memory the ULA reads, to scale. Dashed: the parts only the Timex modes use.

Two consequences follow, and you will meet both of them again.

Contention is an imitation. The Spectrum held up the CPU because both could not use the RAM at once. The Next has no such problem, yet old programs count T-states with the delays built in. So the ULA works out, from the beam’s position, exactly when a Spectrum’s CPU would have been held up, and holds the Next’s CPU up then, for no other reason than to keep time. Notice the irony: the Next goes to some trouble to slow itself down on purpose. The veteran limps on cue, because the old programs expect the limp, and I find that rather touching. It does so only while the CPU runs at 3.5 MHz, as the timing chapter’s Dots, ticks and T-states explains. And there is no snow: the Spectrum’s flickering dots came from the CPU’s refresh cycles disturbing the ULA’s reads of shared RAM, and here the ULA has a port of its own.

Bank 7 is only half there. The FPGA has enough block RAM for 16K of bank 5 but only 8K of bank 7. That is plenty for the 128K shadow screen, 6,912 bytes, but not for a second display file at +$2000. So while the shadow screen is shown, the Timex modes are switched off, and the ULA shows a plain Spectrum screen from bank 7. My advice: if you want the Timex modes, keep the picture in bank 5.

Reading a line twice

The Spectrum’s ULA reads four bytes for every 16 dots: the bitmap byte and the attribute of one character cell, then of the next. The Next’s ULA reads eight. For every 8 dots it fetches the bitmap byte and attribute of the cell under the beam and of the cell after it.

Why the extra work? Because of the hardware scroll, which you meet in Scrolling by the dot below. Without a scroll, the 8 dots the beam is about to draw are exactly one cell. With a scroll of, say, 3 dots, they are the last 5 dots of one cell and the first 3 of the next:

X scroll 0 (or 8, 16, …): the 8 dots on screen are one cellmemorycell ncell n+1cell n+2screenneeds cell n onlyX scroll 3 (or 11, 19, …): the 8 dots on screen straddle two cellsmemorycell ncell n+1cell n+2cell n+3−3 dotsscreenneeds cells n and n+1red: one 8-dot stretch the ULA draws from one loadeach part keeps its own cell’s attribute
Why the ULA reads each cell and its neighbour. Without a scroll, or with one that is a multiple of 8, an 8-dot stretch is one cell; with any other scroll it is the end of one cell and the start of the next.

So the ULA needs both cells’ bytes, both bitmaps and both attributes, at once. It always fetches both, scroll or not; block RAM has bandwidth to spare, and a fixed pattern of reads is simpler than a changing one. I like that reasoning: when the work is free, do it every time and keep the logic dull. Here are the reads of 16 dots side by side:

16 dots of a line: two character cellsSpectrumbmp nattr nbmp n+1attr n+1Nextbmp n+2attr n+2bmp n+1attr n+1bmp nattr nbmp n+1attr n+1the neighbours, for scrollingthe Spectrum’s reads:seen on the floating busone read every two dots; each byte is held until its cell is drawn
Eight reads where the Spectrum made four. The extra four fetch the next cell along, which a scrolled screen needs; only the Spectrum’s four reach the floating bus.

The extra reads are invisible to your programs. The floating bus, the byte a read of port $FF returns on a Spectrum, shows only the four reads a Spectrum would make, at the moments it would make them, and $FF over the border, exactly as the Spectrum display chapter’s The floating bus describes. They are the bytes the ULA really reads, so with a scroll they come from the scrolled cells, and in the Timex modes from the display file the mode reads.

The Next gives the floating bus with 48K and 128K timing; with +3 or Pentagon timing a port $FF read returns $FF. With +3 timing the floating bus appears instead on the +3’s own port, with bit 0 set, as on a real +3. One more thing can take port $FF’s place: with bit 2 of the Peripheral 3 Setting register, NextReg $08, a read of port $FF returns the Timex register of the next section instead of the floating bus. I would keep that in mind before you trust a floating-bus trick on the Next: which answer port $FF gives depends on the timing and on that bit.

The Timex modes

The Timex Computer Corporation sold Spectrum-compatible machines in America whose ULA had more modes, switched by port $FF. A small amount of software uses them, and the Next has them all. I call them the American cousins: family of the Spectrum’s screen, raised abroad, with a few habits of their own. The port’s bits, as the Next has them:

Bits of port $FFMeaning
7not used
61 switches off the frame interrupt
5–3ink colour of the hi-res mode (the paper is its opposite)
2–0the screen mode: 000 standard, 001 second screen, 010 hi-colour, 110 hi-res

Bits 5–0 can also be written through the Display Control 1 register, NextReg $69, which carries two more switches beside them: bit 7 switches Layer 2 on, and bit 6 shows the shadow screen. The three mode bits act on their own: bit 0 moves the bitmap to the second display file, bit 1 takes the colours from there, bit 2 doubles the dots across. The four combinations in the table are the ones the Timex defined, and the only ones software uses. I would stay with those four too.

The mode is taken again for every 8 dots, at the same moment as the scroll. Your program, or the Copper, can change it between two cells of the same line, and the change shows from the next cell.

A second screen

Mode 001 is the plainest: the same Spectrum screen, read from $6000 instead of $4000, with its attributes at $7800. A program draws the next frame in one screen while the other is shown, and switches with one OUT: double buffering, the 128K’s shadow screen idea, but in bank 5. No more half-drawn frames caught by the beam halfway through. Of the American cousins, I find this one the most useful day to day.

Hi-colour: a colour for every 8 × 1 dots

On the Spectrum the attribute byte of a cell covers 8 × 8 dots. Mode 010 gives every byte of the bitmap a colour byte of its own. The bitmap stays at $4000, and the colour bytes are a second copy of its layout at $6000: the colour of the bitmap byte at $4000 + o is the byte at $6000 + o.

So the ULA’s address for the colour is the bitmap address with one more bit set. The Spectrum’s attribute address is built differently, from the row of cells, which is what made the 8 × 8 cells in the first place:

150bitmap byte010Y7Y6Y2Y1Y0Y5Y4Y3X4X3X2X1X0$4000+hi-colour’s colour byte011Y7Y6Y2Y1Y0Y5Y4Y3X4X3X2X1X0$6000+standard attribute010110Y7Y6Y5Y4Y3X4X3X2X1X0$5800+Y: the line, 0–191 · X: the byte column, 0–31Y2–Y0 are missing from the attribute: eight lines share it
Hi-colour needs no new address logic: its colour byte is the bitmap address with bit 13 set. The standard attribute drops the line’s three low bits, which is what makes a cell 8 lines tall.

Have you noticed how cheap this is? One bit of the address, and a whole new mode falls out. I find it one of the neatest tricks on the old screen. The colour byte is an ordinary attribute in every other way: INK, PAPER, BRIGHT and FLASH, in the same bits. Here is the same bitmap twice on the machine, a ball striped with a new colour on every line, the stripes stepping down by two lines from one 8-dot column to the next:

standard: one colour per 8 × 8 cellhi-colour: one colour per 8 × 1 dots
The same bitmap in the two modes, 96 × 96 dots of the screen. On the left each cell takes the colour of its top line; on the right each of a cell’s eight lines has its own colour.

The price is memory: 12K for one screen instead of 6.75K, and your program must write 6,144 colour bytes where it wrote 768. The gain is that colour clash, the Spectrum’s best-known limit, is gone from the vertical direction. A sprite can move up and down through a cell and keep its own colours; only across does it still share 8 dots with its neighbours. For a game drawn on the ULA, I think that trade is well worth making.

Hi-res: 512 dots across

Mode 110 is the other way round: one colour, twice the dots. The line has 512 dots instead of 256, each half as wide, one 14 MHz dot instead of one 7 MHz dot, so the line is just as long on the screen.

First, what a column means here, because the word is easy to misread, and I would rather spend a paragraph on it than leave you guessing. A column is a strip of the screen 8 dots wide: on every line it is one byte of the bitmap, and with an 8 × 8 font it holds one character of text.

  • The standard Spectrum screen has 32 columns: 256 dots ÷ 8. A line is 32 bytes, and the display file at $4000 holds them all: column 0 is the line’s byte 0, column 31 its byte 31.
  • Hi-res has 64 columns: 512 dots ÷ 8. Each column is half as wide on the screen as a standard one, because its dots are. A line is 64 bytes, twice what one display file holds for a line, so both files hold half each: column 0 is byte 0 of the line in the file at $4000, column 1 is byte 0 in the file at $6000, column 2 is byte 1 at $4000, column 3 byte 1 at $6000, and so on. The even columns come from the first file, the odd ones from the second.
StandardHi-res
Dots on a line256512
Width of a dotone 7 MHz dothalf that: one 14 MHz dot
Columns: 8 dots, one byte a line3264
Characters of 8 × 8 text on a line3264
Where column c isbyte c of the line at $4000byte c ÷ 2 of the line, at $4000 if c is even, at $6000 if odd

The start of a line in the two modes, side by side:

hi-res: columns 0–3 of 64, each 8 dots of 14 MHzcolumn 0$4000, byte 0column 1$6000, byte 0column 2$4000, byte 1column 3$6000, byte 1…8 hi-res dotsstandard: the same width, columns 0–1 of 32, each 8 dots of 7 MHzcolumn 0$4000, byte 0column 1$4000, byte 1…a whole line: 64 columns in hi-res, 32 in the standard screen, the same width on screenhi-res: ink from port $FF bits 5–3 (BRIGHT), paper its opposite · no attributes, no FLASH
Columns in the two modes. A column is always 8 dots, one byte a line; hi-res dots are half as wide, so the same width holds twice the columns: 64 across the line, the even ones from $4000, the odd ones from $6000.

This is where the eight reads of Reading a line twice pay off a second time. In hi-res the four “attribute” reads per 8 dots fetch from the second file’s bitmap instead, at the same addresses as the first file’s bitmap plus $2000, so the ULA gets the bytes of both files with no extra reads at all. The shift register, which normally sends out each bit twice, once for each half of the 7 MHz dot, now sends each bit once. Neat, isn’t it? The reads were already there; hi-res only gives them a second job.

There are no attributes left to colour the dots, so the whole screen has one ink and one paper, set by bits 5–3 of port $FF. The ink is that colour, BRIGHT; the paper is its opposite, also BRIGHT: 000 black on white, 001 blue on yellow, and so on to 111 white on black. On the machine, three lines of text in an 8 × 8 font, one character per column, 64 columns to a line:

hi-res (port $FF = $0E): both files, 512 dots acrossstandard (port $FF = $00): the first file alone
The left half of the screen, 128 × 24 dots: hi-res columns 0–31 above, standard columns 0–15 below. The same bytes; the standard mode shows only the file at $4000, the hi-res columns 0, 2, 4, …, each at twice the width.

Hi-res is a text mode at heart, and I would use it as one: 64 columns of 8 × 8 characters where the Spectrum has 32, and it is the ULA’s only 512-dot mode: the left and right halves of a 7 MHz dot really differ here, as the overview chapter’s Two dots for every position of the beam describes. It costs the same 12K as hi-colour, and its colours can still be changed for a band of the screen by rewriting port $FF between lines.

ULANext: the attribute byte split anew

The attribute byte spends its 8 bits as FLASH, BRIGHT, three bits of PAPER and three of INK: 8 inks, 8 papers, and a bright version of each. ULANext keeps the byte and the bitmap and changes only how the byte is read. Bit 0 of the Palette Control register, NextReg $43, switches it on, and the ULANext Attribute Byte Format register, NextReg $42, holds a mask: the bits the mask covers are the INK, the rest are the PAPER. FLASH and BRIGHT are gone; their bits are colour now.

70standardFBPPPIIIink: entries 0–7 (+8 BRIGHT)paper: 16–23 (+8 BRIGHT)mask $07PPPPPIII8 inks: entries 0–732 papers: 128–159mask $0FPPPPIIII16 inks: entries 0–1516 papers: 128–143mask $3FPPIIIIII64 inks: entries 0–634 papers: 128–131mask $FFIIIIIIII256 inks: entries 0–255paper: the fallback colourI: ink bits · P: paper bits · F, B: FLASH and BRIGHT, which ULANext does not have
One attribute byte, four ULANext masks. The mask moves the line between ink and paper; the inks always count from entry 0 of the ULA palette, the papers from entry 128.

The rule is short. For an ink dot, the index is the attribute AND the mask: entries 0 upward. For a paper dot, it is the bits above the mask, moved down, plus 128: entries 128 upward. The mask must be a run of ones from bit 0, $01, $03, $07 and so on to $FF, and each choice trades inks for papers:

Mask (NextReg $42)InksPapersThe border
$012128entries 128–135
$03464entries 128–135
$07 (after reset)832entries 128–135
$0F1616entries 128–135
$1F328entries 128–135
$3F644entries 128–135
$7F1282entries 128–135
$FF256the fallback colourthe fallback colour
any other valuethe attribute AND the maskthe fallback colourentries 128–135

$FF is the full-ink mode: every attribute value is an ink, so a cell can have any of 256 colours, and its paper dots show the Fallback Colour register, NextReg $4A, instead of a paper. The border’s colour from port $FE always uses the first eight paper entries, 128–135, except in the full-ink mode, where it too is the fallback colour.

Why would you want this? The default $07 is the Spectrum’s 8 inks with 32 papers, so a game can give its backgrounds far more colours than its text. $0F gives 16 of each, a match for 16-colour graphics. And since the palette entries are the Next’s 9-bit colours, every one of those inks and papers can be any of 512 colours. What ULANext cannot do is change the bitmap: a cell is still 8 × 8 dots with one ink and one paper, so colour clash remains. With hi-colour it does: ULANext reads the hi-colour colour bytes the same way, one ink and paper for every 8 × 1 dots. The two together are, if you ask me, the most colourful thing the old screen can do.

ULA+: 64 colours

ULA+ is not the Next’s invention. It is a standard defined for Spectrum clones and add-ons, with software and emulators that support it, and the Next implements it so that software runs. I think of ULA+ as the guest: welcome in the house, made to feel at home, but it brought its own manners. It keeps the Spectrum’s attribute layout and reuses its FLASH and BRIGHT bits: together they pick one of four groups of 16 colours, and each group has 8 inks and 8 papers. The colours live in entries 192–255 of the ULA palette:

70FBPPPIIIattribute7011FB0 / 1cccindex= 192 + 16 × group+ 8 for paper + colourthe dot chooses:P for paper, I for inkpaper dotink dotthe group0 ink · 1 paperfour groups of 16 entries, 192–255; no FLASH, no BRIGHT
ULA+: FLASH and BRIGHT pick a group of 16 entries, and ink or paper picks its half.

Software switches ULA+ on and writes its colours through two ports of its own. Port $BF3B, the ULA+ Register, selects what port $FF3B, the ULA+ Data port, does: with bits 7–6 of the value 00, bits 5–0 choose one of the 64 colours, and the next write to port $FF3B sets it; with 01, bit 0 of the next write to port $FF3B switches ULA+ on or off. ULA+ software writes its colours in its own bit order, GGGRRRBB; the Next turns them into its RRRGGGBB and stores them in the ULA palette like any other colour, as the palettes chapter’s The ULA: three maps of one palette explains. A Next program can also switch ULA+ with bit 3 of the ULA Control register, NextReg $68, and write entries 192–255 through the ordinary palette registers.

With ULA+ the border uses the paper half of group 0, entries 200–207. If both ULA+ and ULANext are switched on, ULANext wins: the guest gives way to the house’s own rules. And neither of them has FLASH: its bit now chooses colours, so nothing blinks. If your program needs FLASH, I would stay with the standard map.

The border in every mode

The border is still the ULA’s: three bits of port $FE, a colour for every dot of the frame outside the 256 × 192 display area, the wide area of the other layers included. What the Next adds is the choice of palette entry, which follows the mode:

ModeThe border’s palette entry
Standard (and the Timex second screen and hi-colour)16–23: the PAPER entries, never BRIGHT
ULANext128–135; with the mask $FF, the fallback colour
ULA+200–207
Hi-resthe hi-res paper colour: port $FE is not used

The hi-res line is worth a second look: in hi-res, the border takes the paper colour of port $FF bits 5–3, so the whole screen, border and all, is one paper colour, and port $FE’s border is ignored. A loader that flashes the border in hi-res flashes nothing at all. That one, let me warn you, is easy to forget.

A new border colour from port $FE reaches the screen at the start of the next 8-dot cell, as on the Spectrum, so border stripes have the Spectrum’s 8-dot steps; with Pentagon timing the change shows from the very next dot, as on a Pentagon. And because the border is a ULA dot like any other, the rules of the composition chapter’s Transparent or not apply to it: a border whose colour matches the Global Transparency Colour register, NextReg $14, is transparent, and other layers show through it.

Scrolling by the dot

On the Spectrum, moving the screen meant moving its bytes, as the overview chapter’s Scrolling: moving the picture without moving memory explains. The Next’s ULA has two offsets instead: the ULA X Scroll register, NextReg $26, 0–255 dots, and the ULA Y Scroll register, NextReg $27, 0–191 lines. The ULA starts reading its picture that many dots to the right and lines down, and the picture wraps round: across at 256, down at 192. (A Y offset of 192–255 counts on from 0, as 0–63.)

Now the part I like best: what happens to the colours? A program that scrolls the Spectrum’s screen by one dot moves the bitmap and leaves the attributes, which can only move by whole cells. The ULA’s scroll moves both. Here is how, for one 8-dot stretch of the line:

the bitmap of cells n and n+1, as readcell n · its attributecell n+1 · its attributethe shift register: 32 half-dots,shifted left by 2 × (X mod 8) + half-dot bit6 places outthe next 16 places: 8 dots on screen5 dots, cell n’s colours3 dots, n+1’son screenexample: X scroll 3 (or 11, 19, …):the ULA switches attribute where the cell edge falls
The ULA’s scroll inside 8 dots. Two cells go into the shift register, the scroll’s low bits choose where the 8 dots start, and the colour switches from one cell’s attribute to the next at the cell’s edge.

The ULA does it with the reads of Reading a line twice, step by step:

  1. The high five bits of the X offset pick the cell the line starts from; the low three bits pick the dot inside it.
  2. The shift register holds both cells, the one under the beam and the next one.
  3. A counter started at the same dot tells the ULA when it passes from the first cell into the second.
  4. At that point it switches from the first cell’s attribute to the second’s.

So every dot keeps its own cell’s colours, wherever the scroll puts it. This is the trick I would most like to have had on the 48K. On the machine:

no scrollNextReg $26 = 100, NextReg $27 = 60
A scroll of 100 dots across and 60 lines down. The ball wraps round at both edges; the cells take their colours with them though 100 is not a multiple of 8. The border does not scroll.

Half a dot

One more bit makes the scroll finer still: bit 2 of the ULA Control register, NextReg $68, the half-dot scroll, moves the picture half a dot further left, one 14 MHz dot. The shift register already holds every dot twice, once for each half, so a shift by one place more is all it takes. In the standard modes it is a smoothing step for slow scrolls. In hi-res, where every dot is a 14 MHz dot, it is what makes the scroll exact: the ULA X Scroll register, NextReg $26, moves a hi-res picture two dots at a time, and the half-dot bit adds the one between. A tiny bit, and I think a well-placed one.

When a scroll takes effect

The ULA takes both offsets, the half-dot bit and the Timex mode once for every 8 dots, at the start of the cell it is about to fetch. A new value written in the middle of a line shows from the next cell on. That is fine enough to scroll the bottom of the screen differently from the top, from a line interrupt or the Copper, and even to change the offsets within a line. I find that generous for a chip that started life with no scroll at all.

Clipped and switched off

The ULA’s clip window, the Clip Window ULA register, NextReg $1A, works in the display area’s own coordinates: X 0–255 and Y 0–191, one unit per dot, both edges inside the window, as the overview chapter’s The clip window: a rectangle for each layer explains. Two details matter for the ULA. A clipped dot is not paper, it is transparent: the layers below the ULA, or the fallback colour, show there. And the border is never clipped: the window only cuts the 256 × 192 picture.

Bit 7 of the ULA Control register, NextReg $68, switches the ULA off. Then it is transparent everywhere, border included, and the screen is made by the other layers and the fallback colour. It is not gone, though: the blend modes of the composition chapter’s Blending still read its colours. LoRes, which takes the ULA’s place, obeys the same window and the same switch: the understudy, as ever, plays by the veteran’s rules.

All of the ULA’s switches in one place, the kind of table I like to keep beside the keyboard:

RegisterBitsWhat it does
port $FE2–0the border colour
port $FF (and the Display Control 1 register, NextReg $69, bits 5–0)5–3, 2–0hi-res ink; the Timex screen mode
port $7FFD (and NextReg $69 bit 6)3show the shadow screen in bank 7 (no Timex modes)
the ULA X Scroll and ULA Y Scroll registers, NextReg $26, $277–0the X and Y scroll
the ULA Control register, NextReg $687, 3, 2ULA off; ULA+ on; the half-dot scroll
the Palette Control register, NextReg $430ULANext on
the ULANext Attribute Byte Format register, NextReg $427–0the ULANext ink mask
port $BF3B, $FF3BULA+ colours and on/off
NextReg $1Athe clip window

What to take home

One last look at the veteran. The Next’s ULA is the Spectrum’s, byte for byte, but its screen memory, all of bank 5 and the first half of bank 7, is block RAM inside the FPGA with a port of its own. Contention is only imitated, and only at 3.5 MHz, and there is no snow. The ULA reads eight bytes per 16 dots: the Spectrum’s four, which the floating bus shows, and the next cell’s, which the scroll needs.

Port $FF selects the Timex modes: a second screen at $6000, hi-colour with a colour byte for every 8 × 1 dots at the bitmap address plus $2000, and hi-res, 512 dots across from the two files interleaved, in one colour pair from port $FF bits 5–3. The shadow screen in bank 7 has none of them.

Two new readings of the attribute byte add colour. ULANext, switched on by NextReg $43 bit 0, splits the byte by the mask in NextReg $42: inks from entry 0, papers from 128, and with $FF 256 inks with the fallback colour as paper. ULA+, through ports $BF3B and $FF3B or NextReg $68 bit 3, turns FLASH and BRIGHT into four groups of 16 colours in entries 192–255: the guest, with its own manners. The border follows the mode’s paper entries, and in hi-res it is the hi-res paper.

NextRegs $26 and $27 scroll the picture by the dot, wrapping at 256 × 192, and the colours move with it; NextReg $68 bit 2 adds half a dot. Offsets and modes take effect from the next 8-dot cell. The old screen, it turns out, had a lot of life left in it, and I hope you will give it some more.

Last updated on