8bitworkshop/presets/atari8-800/skeleton.dasm

76 lines
2.1 KiB
Plaintext

; Atari "Hello World" sample code
; Written by Daniel Boris (dboris@comcast.net)
; Modified by Steven Hugg @8bitworkshop
; Assemble with DASM
processor 6502
include "atari.inc"
org $a000 ;Start of left cartridge area
Start
ldx #(dlistend-dlist)
dlloop ;Create Display List
lda dlist,x ;Get byte
sta $1000,x ;Copy to RAM
dex ;next byte
bpl dlloop
lda #$06
sta CHACTL ;Set Character Control
lda #$84 ;Set color PF2
sta COLOR0+2
sta COLOR0+4 ; bakground
lda #$0F ;Set color PF1
sta COLOR0+1
lda #$3f
sta COLOR0+0
lda #$58
sta COLOR0+3
lda #$00 ;Set Display list pointer
sta SDLSTL ;Shadow DLISTL
lda #$10
sta SDLSTH ;Shadow DLISTH
lda #$e0 ;Set Charcter Set Base
sta CHBAS
lda #$22 ;Enable DMA
sta SDMCTL ;Shadow DMACTL
print
ldy #$00
cld
prloop
lda text1,y ;Get character
beq wait
cmp #$60
bcs lower
sec
sbc #$20 ;Convert to ATASCII
lower
sta $1800,y ;Store in video memory
iny ;Next character
bne prloop
wait
nop
jmp wait
;Display list data (starts at $1000)
dlist .byte $70,$70,$70 ;24 blank scanlines
.byte $42,$00,$18,$02 ;mode 2 @ $1800
.byte $41,$00,$10 ;JMP -> $1000
dlistend
;Text data
;(will be converted to ATASCII and stored in video RAM)
text1 .byte "Hello World! " ; ASCII text
.byte $c0 ; ATASCII
.byte 0
;Cartridge footer
org CARTCS
.word Start ; cold start address
.byte $00 ; 0 == cart exists
.byte $04 ; boot cartridge
.word Start ; start