Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!


One of the amazing things about the 8-bit Atari computers was how they could rewrite their display list on the fly, changing video modes every scan line. My favorite application of this was the rainbow effect. I’ve always wanted to know how to do this, and some searching led me to Alan Watson’s example in Compute!’s Second Book of Atari. I trimmed it down a bit to come up with this BASIC code, which you can run on a real Atari computer or in your favorite emulator:

110 FOR I=0 TO 17
120 READ B
130 POKE 1536+I,B
140 NEXT I
200 POKE 512,0:POKE 513,6
210 GRAPHICS 8
220 START=PEEK(560)+256*PEEK(561)
300 POKE START+3,78
310 FOR I=34 TO 98:POKE START+I,14+128:NEXT I
320 POKE START+99,78+128
330 FOR I=102 TO 164:POKE START+I,14+128:NEXT I
400 POKE 54286,192
410 DATA 72,173,198,2,24,105,2,141
420 DATA 10,212,141,198,2,141,26
430 DATA 208,104,64

In case you’re wondering about what’s going on in those data statements, here’s my attempt at a translation:

72         PHA       ; Push A(ccumulator)
173,198,2  LDA 710   ; Load A with playfield 2 color luminance
24         CLC       ; Clear carry
105, 2     ADC #2    ; Add 2
141,10,212 STA WSYNC ; Wait for horizontal sync
141,198,2  STA 710   ; Playfield 2 color luminance
141,26,208 STA $D01A ; Background color register
104        PLA       ; Restore A
64         RTI       ; Return from interrupt

Related:

Brian Jepson

I’m a tinkerer and finally reached the point where I fix more things than I break. When I’m not tinkering, I’m probably editing a book for Maker Media.


Related
blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,744 other followers