aboutsummaryrefslogtreecommitdiff
path: root/newtitle.s
diff options
context:
space:
mode:
Diffstat (limited to 'newtitle.s')
-rw-r--r--newtitle.s98
1 files changed, 98 insertions, 0 deletions
diff --git a/newtitle.s b/newtitle.s
new file mode 100644
index 0000000..d62a40a
--- /dev/null
+++ b/newtitle.s
@@ -0,0 +1,98 @@
+; this file needs to be assembled with:
+; cl65 -o newtitle.xex -t none newtitle.s
+; It contains only an init routine, no run address.
+
+ .include "atari.inc"
+
+ ; where our screen was loaded (see newtitle.pl)
+screendata = $3000
+
+ ; homebrew atari xex header
+ .word $ffff
+ .word start
+ .word end-1
+
+ .org $5000 ; anywhere that doesn't step on the title data at
+ ; $3000, and doesn't cross a 1K boundary (since there's
+ ; a display list included here)
+
+ ; executable code here
+start:
+ ; setup color registers
+ lda #$c0 ; dark green
+ sta COLOR2 ; text bg
+ lda #$0c ; white
+ sta COLOR1
+
+ ; turn off screen, in case vblank happens while we work
+ lda #0
+ sta SDMCTL
+
+ ; setup our display list
+ lda SDLSTL
+ sta FR0
+ lda SDLSTH
+ sta FR0+1
+ lda #<dlist
+ sta SDLSTL
+ lda #>dlist
+ sta SDLSTH
+
+ ; switch to narrow playfield, enable screen
+ lda #$21
+ sta SDMCTL
+
+ ; clear any keypress that happened during loading
+ lda #$ff
+ sta CH
+
+ ; wait for user to press a key
+wait4key:
+ lda CH
+ cmp #$ff
+ beq wait4key
+
+ ; eat the keypress
+ lda #$ff
+ sta CH
+
+ ; restore OS's display list
+ lda #0
+ sta SDMCTL ; disable screen again
+ lda FR0
+ sta SDLSTL
+ lda FR0+1
+ sta SDLSTH
+
+ ; switch to normal playfield, enable screen
+ lda #$22
+ sta SDMCTL
+
+ rts ; return to DOS
+
+ ; display list here
+dlist:
+ .byte $70 ; 24 scanlines of blanks
+ .byte $70
+ .byte $70
+ .byte $30 ; 4 more since image is only 184 lines tall
+
+ .byte $0f | $40 ; LMS, BASIC mode 8
+ .word screendata
+ .repeat 127
+ .byte $0f ; 127 more scanlines of mode 8
+ .endrepeat
+
+ .byte $0f | $40 ; Hit 4K boundary, LMS again
+ .word screendata+$1000
+ .repeat 55
+ .byte $0f ; 55 more scanlines of mode 8
+ .endrepeat
+ .byte $30 ; blank 4 lines to match GR.8 (does it even matter?)
+ .byte $41 ; JVB, jump & wait for vblank
+ .word dlist
+
+end:
+ .word INITAD
+ .word INITAD+1
+ .word start