diff --git a/artwork/splash_v2/lzss_player.asm b/artwork/splash_v2/lzss_player.asm new file mode 100644 index 0000000..6a0bdfd --- /dev/null +++ b/artwork/splash_v2/lzss_player.asm @@ -0,0 +1,153 @@ +; --- dmsc LZSS player routine + +song_data + ins 'mmm_16.lzs' +song_end + +buffers + .ds 256 * 9 + +POKEY2 = POKEY+$10 ; stereo + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Song Initialization - this runs in the first tick: +; +.proc init_song + +; pokeys init + lda #3 ; stereo + sta POKEY+$0f ; stereo + sta POKEY2+$0f ; stereo + + mva #1 bit_data + + ; Example: here initializes song pointer: + + ;mwa #song_data song_ptr + + ; Init all channels: + ldx #8 + ldy #0 +clear + ; Read just init value and store into buffer and POKEY + jsr get_byte + sta POKEY, x + sta POKEY2,x ; stereo + sta stereo_buff,x ; stereo + sty chn_copy, x +cbuf + sta buffers + 255 + inc cbuf + 2 + dex + bpl clear + + ; Initialize buffer pointer: + sty bptr + sty cur_pos + rts +.endp + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Wait for next frame +; +.proc wait_frame + + lda 20 +delay + cmp 20 + beq delay +.endp + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Play one frame of the song +; +.proc play_frame + ldx #8 ; stereo +@ lda stereo_buff,x ; stereo + sta POKEY2,x ; stereo + dex ;stereo + bpl @- ; stereo + + lda #>buffers + sta bptr+1 + + lda song_data + sta chn_bits + ldx #8 + + ; Loop through all "channels", one for each POKEY register +chn_loop: + lsr chn_bits + bcs skip_chn ; C=1 : skip this channel + + lda chn_copy, x ; Get status of this stream + bne do_copy_byte ; If > 0 we are copying bytes + + ; We are decoding a new match/literal + lsr bit_data ; Get next bit + bne got_bit + jsr get_byte ; Not enough bits, refill! + ror ; Extract a new bit and add a 1 at the high bit (from C set above) + sta bit_data ; +got_bit: + jsr get_byte ; Always read a byte, it could mean "match size/offset" or "literal byte" + bcs store ; Bit = 1 is "literal", bit = 0 is "match" + + sta chn_pos, x ; Store in "copy pos" + + jsr get_byte + sta chn_copy, x ; Store in "copy length" + + ; And start copying first byte +do_copy_byte: + dec chn_copy, x ; Decrease match length, increase match position + inc chn_pos, x + ldy chn_pos, x + + ; Now, read old data, jump to data store + lda (bptr), y + +store: + ldy cur_pos + sta POKEY,x ; Store to output and buffer + sta stereo_buff,x ; stereo + sta (bptr), y + +skip_chn: + ; Increment channel buffer pointer + inc bptr+1 + + dex + bpl chn_loop ; Next channel + + inc cur_pos +.endp + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check for ending of song and jump to the next frame +; + +; not checking really so the tune gets funky :))) + ;lda song_ptr + 1 + ;cmp #>song_end + ;bne wait_frame + ;lda song_ptr + ;cmp #=204 +scr ins "output.png.mic", 0, 8160 + :16 .byte 0 + ins "output.png.mic" , +8160 + ELS +scr ins "output.png.mic" + EIF + + .ifdef nil_used +nil :8*40 brk + eif + + .ALIGN $0400 +ant ANTIC_PROGRAM scr,ant + +fnt + + ift USESPRITES + .ALIGN $0800 + .ds $0300 +pmg SPRITES + eif + +FontSplash + ins '../../artwork/weapons_AW6_mod.fnt' ; 'artwork/weapons.fnt' + +mother +; dta d" The Mother of All Games " + dta d" Father Unknown of All Games " + icl "lzss_player.asm" ; player (and data) for splash music + +main + jsr init_song + +* --- init PMG + + ift USESPRITES + mva >pmg pmbase ;missiles and players data address + mva #$03 pmcntl ;enable players and missiles + eif + + lda:cmp:req $14 ;wait 1 frame + + sei ;stop interrups + mva #$00 nmien ;stop all interrupts + mva #$fe portb ;switch off ROM to get 16k more ram + + ZPINIT + +//////////////////// +// RASTER PROGRAM // +//////////////////// + +; jmp line239 + jmp raster_program_end + +LOOP lda vcount ;synchronization for the first screen (picture) line + cmp #$02 + ;sta colpf0 + ;sta colpm0 + ;sta colbak + bne LOOP + + mva #%00111110 dmactl ;set new screen width + mva ant dlptr+1 + + icl "output.png.rp.ini" + +;--- 16 lines down ---- !!! + :16 sta wsync + + ; wait 13 cycles !!! + :4 nop + inc byt2 + +;--- wait 18 cycles +; jsr _rts +; inc byt3 + + +;--- set global offset (23 cycles) + jsr _rts + cmp byt3\ pha:pla + +;--- empty line + jsr wait54cycle + inc byt2 + + icl "output.png.rp" + +raster_program_end + + lda >FontSplash + sta chbase +c0 lda #$00 + sta colbak +c1 lda #$00 + sta colpf0 +c2 lda #$02 + sta colpf1 +c3 lda #$08 + sta colpf2 +c4 lda #$00 + sta colpf3 +s0 lda #$03 + sta sizep0 + sta sizep1 + sta sizep2 + sta sizep3 + mva #$ff sizem + sta grafm + mva #$20 hposm0 + mva #$28 hposm1 + mva #$d0 hposm2 + mva #$d8 hposm3 + mva #$02 pmcntl + lda #$14 + sta gtictl + + +//-------------------- +// EXIT +//-------------------- + + lda trig0 ; FIRE #0 + beq stop + + lda trig1 ; FIRE #1 + beq stop + + lda consol ; START + and #1 + beq stop + + lda skctl ; ANY KEY + and #$04 + bne skp + +stop mva #$00 pmcntl ;PMG disabled + tax + sta:rne hposp0,x+ + + ; silent + lda #0 + ldx #8 +@ sta POKEY,x + sta POKEY2,x ; stereo + dex + bpl @- + + ;no glitching please (issue #67) + lda #0 + sta $D400 ;dmactl + sta $022F ;dmactls + + + mva #$ff portb ;ROM switch on + mva #$40 nmien ;only NMI interrupts, DLI disabled + cli ;IRQ enabled + + rts ;return to ... DOS +skp + +//-------------------- + jsr play_frame + + jmp LOOP + +;--- + +wait54cycle + :2 inc byt2 +wait44cycle + inc byt3 + nop +wait36cycle + inc byt3 + jsr _rts +wait18cycle + inc byt3 +_rts rts + +byt3 brk + + +;--- + +.MACRO ANTIC_PROGRAM + dta $70,$70 + :+8 dta $4e,a(:1+$0000+#*40) + :+8 dta $4e,a(:1+$0140+#*40) + :+8 dta $4e,a(:1+$0280+#*40) + :+8 dta $4e,a(:1+$03C0+#*40) + :+8 dta $4e,a(:1+$0500+#*40) + :+8 dta $4e,a(:1+$0640+#*40) + :+8 dta $4e,a(:1+$0780+#*40) + :+8 dta $4e,a(:1+$08C0+#*40) + :+8 dta $4e,a(:1+$0A00+#*40) + :+8 dta $4e,a(:1+$0B40+#*40) + :+8 dta $4e,a(:1+$0C80+#*40) + :+8 dta $4e,a(:1+$0DC0+#*40) + :+8 dta $4e,a(:1+$0F00+#*40) + :+8 dta $4e,a(:1+$1040+#*40) + :+8 dta $4e,a(:1+$1180+#*40) + :+8 dta $4e,a(:1+$12C0+#*40) + :+8 dta $4e,a(:1+$1400+#*40) + :+8 dta $4e,a(:1+$1540+#*40) + :+8 dta $4e,a(:1+$1680+#*40) + :+8 dta $4e,a(:1+$17C0+#*40) + :+8 dta $4e,a(:1+$1900+#*40) + :+8 dta $4e,a(:1+$1A40+#*40) + :+8 dta $4e,a(:1+$1B80+#*40) + :+8 dta $4e,a(:1+$1CC0+#*40) + :+8 dta $4e,a(:1+$1E00+#*40) +; :+4 dta $4e,a(:1+$1F40+#*40) +; :+4 dta $4e,a(:1+$1FF0+#*40) +; :+8 dta $4e,a(:1+$2090+#*40) +; :+8 dta $4e,a(:1+$21D0+#*40) +; :+8 dta $4e,a(:1+$2310+#*40) +; :+8 dta $4e,a(:1+$2450+#*40) + dta $00 + dta $42,a(mother) + dta $41,a(:2) +.ENDM + +CL + +.MACRO ZPINIT +.ENDM + +ZCOLORS = 0 + +;--- + ini main +;--- + + opt l- + +.MACRO SPRITES + icl "output.png.pmg" +.ENDM + +USESPRITES = 1 + diff --git a/artwork/splash_v2/splash.h b/artwork/splash_v2/splash.h new file mode 100644 index 0000000..a1223e5 --- /dev/null +++ b/artwork/splash_v2/splash.h @@ -0,0 +1,55 @@ + +.enum @@dmactl + blank = %00 + narrow = %01 + standard= %10 + wide = %11 + missiles= %100 + players = %1000 + lineX1 = %10000 + lineX2 = %00000 + dma = %100000 +.ende + +.enum @@pmcntl + missiles= %1 + players = %10 + trigs = %100 +.ende + +.enum @@gtictl + prior0 = %0 + prior1 = %1 + prior2 = %10 + prior4 = %100 + prior8 = %1000 + ply5 = %10000 ; Fifth Player Enable + mlc = %100000 ; Multiple Color Player Enable + mode9 = %01000000 + mode10 = %10000000 + mode11 = %11000000 +.ende + +* --------------------------------------------------------------------------------------------- +* --- GTIA +* --------------------------------------------------------------------------------------------- + +gtictl = PRIOR ; rejestr kontroli układu GTIA +gtiactl = gtictl + +pmcntl = GRACTL ; rejestr kontroli graczy i pocisków + +* --------------------------------------------------------------------------------------------- +* --- POKEY +* --------------------------------------------------------------------------------------------- + +irqens = $0010 ; rejestr-cień IRQEN +irqstat = $0011 ; rejestr-cień IRQST + +skstres = SKRES ; rejestr statusu złącza szeregowego (Z) + +* --------------------------------------------------------------------------------------------- +* --- ANTIC +* --------------------------------------------------------------------------------------------- +chrctl = CHACTL ; rejestr kontroli wyświetlania znaków +