2017-12-15 21:19:01 +00:00
|
|
|
.include "zp.inc"
|
|
|
|
|
2018-03-13 04:59:54 +00:00
|
|
|
square1_lo EQU $1000
|
|
|
|
square1_hi EQU $1200
|
|
|
|
square2_lo EQU $1400
|
|
|
|
square2_hi EQU $1600
|
|
|
|
|
|
|
|
scroll_row1 EQU $1800
|
|
|
|
scroll_row2 EQU $1900
|
|
|
|
scroll_row3 EQU $1a00
|
|
|
|
scroll_row4 EQU $1b00
|
|
|
|
|
|
|
|
; matches scroll_row1 - row3
|
|
|
|
star_x EQU $1800
|
|
|
|
star_y EQU $1900
|
|
|
|
star_z EQU $1a00
|
|
|
|
|
|
|
|
|
2018-03-05 03:55:38 +00:00
|
|
|
start:
|
2018-03-02 00:52:11 +00:00
|
|
|
;================================
|
2018-03-05 03:55:38 +00:00
|
|
|
; include VMW logo line 0
|
2018-03-02 00:52:11 +00:00
|
|
|
;================================
|
|
|
|
|
2018-03-05 03:55:38 +00:00
|
|
|
;.byte $AA,$AD,$D5,$AC,$95
|
|
|
|
tax ; $aa
|
|
|
|
lda $ACD5 ; $ad,$d5,$ac
|
|
|
|
sta $0,X ; $95,$00
|
|
|
|
|
2018-03-02 00:52:11 +00:00
|
|
|
;================================
|
|
|
|
; Mockingboard detect
|
|
|
|
;================================
|
|
|
|
|
|
|
|
jsr mockingboard_detect_slot4 ; call detection routine
|
|
|
|
stx MB_DETECTED
|
2018-03-13 17:19:13 +00:00
|
|
|
beq mockingboard_setup_done
|
|
|
|
|
|
|
|
;================================
|
|
|
|
; Mockingboard start
|
|
|
|
;================================
|
|
|
|
mockingboard_setup:
|
|
|
|
jsr mockingboard_init
|
|
|
|
jsr reset_ay_both
|
|
|
|
jsr clear_ay_both
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; Setup Interrupt Handler
|
|
|
|
;=========================
|
|
|
|
; Vector address goes to 0x3fe/0x3ff
|
|
|
|
; FIXME: should chain any existing handler
|
|
|
|
|
|
|
|
lda #<interrupt_handler
|
|
|
|
sta $03fe
|
|
|
|
lda #>interrupt_handler
|
|
|
|
sta $03ff
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Enable 50Hz clock on 6522
|
|
|
|
;============================
|
|
|
|
|
|
|
|
sei ; disable interrupts just in case
|
|
|
|
|
|
|
|
lda #$40 ; Continuous interrupts, don't touch PB7
|
|
|
|
sta $C40B ; ACR register
|
|
|
|
lda #$7F ; clear all interrupt flags
|
|
|
|
sta $C40E ; IER register (interrupt enable)
|
|
|
|
|
|
|
|
lda #$C0
|
|
|
|
sta $C40D ; IFR: 1100, enable interrupt on timer one oflow
|
|
|
|
sta $C40E ; IER: 1100, enable timer one interrupt
|
|
|
|
|
|
|
|
lda #$E7
|
|
|
|
sta $C404 ; write into low-order latch
|
|
|
|
lda #$4f
|
|
|
|
sta $C405 ; write into high-order latch,
|
|
|
|
; load both values into counter
|
|
|
|
; clear interrupt and start counting
|
|
|
|
|
|
|
|
; 4fe7 / 1e6 = .020s, 50Hz
|
|
|
|
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; Start Playing
|
|
|
|
;============================
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta DONE_PLAYING
|
|
|
|
sta WHICH_CHUNK
|
|
|
|
sta MB_CHUNK_OFFSET
|
|
|
|
sta MB_ADDRL ; we are aligned, so should be 0
|
|
|
|
|
|
|
|
lda #>music_start
|
|
|
|
sta MB_ADDRH
|
|
|
|
|
|
|
|
;=====================================
|
|
|
|
; clear register area
|
|
|
|
;=====================================
|
|
|
|
ldx #13 ; 2
|
|
|
|
lda #0 ; 2
|
|
|
|
mb_setup_clear_reg:
|
|
|
|
sta REGISTER_DUMP,X ; clear register value ; 4
|
|
|
|
sta REGISTER_OLD,X ; clear old values ; 4
|
|
|
|
dex ; 2
|
|
|
|
bpl mb_setup_clear_reg ; 2nt/3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cli ; start interrupts
|
|
|
|
|
|
|
|
|
2018-03-02 00:52:11 +00:00
|
|
|
|
2018-03-13 17:19:13 +00:00
|
|
|
mockingboard_setup_done:
|
2017-12-15 21:19:01 +00:00
|
|
|
;================================
|
|
|
|
; Clear screen and setup graphics
|
|
|
|
;================================
|
|
|
|
|
|
|
|
jsr set_gr_page0
|
|
|
|
|
2017-12-18 03:03:20 +00:00
|
|
|
lda #$4
|
2017-12-17 05:35:32 +00:00
|
|
|
sta DRAW_PAGE
|
|
|
|
|
2017-12-21 19:59:06 +00:00
|
|
|
; Initialize the 2kB of multiply lookup tables
|
|
|
|
jsr init_multiply_tables
|
|
|
|
|
|
|
|
;================================
|
|
|
|
; Main Loop
|
|
|
|
;================================
|
|
|
|
|
|
|
|
main_loop:
|
2018-03-18 03:40:16 +00:00
|
|
|
jsr title_routine
|
2017-12-21 19:59:06 +00:00
|
|
|
|
2018-03-18 03:40:16 +00:00
|
|
|
jsr checkerboard_demo
|
|
|
|
jsr island_demo
|
2017-12-21 19:59:06 +00:00
|
|
|
jsr star_demo
|
2018-01-30 05:55:40 +00:00
|
|
|
jsr star_credits
|
2017-12-21 19:59:06 +00:00
|
|
|
|
|
|
|
jmp main_loop
|
|
|
|
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; Checkerboard Demo
|
|
|
|
;===========================
|
|
|
|
checkerboard_demo:
|
|
|
|
; initialize
|
|
|
|
lda #>sky_background
|
|
|
|
sta INH
|
|
|
|
lda #<sky_background
|
|
|
|
sta INL
|
2018-01-28 04:28:17 +00:00
|
|
|
jsr decompress_scroll ; load sky background
|
2017-12-21 19:59:06 +00:00
|
|
|
|
2018-01-28 04:28:17 +00:00
|
|
|
lda #0 ; no draw blue sky
|
2017-12-22 02:56:57 +00:00
|
|
|
sta DRAW_BLUE_SKY
|
|
|
|
|
|
|
|
|
2018-01-28 04:28:17 +00:00
|
|
|
lda #$20 ; setup self-modifying code
|
|
|
|
sta nomatch ; to use checkerboard map
|
2017-12-22 02:56:57 +00:00
|
|
|
lda #<lookup_checkerboard_map
|
|
|
|
sta nomatch+1
|
|
|
|
lda #>lookup_checkerboard_map
|
|
|
|
sta nomatch+2
|
|
|
|
lda #$4c
|
|
|
|
sta nomatch+3
|
|
|
|
lda #<match
|
|
|
|
sta nomatch+4
|
|
|
|
lda #>match
|
|
|
|
sta nomatch+5
|
|
|
|
|
2018-01-28 05:45:31 +00:00
|
|
|
lda #<checkerboard_flying_directions
|
|
|
|
sta direction_smc_1+1
|
|
|
|
sta direction_smc_2+1
|
|
|
|
lda #>checkerboard_flying_directions
|
|
|
|
sta direction_smc_1+2
|
|
|
|
sta direction_smc_2+2
|
|
|
|
|
|
|
|
|
2018-01-28 04:28:17 +00:00
|
|
|
jsr mode7_flying ; call generic mode7 code
|
2017-12-21 19:59:06 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; Island Demo
|
|
|
|
;===========================
|
|
|
|
island_demo:
|
|
|
|
; initialize
|
|
|
|
|
2017-12-22 02:56:57 +00:00
|
|
|
lda #1
|
|
|
|
sta DRAW_BLUE_SKY
|
|
|
|
|
|
|
|
lda #$A5 ; fix the code that was self-modified
|
|
|
|
sta nomatch ; away in checkerboard code
|
|
|
|
lda #$6A
|
|
|
|
sta nomatch+1
|
|
|
|
lda #$8D
|
|
|
|
sta nomatch+2
|
|
|
|
lda #<(spacex_label+1)
|
|
|
|
sta nomatch+3
|
|
|
|
lda #>(spacex_label+1)
|
|
|
|
sta nomatch+4
|
|
|
|
lda #$29
|
|
|
|
sta nomatch+5
|
|
|
|
|
2018-01-28 05:45:31 +00:00
|
|
|
lda #<island_flying_directions
|
|
|
|
sta direction_smc_1+1
|
|
|
|
sta direction_smc_2+1
|
|
|
|
lda #>island_flying_directions
|
|
|
|
sta direction_smc_1+2
|
|
|
|
sta direction_smc_2+2
|
|
|
|
|
2017-12-21 19:59:06 +00:00
|
|
|
jsr mode7_flying
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; Star Demo
|
|
|
|
;===========================
|
|
|
|
star_demo:
|
|
|
|
; initialize
|
|
|
|
|
2018-01-30 05:55:40 +00:00
|
|
|
lda #48
|
|
|
|
sta y_limit_smc+1
|
|
|
|
|
2018-01-08 05:50:18 +00:00
|
|
|
jsr starfield_demo
|
2017-12-21 19:59:06 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2018-01-30 05:55:40 +00:00
|
|
|
;===========================
|
|
|
|
; Star Credits
|
|
|
|
;===========================
|
|
|
|
star_credits:
|
|
|
|
; initialize
|
|
|
|
|
|
|
|
lda #40
|
|
|
|
sta y_limit_smc+1
|
|
|
|
|
|
|
|
jsr starfield_credits
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2017-12-21 19:59:06 +00:00
|
|
|
;===========================
|
|
|
|
; Title routine
|
|
|
|
;===========================
|
|
|
|
|
|
|
|
title_routine:
|
|
|
|
bit FULLGR
|
|
|
|
jsr clear_screens_notext ; clear top/bottom of page 0/1
|
|
|
|
|
2017-12-15 21:19:01 +00:00
|
|
|
lda #<demo_rle
|
|
|
|
sta GBASL
|
|
|
|
lda #>demo_rle
|
|
|
|
sta GBASH
|
|
|
|
|
2017-12-17 05:35:32 +00:00
|
|
|
; Load offscreen
|
|
|
|
lda #<$c00
|
2017-12-15 21:19:01 +00:00
|
|
|
sta BASL
|
2017-12-17 05:35:32 +00:00
|
|
|
lda #>$c00
|
2017-12-15 21:19:01 +00:00
|
|
|
sta BASH
|
|
|
|
|
|
|
|
jsr load_rle_gr
|
|
|
|
|
2017-12-18 04:06:49 +00:00
|
|
|
;==========
|
|
|
|
; Fade in
|
|
|
|
;==========
|
|
|
|
|
2017-12-18 03:18:24 +00:00
|
|
|
jsr fade_in
|
|
|
|
|
2017-12-18 04:06:49 +00:00
|
|
|
;==========================================
|
|
|
|
; Make sure page0 and page1 show same image
|
|
|
|
;==========================================
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; Scroll the message
|
|
|
|
;===================
|
2017-12-18 03:18:24 +00:00
|
|
|
|
2017-12-18 06:05:05 +00:00
|
|
|
; Scroll "BY DEATER... A VMW PRODUCTION"
|
2017-12-18 04:40:52 +00:00
|
|
|
|
|
|
|
lda #>deater_scroll
|
|
|
|
sta INH
|
|
|
|
lda #<deater_scroll
|
|
|
|
sta INL
|
|
|
|
|
2017-12-18 06:05:05 +00:00
|
|
|
lda #40 ; scroll at bottom of screen
|
2017-12-18 04:40:52 +00:00
|
|
|
sta CV
|
|
|
|
|
2017-12-18 06:05:05 +00:00
|
|
|
jsr gr_scroll
|
|
|
|
|
|
|
|
; Scroll "* APPLE ][ FOREVER *"
|
|
|
|
|
|
|
|
lda #>a2_scroll
|
|
|
|
sta INH
|
|
|
|
lda #<a2_scroll
|
|
|
|
sta INL
|
2017-12-18 04:40:52 +00:00
|
|
|
|
|
|
|
jsr gr_scroll
|
2017-12-18 04:06:49 +00:00
|
|
|
|
|
|
|
;=============
|
|
|
|
; Fade out
|
|
|
|
;=============
|
2017-12-18 03:18:24 +00:00
|
|
|
jsr fade_out
|
|
|
|
|
2017-12-21 19:59:06 +00:00
|
|
|
rts
|
2017-12-18 03:18:24 +00:00
|
|
|
|
|
|
|
|
2017-12-15 21:19:01 +00:00
|
|
|
;===============================================
|
|
|
|
; External modules
|
|
|
|
;===============================================
|
|
|
|
|
2017-12-17 05:35:32 +00:00
|
|
|
.include "../asm_routines/gr_unrle.s"
|
2017-12-31 20:22:38 +00:00
|
|
|
.include "../asm_routines/gr_fast_clear.s"
|
|
|
|
.include "../asm_routines/gr_hlin.s"
|
2017-12-16 18:52:00 +00:00
|
|
|
.include "../asm_routines/gr_setpage.s"
|
2017-12-18 03:03:20 +00:00
|
|
|
.include "../asm_routines/pageflip.s"
|
2017-12-18 03:35:21 +00:00
|
|
|
.include "../asm_routines/gr_fade.s"
|
2017-12-18 04:06:49 +00:00
|
|
|
.include "../asm_routines/gr_copy.s"
|
2017-12-18 05:40:13 +00:00
|
|
|
.include "../asm_routines/gr_scroll.s"
|
2017-12-31 20:22:38 +00:00
|
|
|
.include "../asm_routines/gr_offsets.s"
|
2018-01-08 05:50:18 +00:00
|
|
|
.include "../asm_routines/gr_plot.s"
|
2018-01-31 15:16:43 +00:00
|
|
|
.include "../asm_routines/text_print.s"
|
2018-03-02 00:52:11 +00:00
|
|
|
.include "../asm_routines/mockingboard_a.s"
|
2017-12-15 21:19:01 +00:00
|
|
|
|
2017-12-21 19:59:06 +00:00
|
|
|
.include "mode7.s"
|
|
|
|
|
2017-12-15 21:19:01 +00:00
|
|
|
.include "mode7_demo_backgrounds.inc"
|
2017-12-18 04:06:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
;===============================================
|
2018-01-08 05:50:18 +00:00
|
|
|
; More routines
|
2017-12-18 04:06:49 +00:00
|
|
|
;===============================================
|
|
|
|
|
2017-12-18 06:05:05 +00:00
|
|
|
.include "deater.scrolltext"
|
|
|
|
.include "a2.scrolltext"
|
2018-01-08 05:50:18 +00:00
|
|
|
.include "starfield_demo.s"
|
2018-01-31 06:15:47 +00:00
|
|
|
.include "rasterbars.s"
|
2018-01-31 15:16:43 +00:00
|
|
|
.include "credits.s"
|
2018-03-13 17:19:13 +00:00
|
|
|
.include "interrupt_handler.s"
|
2018-03-13 14:44:18 +00:00
|
|
|
|
|
|
|
.align 256
|
|
|
|
|
2018-03-13 17:19:13 +00:00
|
|
|
music_start:
|
2018-03-13 14:44:18 +00:00
|
|
|
.incbin "out.krg"
|