Back in January 2020, I began preparations for participating in the Forever 2020 demoparty. The compo theme was announced by ROBO, so I decided to write a simple work for the Atari 65XE. When the intro was ready, I decided to add a bitmap effect. Alas, due to the cancellation of the Forever, part of the intro was published.The Atari processor is MOS 6502 - 8-bit registers and the lack of ports for accessing hardware. Another component of the computer is ANTIC - it implements images - colors, video modes, symbols. There are hardware cells for accessing ANTIC, their purpose is described in Mapping The AtariI will not list all the addresses of the cells and the destination, I will describe the idea of the effect itself. It should be noted that for convenience, the addresses in Mapping have mnemonics - they are so convenient to remember.What is a screen? In text mode, a rectangle with symbols and a frame is visible.For convenience, you can turn off the rectangle by writing the value 0 to 559. As you can see, there is room for a raster effect.Now you need to synchronize the drawing with the output to the screen. There are two methods:RTCLOK equ $0012
lda RTCLOK+2
waits
cmp RTCLOK+2
beq waits
Here RTCLOCK is the real-time clock that starts when the computer is turned on. First increases $ 14, then $ 13 and $ 12. The idea of synchronization is simple: compare the value of cell $ 14 with the current one. If the previous value does not match, an interrupt has occurred.But in my effect, the method does not fit, so it’s more convenient to use a VCOUNT ($ D40B) -vertical counter of lines generated on the frame. Waiting for the start of the frame will be:ws
lda $D40B ; VCOUNT
bne ws
The idea itself is to write color values to the COLBK register ($ D01A) - the color of the frame.The value written to the register is divided into two parts: color type and brightness, calculated as type * 16 + brightness. Described in detail here and here .But when setting the color for each line, synchronization is needed - writing any value to WSYNC (D40A) will stop the processor and make it wait for the next line to start. The same method is used in Display List interrupts.The effect itself is divided into waiting for the frame, generating color values and writing them to the described registers. I used zero page addresses for simplicity. You can use the xasm assembler to compile. org $4000
start
wait_frame
ws
lda $D40B ; VCOUNT
bne ws
LDY #0
STY 559
zz
LDA $CD
CLC
ADC #5
STA $CD
BCC BR1
INC $CE
BR1
ADC $CB
STA $CB
BCC BR2
INC $CC
BR2
LDA $CC
STA $D40A ; WSYNC
STA $D01A
INY
BNE zz
BEQ wait_frame
run start
It turned out 54 bytes. 54-6 (program header) = 48 bytes. There is time to experiment, for example, play with the brightness of green lda $CC
;*
and #$0f
ORA #$C0
;*
sta $D40A ; wsync
sta $D01A
Other options for generating colors I will leave to those who are interested and try their hand myself. Create, experiment and create. This is so exciting!