ABCDE: DLI Colour Rows in MADS
- Type
- Graphics
- Category
- Display-list interrupt colour demo (assembler)
- Author
- Ralf Patschke
- Published in
- AtariAge forums, NYD 2026 thread (2026)
- Year
- 2026
- Language
- 6502 assembly (MADS)
- Requirements
- MADS (Mad Assembler) and an include file of Atari hardware equates; any 8-bit Atari to run the result
- Tags
- assembler, mads, dli, display-list, vcount, wsync, graphics-2, colour, demo
- Related
- Advanced DLI Techniques: Kernels, Dispatch Tables and Cycle Budgets, ANTIC DMA and Cycle Timing: Where the CPU's Time Goes, Display List Interrupts (DLIs): More Colours, Mid-Screen Changes, GTIA 9++: Square Pixels and a Quarter of the DMA with a Vertical-Scroll Trick, Vertical Scrolling with DLIs: A Smooth Scroller Under a Fixed Status Bar, Goin' West (3-D Landscape Illusion)
About the program
This little source was posted in 2026, in an AtariAge discussion of the NYD 2026 releases, as a teaching example. In the author's words, it reproduces "in a way simpler mode, the text graphics and some color changes in DLI". It's a good first program for anyone learning display-list interrupts (DLIs) in MADS, the Mad Assembler. It fills 11 rows of a GRAPHICS 2 (ANTIC mode 7) screen with ABCDE abcde ABCDE abcde, normal and inverse, so that every row shows all four playfield colours. One DLI then changes two of those colours 16 scanlines at a time, so each row comes out in a different shade.
What you need
- MADS, which supplies the
.proc,.rept,dta d'…'syntax and macro-instructions such asmwa,mva,phr/plrandadd. - Hardware equates for
nmien,vcount,wsyncandcolor0–color3. As the second comment line says: "Use your own OS link file or correct the addresses". Because the colours are written inside the DLI,color0–color3here must be the GTIA hardware registers COLPF0–COLPF3 (53270–53273, $D016–$D019), not the OS shadow registers at 708–711.
How it works
ant, the display list.:4 .he 70gives four "8 blank lines" instructions. Next comes.he 80 47: one blank line with the DLI bit set ($80), followed by $47, which is mode 7 (GRAPHICS 2) with a Load Memory Scan, then the screen address.wo scr. Ten more$07mode-7 lines follow, and finally$41(Jump and wait for Vertical Blank) back toant.scr, the screen.dta d'ABCDE'stores internal screen codes, and the trailing*sets bit 7 (inverse). In mode 7, upper case, lower case, inverse upper and inverse lower are drawn in COLPF0, 1, 2 and 3 respectively, so each 20-character row is a colour test card..rept 11repeats it for 11 rows.main. It points the OS display-list pointer (560) and the DLI vector VDSLST (512) at the new routines, enables DLIs withNMIEN = $C0, and parks injmp *.dli. It saves the registers (phr), sets COLPF0 to $0E (white) and COLPF1 to $0A, then loops 13 times: read VCOUNT (the current scanline ÷ 2) into COLPF2, add 20 and store that in COLPF3, then wait 16 scanlines with sixteensta wsync. Since VCOUNT rises down the screen, each mode-7 row (16 scanlines tall) gets the next colours. A mode-7 row is exactly 16 scanlines tall, so the colour changes stay in step with the rows.
Variations to try
- Change
add 20to another value for different colour pairs, or replacelda vcountwith a table lookup for chosen colours. - Remove eight of the sixteen
wsyncs to change colour every half row and see the split appear in the middle of the letters.
Listing
; I just reproduce in a way simpler mode, the text graphics and some color changes in DLI here.
; Use your own OS link file or correct the addresses to make this work.
org $2000
.proc ant
:4 .he 70
.he 80 47
.wo scr
:10 .he 7
.he 41
.wo ant
.endp
;------------
.proc scr
.rept 11
dta d'ABCDE'
dta d'abcde'
dta d'ABCDE'*
dta d'abcde'*
.endr
.endp
;------------
.proc main
mwa #ant 560
mwa #dli 512
mva #$c0 nmien
jmp *
.endp
;------------
.proc dli
phr
mva #$e color0
mva #$a color1
ldx #12
lx lda vcount
sta color2
add 20
sta color3
:16 sta wsync
dex
bpl lx
plr
rti
.endp
;------------
run main
Credits
- Program listing: ABCDE: DLI Colour Rows in MADS — program listing (AtariAge forums, NYD 2026 thread (2026)) — Ralf Patschke
- Gury's Atari 8-bit Forever — ABCDE (listing) — Ralf Patschke
- AtariAge forum — NYD 2026 thread (linked from the Gury entry; not available locally) — AtariAge forum members, 2026
