.scope TitleDemo .zeropage .code __Start: ;;; start action Init 2 main_init .include "vcs-ca65.h" .macpack longbranch .define PAL 0 __NMI: __Reset: __BRK: CLEAN_START ;;; start action Demo 1 start jmp Title__Start ;;; end action Demo 1 start ; start main routine .segment "VECTORS" Return: .word $6060 VecNMI: VecReset: .word Main::__Reset VecBRK: .word Main::__BRK ;;; end action Init 2 main_init .scope Title .zeropage TEMP: Kernel48Pixel__2__tmp: .res 1 .res 1 .code KernelSection_lines_b0: .byte 60 .byte 10 .byte 2 .byte 10 .byte 10 BGColor_bgcolor_b0: .byte 160 .byte 162 .byte 164 .byte 162 .byte 160 PFColor_pfcolor_b0: .byte 252 Bitmap48_bitmap0_b0: .byte Bitmap48_bitmap0_e3_b0 Bitmap48_bitmap0_e3_b0: .byte 0 .byte 0 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 3 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 3 .byte 15 .byte 12 .byte 24 .byte 24 .byte 24 .byte 24 .byte 28 .byte 31 .byte 27 .byte 24 .byte 24 .byte 12 .byte 15 .byte 3 Bitmap48_bitmap1_b0: .byte Bitmap48_bitmap1_e3_b0 Bitmap48_bitmap1_e3_b0: .byte 0 .byte 0 .byte 255 .byte 255 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 254 .byte 254 .byte 0 .byte 0 .byte 0 .byte 0 .byte 255 .byte 255 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 192 .byte 225 .byte 51 .byte 51 .byte 48 .byte 48 .byte 48 .byte 112 .byte 225 .byte 193 .byte 1 .byte 49 .byte 49 .byte 225 .byte 193 Bitmap48_bitmap2_b0: .byte Bitmap48_bitmap2_e3_b0 Bitmap48_bitmap2_e3_b0: .byte 0 .byte 0 .byte 3 .byte 15 .byte 28 .byte 24 .byte 56 .byte 48 .byte 48 .byte 48 .byte 48 .byte 48 .byte 56 .byte 24 .byte 28 .byte 15 .byte 3 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 248 .byte 252 .byte 14 .byte 6 .byte 6 .byte 6 .byte 6 .byte 14 .byte 252 .byte 248 .byte 128 .byte 128 .byte 128 .byte 254 .byte 254 Bitmap48_bitmap3_b0: .byte Bitmap48_bitmap3_e3_b0 Bitmap48_bitmap3_e3_b0: .byte 0 .byte 0 .byte 224 .byte 248 .byte 28 .byte 12 .byte 14 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 4 .byte 12 .byte 28 .byte 248 .byte 224 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 31 .byte 63 .byte 49 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 49 .byte 63 .byte 15 Bitmap48_bitmap4_b0: .byte Bitmap48_bitmap4_e3_b0 Bitmap48_bitmap4_e3_b0: .byte 0 .byte 0 .byte 31 .byte 127 .byte 96 .byte 192 .byte 192 .byte 0 .byte 1 .byte 31 .byte 62 .byte 112 .byte 192 .byte 192 .byte 96 .byte 127 .byte 31 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 15 .byte 143 .byte 142 .byte 199 .byte 195 .byte 193 .byte 192 .byte 192 .byte 192 .byte 192 .byte 192 .byte 204 .byte 142 .byte 135 .byte 3 Bitmap48_bitmap5_b0: .byte Bitmap48_bitmap5_e3_b0 Bitmap48_bitmap5_e3_b0: .byte 0 .byte 0 .byte 128 .byte 192 .byte 224 .byte 96 .byte 96 .byte 96 .byte 224 .byte 192 .byte 0 .byte 0 .byte 0 .byte 96 .byte 224 .byte 192 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 248 .byte 248 .byte 0 .byte 0 .byte 128 .byte 192 .byte 224 .byte 112 .byte 48 .byte 24 .byte 24 .byte 24 .byte 24 .byte 240 .byte 224 Bitmap48_height_b0: .byte 36 __Start: ;;; start action FrameLoop 1 start FrameLoop__start__3__NextFrame: FRAME_START ;;; start action StaticKernel 3 preframe ;;; start action Kernel48Pixel 2 kernelsetup ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action Kernel48Pixel 2 kernelsetup ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action StaticKernel 3 kernelsetup lda #160 sta COLUBK ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 preframe KERNEL_START ;;; start action StaticKernel 3 kernel ldx #0 StaticKernel__kernel__10____each: sta WSYNC ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__11____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__11____skipxlo lda #36 sta Kernel48Pixel__2__tmp+0 ; scanline counter lda #$22 sta COLUP0 ; show how players alternate lda #$12 sta COLUP1 ; by having different colors lda #3 sta NUSIZ0 sta NUSIZ1 ; both players have 3 copies sta WSYNC SLEEPH 35 sta RESP0 ; position 1st player sta RESP1 ; ...and 2nd player lda #$10 sta HMP1 ; 1 pixel to the left sta WSYNC sta HMOVE ; apply HMOVE lda #1 sta VDELP0 ; we need the VDEL registers sta VDELP1 ; so we can do our 4-store trick SLEEPH 24-8 ; sleep 24 cycles sta HMCLR ; clear HMOVE registers Kernel48Pixel__kernelsetup__11____skipxlo: Kernel48Pixel__kernelsetup__11____skipxhi: ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__12____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__12____skipxlo lda #252 sta COLUP0 sta COLUP1 Kernel48Pixel__kernelsetup__12____skipxlo: Kernel48Pixel__kernelsetup__12____skipxhi: ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action StaticKernel 3 kernelsetup lda BGColor_bgcolor_b0,x sta COLUBK ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup cpx #2+1 jcs StaticKernel__kernelsetup__14____skipxhi cpx #2 jcc StaticKernel__kernelsetup__14____skipxlo lda #252 sta COLUPF StaticKernel__kernelsetup__14____skipxlo: StaticKernel__kernelsetup__14____skipxhi: ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; start action Kernel48Pixel 2 kerneldraw cpx #2+1 jcs Kernel48Pixel__kerneldraw__16____skipxhi cpx #2 jcc Kernel48Pixel__kerneldraw__16____skipxlo txa pha Kernel48Pixel__kerneldraw__16__Loop: ldy Kernel48Pixel__2__tmp+0 ; counts backwards sta WSYNC ; sync to next scanline lda Bitmap48_bitmap0_e3_b0,y ; load B0 (1st sprite byte) sta GRP0 ; B0 -> [GRP0] lda Bitmap48_bitmap1_e3_b0,y ; load B1 -> A sta GRP1 ; B1 -> [GRP1], B0 -> GRP0 lda Bitmap48_bitmap2_e3_b0,y ; load B2 -> A sta GRP0 ; B2 -> [GRP0], B1 -> GRP1 lda Bitmap48_bitmap5_e3_b0,y ; load B5 -> A sta Kernel48Pixel__2__tmp+1 ; B5 -> temp ldx Bitmap48_bitmap4_e3_b0,y ; load B4 -> X lda Bitmap48_bitmap3_e3_b0,y ; load B3 -> A ldy Kernel48Pixel__2__tmp+1 ; load B5 -> Y sta GRP1 ; B3 -> [GRP1]; B2 -> GRP0 stx GRP0 ; B4 -> [GRP0]; B3 -> GRP1 sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0 sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1 dec Kernel48Pixel__2__tmp+0 ; go to next line bpl Kernel48Pixel__kerneldraw__16__Loop ; repeat until < 0 pla tax Kernel48Pixel__kerneldraw__16____skipxlo: Kernel48Pixel__kerneldraw__16____skipxhi: ;;; end action Kernel48Pixel 2 kerneldraw ;;; start action StaticKernel 3 kerneldraw ldy KernelSection_lines_b0,x StaticKernel__kerneldraw__17__loop: sta WSYNC dey bne StaticKernel__kerneldraw__17__loop ;;; end action StaticKernel 3 kerneldraw inx cpx #5 jne StaticKernel__kernel__10____each StaticKernel__kernel__10____exit: ;;; end action StaticKernel 3 kernel KERNEL_END ;;; start action JoyButton 4 postframe lda INPT4 ;read button input bmi JoyButton__postframe__18__NotPressed ;;; start action Advance 5 joybutton jmp Title2__Start ;;; end action Advance 5 joybutton JoyButton__postframe__18__NotPressed: ;;; end action JoyButton 4 postframe FRAME_END jmp FrameLoop__start__3__NextFrame ; loop to next frame ;;; end action FrameLoop 1 start .endscope Title__Start = Title::__Start .scope Title2 .zeropage BGColor_bgcolor_b0: .res 1 .res 1 .res 1 .res 1 .res 1 PFColor_pfcolor_b0: .res 1 TEMP: Kernel48Pixel__2__tmp: .res 1 .res 1 .code KernelSection_lines_b0: .byte 60 .byte 10 .byte 2 .byte 10 .byte 10 Bitmap48_bitmap0_b0: .byte Bitmap48_bitmap0_e2_b0 Bitmap48_bitmap0_e2_b0: .byte 0 .byte 1 .byte 1 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 7 .byte 31 .byte 24 .byte 0 .byte 7 .byte 15 .byte 24 .byte 24 .byte 24 .byte 24 .byte 24 .byte 24 .byte 24 .byte 15 .byte 7 .byte 0 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap1_b0: .byte Bitmap48_bitmap1_e2_b0 Bitmap48_bitmap1_e2_b0: .byte 0 .byte 192 .byte 224 .byte 96 .byte 96 .byte 97 .byte 99 .byte 102 .byte 102 .byte 102 .byte 102 .byte 102 .byte 102 .byte 103 .byte 99 .byte 97 .byte 0 .byte 0 .byte 96 .byte 96 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 192 .byte 224 .byte 96 .byte 48 .byte 176 .byte 241 .byte 115 .byte 51 .byte 51 .byte 51 .byte 51 .byte 51 .byte 115 .byte 241 .byte 176 .byte 0 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap2_b0: .byte Bitmap48_bitmap2_e2_b0 Bitmap48_bitmap2_e2_b0: .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 240 .byte 248 .byte 12 .byte 12 .byte 12 .byte 12 .byte 12 .byte 12 .byte 12 .byte 248 .byte 240 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 248 .byte 252 .byte 6 .byte 6 .byte 6 .byte 6 .byte 6 .byte 6 .byte 14 .byte 252 .byte 248 .byte 0 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap3_b0: .byte Bitmap48_bitmap3_e2_b0 Bitmap48_bitmap3_e2_b0: .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 222 .byte 243 .byte 225 .byte 193 .byte 193 .byte 193 .byte 193 .byte 193 .byte 225 .byte 255 .byte 222 .byte 192 .byte 192 .byte 192 .byte 192 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 31 .byte 63 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 96 .byte 63 .byte 31 .byte 0 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap4_b0: .byte Bitmap48_bitmap4_e2_b0 Bitmap48_bitmap4_e2_b0: .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 12 .byte 12 .byte 128 .byte 128 .byte 140 .byte 140 .byte 140 .byte 140 .byte 140 .byte 12 .byte 12 .byte 12 .byte 12 .byte 12 .byte 12 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 3 .byte 135 .byte 204 .byte 204 .byte 204 .byte 204 .byte 204 .byte 204 .byte 204 .byte 135 .byte 3 .byte 0 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap5_b0: .byte Bitmap48_bitmap5_e2_b0 Bitmap48_bitmap5_e2_b0: .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 0 .byte 216 .byte 248 .byte 56 .byte 24 .byte 24 .byte 24 .byte 24 .byte 24 .byte 56 .byte 248 .byte 216 .byte 24 .byte 24 .byte 24 .byte 24 Bitmap48_height_b0: .byte 43 Title2__INITDATA: .byte 16 .byte 48 .byte 48 .byte 48 .byte 80 .byte 236 __Start: ldy #6 : lda Title2__INITDATA-1,y sta BGColor_bgcolor_b0-1,y dey bne :- ;;; start action FrameLoop 1 start FrameLoop__start__20__NextFrame: FRAME_START ;;; start action StaticKernel 3 preframe ;;; start action Kernel48Pixel 2 kernelsetup ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action Kernel48Pixel 2 kernelsetup ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action StaticKernel 3 kernelsetup lda BGColor_bgcolor_b0 sta COLUBK ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 preframe KERNEL_START ;;; start action StaticKernel 3 kernel ldx #0 StaticKernel__kernel__27____each: sta WSYNC ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__28____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__28____skipxlo lda #43 sta Kernel48Pixel__2__tmp+0 ; scanline counter lda #$22 sta COLUP0 ; show how players alternate lda #$12 sta COLUP1 ; by having different colors lda #3 sta NUSIZ0 sta NUSIZ1 ; both players have 3 copies sta WSYNC SLEEPH 35 sta RESP0 ; position 1st player sta RESP1 ; ...and 2nd player lda #$10 sta HMP1 ; 1 pixel to the left sta WSYNC sta HMOVE ; apply HMOVE lda #1 sta VDELP0 ; we need the VDEL registers sta VDELP1 ; so we can do our 4-store trick SLEEPH 24-8 ; sleep 24 cycles sta HMCLR ; clear HMOVE registers Kernel48Pixel__kernelsetup__28____skipxlo: Kernel48Pixel__kernelsetup__28____skipxhi: ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__29____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__29____skipxlo lda PFColor_pfcolor_b0 sta COLUP0 sta COLUP1 Kernel48Pixel__kernelsetup__29____skipxlo: Kernel48Pixel__kernelsetup__29____skipxhi: ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action StaticKernel 3 kernelsetup lda BGColor_bgcolor_b0,x sta COLUBK ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup cpx #2+1 jcs StaticKernel__kernelsetup__31____skipxhi cpx #2 jcc StaticKernel__kernelsetup__31____skipxlo lda PFColor_pfcolor_b0 sta COLUPF StaticKernel__kernelsetup__31____skipxlo: StaticKernel__kernelsetup__31____skipxhi: ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup ;;; start action Kernel48Pixel 2 kerneldraw cpx #2+1 jcs Kernel48Pixel__kerneldraw__33____skipxhi cpx #2 jcc Kernel48Pixel__kerneldraw__33____skipxlo txa pha Kernel48Pixel__kerneldraw__33__Loop: ldy Kernel48Pixel__2__tmp+0 ; counts backwards sta WSYNC ; sync to next scanline lda Bitmap48_bitmap0_e2_b0,y ; load B0 (1st sprite byte) sta GRP0 ; B0 -> [GRP0] lda Bitmap48_bitmap1_e2_b0,y ; load B1 -> A sta GRP1 ; B1 -> [GRP1], B0 -> GRP0 lda Bitmap48_bitmap2_e2_b0,y ; load B2 -> A sta GRP0 ; B2 -> [GRP0], B1 -> GRP1 lda Bitmap48_bitmap5_e2_b0,y ; load B5 -> A sta Kernel48Pixel__2__tmp+1 ; B5 -> temp ldx Bitmap48_bitmap4_e2_b0,y ; load B4 -> X lda Bitmap48_bitmap3_e2_b0,y ; load B3 -> A ldy Kernel48Pixel__2__tmp+1 ; load B5 -> Y sta GRP1 ; B3 -> [GRP1]; B2 -> GRP0 stx GRP0 ; B4 -> [GRP0]; B3 -> GRP1 sty GRP1 ; B5 -> [GRP1]; B4 -> GRP0 sta GRP0 ; ?? -> [GRP0]; B5 -> GRP1 dec Kernel48Pixel__2__tmp+0 ; go to next line bpl Kernel48Pixel__kerneldraw__33__Loop ; repeat until < 0 pla tax Kernel48Pixel__kerneldraw__33____skipxlo: Kernel48Pixel__kerneldraw__33____skipxhi: ;;; end action Kernel48Pixel 2 kerneldraw ;;; start action StaticKernel 3 kerneldraw ldy KernelSection_lines_b0,x StaticKernel__kerneldraw__34__loop: sta WSYNC dey bne StaticKernel__kerneldraw__34__loop ;;; end action StaticKernel 3 kerneldraw inx cpx #5 jne StaticKernel__kernel__27____each StaticKernel__kernel__27____exit: ;;; end action StaticKernel 3 kernel KERNEL_END ;;; start action Colors 4 postframe inc PFColor_pfcolor_b0 bne :+ inc BGColor_bgcolor_b0+2 inc BGColor_bgcolor_b0+2 : ;;; end action Colors 4 postframe FRAME_END jmp FrameLoop__start__20__NextFrame ; loop to next frame ;;; end action FrameLoop 1 start .endscope Title2__Start = Title2::__Start .endscope TitleDemo__Start = TitleDemo::__Start