.scope Main .zeropage TEMP: Kernel48Pixel__2__tmp: .res 1 .res 1 .code KernelSection_lines_b0: .byte 10 .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_e2_b0 Bitmap48_bitmap0_e2_b0: .byte 0 .byte 240 .byte 207 .byte 192 .byte 196 .byte 196 .byte 199 .byte 196 .byte 196 .byte 196 .byte 192 .byte 207 .byte 240 .byte 192 .byte 128 Bitmap48_bitmap1_b0: .byte Bitmap48_bitmap1_e2_b0 Bitmap48_bitmap1_e2_b0: .byte 0 .byte 0 .byte 0 .byte 192 .byte 32 .byte 144 .byte 136 .byte 144 .byte 32 .byte 32 .byte 192 .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 1 .byte 2 .byte 33 .byte 226 .byte 129 .byte 2 .byte 1 .byte 0 .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 128 .byte 64 .byte 136 .byte 78 .byte 130 .byte 64 .byte 128 .byte 0 .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 3 .byte 4 .byte 24 .byte 32 .byte 64 .byte 32 .byte 24 .byte 4 .byte 4 .byte 3 .byte 0 .byte 0 .byte 0 Bitmap48_bitmap5_b0: .byte Bitmap48_bitmap5_e2_b0 Bitmap48_bitmap5_e2_b0: .byte 0 .byte 255 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 1 .byte 225 .byte 29 .byte 3 Bitmap48_height_b0: .byte 14 __Start: .code ;;; start action Init 4 main_init .include "vcs-ca65.h" .macpack longbranch .define PAL 0 __NMI: __Reset: __BRK: CLEAN_START ; initialize data segment .code ;;; start action FrameLoop 1 start FrameLoop__start__2__NextFrame: FRAME_START .code ;;; start action StaticKernel 3 preframe .code ;;; 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 .code ;;; start action StaticKernel 3 kernel ldx #0 StaticKernel__kernel__9____each: sta WSYNC .code ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__10____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__10____skipxlo lda #14 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 34 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 SLEEPH 24 ; sleep 24 cycles sta HMCLR ; clear HMOVE registers lda #1 sta VDELP0 ; we need the VDEL registers sta VDELP1 ; so we can do our 4-store trick Kernel48Pixel__kernelsetup__10____skipxlo: Kernel48Pixel__kernelsetup__10____skipxhi: ;;; end action Kernel48Pixel 2 kernelsetup ;;; start action Kernel48Pixel 2 kernelsetup cpx #2+1 jcs Kernel48Pixel__kernelsetup__11____skipxhi cpx #2 jcc Kernel48Pixel__kernelsetup__11____skipxlo lda #252 sta COLUP0 sta COLUP1 Kernel48Pixel__kernelsetup__11____skipxlo: Kernel48Pixel__kernelsetup__11____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__13____skipxhi cpx #2 jcc StaticKernel__kernelsetup__13____skipxlo lda #252 sta COLUPF StaticKernel__kernelsetup__13____skipxlo: StaticKernel__kernelsetup__13____skipxhi: ;;; end action StaticKernel 3 kernelsetup ;;; start action StaticKernel 3 kernelsetup ;;; end action StaticKernel 3 kernelsetup .code ;;; start action Kernel48Pixel 2 kerneldraw cpx #2+1 jcs Kernel48Pixel__kerneldraw__15____skipxhi cpx #2 jcc Kernel48Pixel__kerneldraw__15____skipxlo txa pha Kernel48Pixel__kerneldraw__15__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__15__Loop ; repeat until < 0 pla tax Kernel48Pixel__kerneldraw__15____skipxlo: Kernel48Pixel__kerneldraw__15____skipxhi: ;;; end action Kernel48Pixel 2 kerneldraw ;;; start action StaticKernel 3 kerneldraw ldy KernelSection_lines_b0,x StaticKernel__kerneldraw__16__loop: sta WSYNC dey bne StaticKernel__kerneldraw__16__loop ;;; end action StaticKernel 3 kerneldraw inx cpx #5 jne StaticKernel__kernel__9____each StaticKernel__kernel__9____exit: ;;; end action StaticKernel 3 kernel KERNEL_END .code FRAME_END .code jmp FrameLoop__start__2__NextFrame ; loop to next frame ;;; end action FrameLoop 1 start ; start main routine .segment "VECTORS" Return: .word $6060 VecNMI: VecReset: .word Main::__Reset VecBRK: .word Main::__BRK ;;; end action Init 4 main_init .endscope Main__Start = Main::__Start