A quick page about setting up a minimal development environment, and getting something to display on an Atari 2600.
Disclaimer: I'm basically following Atari 2600 Programming for Newbies and adding a few hacks/tries, that's all. So don't expect anything spectacular here :-)
Not sure if I want to continue using it, but the tutorial I follow uses the DASM macro-assembler, so that's what I'll use as well to get quick result.
I also want to look at 64tass/tass64 later, because it happens to ship as a Arch package, and I liked what I saw of its documentation.
(However, DASM is easy to build from source on Linux - just follow the instructions in the "README" file in the root of the source. Running "make" was enough here.)
I started with the source from this page in aforementioned tutorial, and started modifying it. (It's been about 25 years since I used 6502 assembly :-)
I came up with something like this...
...which increments the 20-pixel playfield-pattern and scrolls a background-colour pattern upwards.
For reference, to assemble:
./dasm asm.asm -I../machines/atari2600 -f3
(I'm running from the "bin" dir in the DASM-tree.)
stella -snapsavedir . a.out
(To make a snapshot, press F12.)
(Again, this is just a modified example from aforementioned tutorial.)
processor 6502 include "vcs.h" include "macro.h" SEG ORG $F000 start ; Start of vertical blank processing lda #0 sta VBLANK lda #2 sta VSYNC ; 3 scanlines of VSYNCH signal... sta WSYNC sta WSYNC sta WSYNC lda #0 sta VSYNC ; vertical blank ldx #45 loop1 sta WSYNC dex bne loop1 ; visible area: 192 lines (NTSC) / 228 (PAL) ldx $80 inx inx stx $80 ldy #228 loop2 sta WSYNC stx PF0 stx PF1 stx PF2 stx COLUBK inx dey bne loop2 ; overscan lda #%01000010 sta VBLANK ldx #36 loop3 sta WSYNC dex bne loop3 jmp start ORG $FFFA .word start ; NMI .word start ; RESET .word start ; IRQ END
To be continued - this is a fun platform :-)