; Atari 5200 image viewer -- self-contained, no OS. ; ; The 5200 has no operating system (only a small BIOS that jumps straight to the ; cartridge), so this code programmes ANTIC and GTIA hardware registers directly. ; ANTIC DMAs the bitmap and display list straight out of cartridge ROM, so nothing ; needs copying to RAM -- the viewer only applies the GTIA colour registers, points ; ANTIC at the display list, enables DMA, and holds. ; ; GTIA is at $C000 on the 5200 (not $D000 as on the 400/800); ANTIC is at $D400. ; ; #defines from viewer/assemble.py -- ; DLIST cartridge address of the display list ; SCRIPT cartridge address of the GTIA register script -- (offset, value) ; byte pairs applied as $C000+offset = value, terminated by $FF * = $4000 start: sei cld ldx #$ff txs lda #$00 sta $d40e ; NMIEN = 0 -- no interrupts sta $d400 ; DMACTL = 0 while we set up ; ---- apply the GTIA register script (offset, value pairs) ---- ldx #$00 sloop: lda SCRIPT,x cmp #$ff beq sdone tay ; Y = register offset within GTIA inx lda SCRIPT,x sta $c000,y ; GTIA register = value inx jmp sloop sdone: ; ---- point ANTIC at the display list ---- lda #DLIST sta $d403 ; DLISTH ; ---- enable DMA -- normal playfield + display-list DMA ---- lda #$22 sta $d400 ; DMACTL ; ---- hold the picture (forever / until a button / N seconds) ---- #include "awyt5200.i"