aboutsummaryrefslogtreecommitdiff
path: root/newtitle.s
diff options
context:
space:
mode:
Diffstat (limited to 'newtitle.s')
-rw-r--r--newtitle.s125
1 files changed, 81 insertions, 44 deletions
diff --git a/newtitle.s b/newtitle.s
index d9a96cb..15b73ad 100644
--- a/newtitle.s
+++ b/newtitle.s
@@ -10,16 +10,15 @@
sound_disabled = $06ff
; where our screen was loaded (see newtitle.pl)
-screendata = $9000
+;screendata = $2400
; homebrew atari xex header
.word $ffff
- .word version
+ .word origin
.word end-1
- ; needs to be above the BSS (see taipan.map). we'll place it right at
- ; the end of screendata.
- .org $a800
+; .org $a800
+ .org origin
version:
.incbin "ver.dat"
@@ -43,21 +42,89 @@ helplotbl:
.byte <(help+96)
.byte 0
-helpshowing = FR1
-
-; N<space> or FF (inverse)
-sounddisp = help + 78
-
colorchoices:
.byte $c0,$10,$00
-
colorcount = (*-colorchoices)-1
-
textchoices:
.byte $0c,$0e,$0a
-
textcount = (*-textchoices)-1
+wait1jiffy:
+ lda RTCLOK+2
+wait:
+ cmp RTCLOK+2
+ beq wait
+ rts
+
+; this is needed to prevent the DL from crossing a 1K boundary.
+filler:
+ .repeat 3
+ .byte $aa
+ .endrepeat
+
+; since the screen data crosses a 4K boundary, we have to
+; include a LMS. screendata needs to be on a 32-byte boundary for
+; these calculations to work.
+ .if(screendata .mod $20)
+ .error "screendata must be on a 32-byte boundary!"
+ .endif
+
+totalscanlines = 184 ; aka image size / $20
+topscanlines = (($1000 - (screendata .mod $1000)) / $20)
+bottomscanlines = totalscanlines - topscanlines
+
+ .out .sprintf("topscanlines = %d", topscanlines)
+ .out .sprintf("bottomscanlines = %d", bottomscanlines)
+
+; if the display list crosses a 1K boundary, it needs to contain a
+; jmp instruction ($01).
+ .macro dlbyte arg
+ .if((* .mod $400) = $3fd)
+ .out .sprintf("emitting DL jump to $%x at $%x", * + 3, *)
+ .byte $01
+ .word (* + 2)
+ .endif
+ .byte arg
+ .endmacro
+
+ .macro dl3byte ins, arg
+ .local bytes
+ bytes = $400 - (* .mod $400)
+ .if(bytes < 3)
+ .error .sprintf("$%x %d: display list dl3byte when <3 bytes left in 1K block, sorry", *, bytes)
+ .endif
+ .byte ins
+ .word arg
+ .endmacro
+
+ ; display list here
+dlist:
+ dlbyte $70 ; 24 scanlines of blanks
+ dlbyte $70
+ dlbyte $70
+
+ dl3byte $0f | $40, screendata ; LMS, BASIC mode 8
+ .repeat topscanlines - 1
+ dlbyte $0f ; 127 more scanlines of mode 8
+ .endrepeat
+
+ dl3byte $0f | $40, screendata+(topscanlines * $20) ; Hit 4K boundary, LMS again
+ .repeat bottomscanlines
+ dlbyte $0f ; 55 more scanlines of mode 8
+ .endrepeat
+ dl3byte $02 | $40, version ; LMS, 1 line of GR.0 for the version
+help_lms = * - 2
+ dl3byte $41, dlist ; JVB, jump & wait for vblank
+
+ .out .sprintf("dl start $%x, end $%x, size %d", dlist, *, (* - dlist) + 1)
+
+ .out .sprintf("C code can load at $%x", * + 1)
+
+helpshowing = FR1
+
+; here is where we store N<space> or FF (inverse)
+sounddisp = help + 78
+
; executable code here
start:
; setup color registers
@@ -162,13 +229,6 @@ keyok:
sta CH
rts ; return to DOS (which loads the rest of the game)
-wait1jiffy:
- lda RTCLOK+2
-wait:
- cmp RTCLOK+2
- beq wait
- rts
-
enable_disable_sound:
lda #2
sta helpshowing
@@ -187,30 +247,7 @@ now_on:
sta sounddisp+1
rts
- ; 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 $02 | $40 ; LMS, 1 line of GR.0 for the version
-help_lms:
- .word version
- .byte $41 ; JVB, jump & wait for vblank
- .word dlist
+ .out .sprintf("code ends at $%x", *)
end:
.word INITAD