mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-26 11:30:12 +00:00
mode7_demo: add scrolling
This commit is contained in:
parent
8c79f2b52d
commit
f0a2779fe8
@ -23,7 +23,8 @@ mode7_demo.o: mode7_demo.s mode7_demo_backgrounds.inc \
|
||||
../asm_routines/gr_unrle.s \
|
||||
../asm_routines/hlin_clearscreen.s \
|
||||
../asm_routines/gr_setpage.s \
|
||||
../asm_routines/gr_fade.s
|
||||
../asm_routines/gr_fade.s \
|
||||
../asm_routines/gr_copy.s
|
||||
ca65 -o mode7_demo.o mode7_demo.s -l mode7_demo.lst
|
||||
|
||||
|
||||
|
10
mode7_demo/deater_scroll.inc
Normal file
10
mode7_demo/deater_scroll.inc
Normal file
@ -0,0 +1,10 @@
|
||||
; Original size = 668 bytes
|
||||
deater_scroll:
|
||||
; scroll_length:
|
||||
.byte 167
|
||||
.byte $A0,$28,$00,$20,$20,$A3,$00,$A4,$20,$00,$00,$20,$20,$00,$00,$A3,$20,$00,$A4,$20,$00,$A3,$20,$A7,$00,$40,$A3,$00,$40,$00,$00,$40,$40,$A3,$00,$A3,$40,$A6,$00,$10,$00,$00,$10,$00,$A4,$10,$00,$A3,$10,$00,$00,$A4,$10,$00,$A3,$10,$00,$A3,$10,$00,$A3,$10,$A0,$82,$00
|
||||
.byte $A0,$28,$00,$E6,$00,$06,$E0,$00,$E6,$A4,$00,$E6,$00,$00,$E6,$00,$00,$E6,$00,$00,$E6,$A4,$00,$E6,$00,$00,$E6,$A6,$00,$DC,$A3,$00,$DC,$00,$DC,$00,$00,$DC,$00,$DC,$A9,$00,$B3,$00,$00,$B3,$00,$B3,$A4,$00,$B3,$00,$00,$B3,$00,$B3,$A4,$00,$03,$B3,$03,$00,$03,$B3,$03,$00,$03,$B3,$03,$A0,$82,$00
|
||||
.byte $A0,$28,$00,$EF,$00,$00,$EF,$00,$EF,$0F,$0F,$00,$00,$EF,$0F,$0F,$EF,$00,$00,$EF,$00,$00,$EF,$0F,$0F,$00,$00,$EF,$0F,$0F,$E0,$A6,$00,$DF,$00,$D0,$00,$DF,$00,$DF,$0F,$0F,$DF,$00,$00,$0F,$0F,$D0,$A6,$00,$BF,$0F,$0F,$BF,$00,$BF,$0F,$0F,$00,$00,$BF,$0F,$0F,$B0,$00,$BF,$0F,$0F,$A3,$00,$0F,$A3,$00,$0F,$A3,$00,$0F,$A0,$83,$00
|
||||
.byte $A0,$28,$00,$26,$20,$06,$00,$00,$26,$A3,$20,$00,$26,$00,$00,$26,$00,$00,$26,$00,$00,$26,$A3,$20,$00,$26,$00,$00,$26,$A6,$00,$4C,$0C,$00,$0C,$4C,$00,$4C,$00,$00,$4C,$00,$A3,$40,$0C,$A6,$00,$13,$00,$00,$13,$00,$13,$A3,$10,$00,$13,$00,$00,$13,$00,$13,$A3,$10,$00,$00,$13,$A3,$00,$13,$A3,$00,$13,$A0,$83,$00
|
||||
.byte $A1
|
||||
; Compressed size = 294 bytes
|
@ -25,11 +25,30 @@
|
||||
|
||||
demo_loop:
|
||||
|
||||
;==========
|
||||
; Fade in
|
||||
;==========
|
||||
|
||||
jsr fade_in
|
||||
|
||||
lda #255
|
||||
jsr WAIT
|
||||
;==========================================
|
||||
; Make sure page0 and page1 show same image
|
||||
;==========================================
|
||||
|
||||
jsr gr_copy_to_current
|
||||
|
||||
;===================
|
||||
; Scroll the message
|
||||
;===================
|
||||
|
||||
; lda #255
|
||||
; jsr WAIT
|
||||
|
||||
jsr scroll
|
||||
|
||||
;=============
|
||||
; Fade out
|
||||
;=============
|
||||
jsr fade_out
|
||||
|
||||
|
||||
@ -45,5 +64,199 @@ demo_loop:
|
||||
.include "../asm_routines/gr_setpage.s"
|
||||
.include "../asm_routines/pageflip.s"
|
||||
.include "../asm_routines/gr_fade.s"
|
||||
.include "../asm_routines/gr_copy.s"
|
||||
|
||||
.include "mode7_demo_backgrounds.inc"
|
||||
|
||||
|
||||
scroll_row1 EQU $8A00
|
||||
scroll_row2 EQU $8B00
|
||||
scroll_row3 EQU $8C00
|
||||
scroll_row4 EQU $8D00
|
||||
|
||||
SCROLL_LENGTH EQU $E6
|
||||
|
||||
|
||||
|
||||
scroll:
|
||||
lda #0
|
||||
sta ANGLE
|
||||
|
||||
;=======================
|
||||
; decompress scroll text
|
||||
;=======================
|
||||
lda #>deater_scroll
|
||||
sta INH
|
||||
lda #<deater_scroll
|
||||
sta INL
|
||||
jsr decompress_scroll
|
||||
|
||||
|
||||
scroll_loop:
|
||||
|
||||
ldx #0
|
||||
ldy ANGLE
|
||||
|
||||
lda DISP_PAGE
|
||||
beq draw_page2
|
||||
|
||||
lda #4
|
||||
sta sm1+2
|
||||
sta sm2+2
|
||||
lda #5
|
||||
sta sm3+2
|
||||
sta sm4+2
|
||||
jmp draw_done
|
||||
|
||||
draw_page2:
|
||||
lda #8
|
||||
sta sm1+2
|
||||
sta sm2+2
|
||||
lda #9
|
||||
sta sm3+2
|
||||
sta sm4+2
|
||||
draw_done:
|
||||
|
||||
draw_loop:
|
||||
|
||||
lda scroll_row1,Y
|
||||
sm1:
|
||||
sta $400,X
|
||||
|
||||
lda scroll_row2,Y
|
||||
sm2:
|
||||
sta $480,X
|
||||
|
||||
lda scroll_row3,Y
|
||||
sm3:
|
||||
sta $500,X
|
||||
|
||||
lda scroll_row4,Y
|
||||
sm4:
|
||||
sta $580,X
|
||||
|
||||
iny
|
||||
inx
|
||||
cpx #40
|
||||
bne draw_loop
|
||||
|
||||
;==================
|
||||
; flip pages
|
||||
;==================
|
||||
|
||||
jsr page_flip ; 6
|
||||
|
||||
;==================
|
||||
; delay
|
||||
;==================
|
||||
|
||||
lda #125
|
||||
jsr WAIT
|
||||
|
||||
|
||||
;==================
|
||||
; loop forever
|
||||
;==================
|
||||
clc
|
||||
lda ANGLE
|
||||
adc #40
|
||||
cmp SCROLL_LENGTH
|
||||
bne blah
|
||||
lda #0
|
||||
sta ANGLE
|
||||
jmp scroll_loop
|
||||
|
||||
blah:
|
||||
inc ANGLE
|
||||
jmp scroll_loop ; 3
|
||||
|
||||
|
||||
|
||||
;=======================
|
||||
; decompress scroll
|
||||
;=======================
|
||||
decompress_scroll:
|
||||
ldy #0
|
||||
jsr scroll_load_and_increment
|
||||
sta SCROLL_LENGTH
|
||||
|
||||
lda #<scroll_row1
|
||||
sta OUTL
|
||||
lda #>scroll_row1
|
||||
sta OUTH
|
||||
|
||||
decompress_scroll_loop:
|
||||
jsr scroll_load_and_increment ; load compressed value
|
||||
|
||||
cmp #$A1 ; EOF marker
|
||||
beq done_decompress_scroll ; if EOF, exit
|
||||
|
||||
pha ; save
|
||||
|
||||
and #$f0 ; mask
|
||||
cmp #$a0 ; see if special AX
|
||||
beq decompress_scroll_special
|
||||
|
||||
pla ; note, PLA sets flags!
|
||||
|
||||
ldx #$1 ; only want to print 1
|
||||
bne decompress_scroll_run
|
||||
|
||||
decompress_scroll_special:
|
||||
pla
|
||||
|
||||
and #$0f ; check if was A0
|
||||
|
||||
bne decompress_scroll_color ; if A0 need to read run, color
|
||||
|
||||
decompress_scroll_large:
|
||||
jsr scroll_load_and_increment ; get run length
|
||||
|
||||
decompress_scroll_color:
|
||||
tax ; put runlen into X
|
||||
jsr scroll_load_and_increment ; get color
|
||||
|
||||
decompress_scroll_run:
|
||||
sta (OUTL),Y
|
||||
pha
|
||||
|
||||
clc ; increment 16-bit pointer
|
||||
lda OUTL
|
||||
adc #$1
|
||||
sta OUTL
|
||||
lda OUTH
|
||||
adc #$0
|
||||
sta OUTH
|
||||
|
||||
pla
|
||||
|
||||
dex ; repeat for X times
|
||||
bne decompress_scroll_run
|
||||
|
||||
beq decompress_scroll_loop ; get next run
|
||||
|
||||
done_decompress_scroll:
|
||||
rts
|
||||
|
||||
|
||||
scroll_load_and_increment:
|
||||
lda (INL),Y ; load and increment 16-bit pointer
|
||||
pha
|
||||
clc
|
||||
lda INL
|
||||
adc #$1
|
||||
sta INL
|
||||
lda INH
|
||||
adc #$0
|
||||
sta INH
|
||||
pla
|
||||
rts
|
||||
|
||||
|
||||
;===============================================
|
||||
; Variables
|
||||
;===============================================
|
||||
|
||||
.include "deater_scroll.inc"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user