mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +00:00
260 lines
7.6 KiB
Plaintext
260 lines
7.6 KiB
Plaintext
|
|
//#resource "vcs-ca65.h"
|
|
|
|
import "vcslib.ecs"
|
|
|
|
component Bitmap48
|
|
bitmap0: array of 0..0xff
|
|
bitmap1: array of 0..0xff
|
|
bitmap2: array of 0..0xff
|
|
bitmap3: array of 0..0xff
|
|
bitmap4: array of 0..0xff
|
|
bitmap5: array of 0..0xff
|
|
height: 0..255
|
|
end
|
|
|
|
system Kernel48Pixel
|
|
locals 2
|
|
on kernelsetup do if [Bitmap48] ---
|
|
lda {{<height}}
|
|
sta {{$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
|
|
---
|
|
on kernelsetup do if [PFColor] ---
|
|
lda {{<pfcolor}}
|
|
sta COLUP0
|
|
sta COLUP1
|
|
---
|
|
on kerneldraw do if [Bitmap48] critical fit 63
|
|
---
|
|
txa
|
|
pha
|
|
@Loop:
|
|
ldy {{$0}} ; counts backwards
|
|
sta WSYNC ; sync to next scanline
|
|
lda {{data bitmap0}},y ; load B0 (1st sprite byte)
|
|
sta GRP0 ; B0 -> [GRP0]
|
|
lda {{data bitmap1}},y ; load B1 -> A
|
|
sta GRP1 ; B1 -> [GRP1], B0 -> GRP0
|
|
lda {{data bitmap2}},y ; load B2 -> A
|
|
sta GRP0 ; B2 -> [GRP0], B1 -> GRP1
|
|
lda {{data bitmap5}},y ; load B5 -> A
|
|
sta {{$1}} ; B5 -> temp
|
|
ldx {{data bitmap4}},y ; load B4 -> X
|
|
lda {{data bitmap3}},y ; load B3 -> A
|
|
ldy {{$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 {{$0}} ; go to next line
|
|
bpl @Loop ; repeat until < 0
|
|
pla
|
|
tax
|
|
---
|
|
end
|
|
|
|
demo TitleDemo
|
|
|
|
scope Title
|
|
|
|
using FrameLoop, Kernel48Pixel, StaticKernel
|
|
using JoyButton
|
|
|
|
entity [Player]
|
|
end
|
|
|
|
system Advance
|
|
on joybutton do once
|
|
---
|
|
jmp Title2__Start
|
|
---
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 60
|
|
const bgcolor = $a0
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
const bgcolor = $a2
|
|
end
|
|
|
|
// convert -size 48x -gravity center label:"6502\nECS" pbm: | pnmtopnm -plain
|
|
entity [KernelSection, BGColor, PFColor, Bitmap48]
|
|
const lines = 2
|
|
const bgcolor = 0xa4
|
|
const pfcolor = 0xfc
|
|
decode vcs_bitmap48 ---
|
|
000000111100000111111110000011110000001111100000
|
|
000011111110000111111110001111111000011111110000
|
|
000011000011000110000000001100011000111000011000
|
|
000110000011000110000000011000001100110000011000
|
|
000110000000000110000000011000001100000000011000
|
|
000110111100000111111000011000001100000000011000
|
|
000111111110000111111100011000001100000000110000
|
|
000111000111000000001110011000001100000001110000
|
|
000110000011000000000110011000001100000011100000
|
|
000110000011000000000110011000001100000111000000
|
|
000110000011000000000110011000001100001110000000
|
|
000110000011001100000110011000001100011100000000
|
|
000011000011001100001110001100011000111000000000
|
|
000011111110000111111100001111111000111111111000
|
|
000000111100000011111000000111110000111111111000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000111111111100000011111000000001111100000000
|
|
000000111111111100001111111110000111111111000000
|
|
000000110000000000011100000111000110000011100000
|
|
000000110000000000011000000011001100000001100000
|
|
000000110000000000111000000001001100000000000000
|
|
000000110000000000110000000000000111000000000000
|
|
000000111111111000110000000000000011111000000000
|
|
000000111111111000110000000000000001111111000000
|
|
000000110000000000110000000000000000000111100000
|
|
000000110000000000110000000000000000000001100000
|
|
000000110000000000111000000011101100000001100000
|
|
000000110000000000011000000011001100000001100000
|
|
000000110000000000011100000111000110000011100000
|
|
000000111111111100001111111110000111111111000000
|
|
000000111111111100000011111000000001111110000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
|
|
---
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
const bgcolor = $a2
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
const bgcolor = $a0
|
|
end
|
|
|
|
end
|
|
|
|
scope Title2
|
|
|
|
using FrameLoop, Kernel48Pixel, StaticKernel
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 60
|
|
var bgcolor = 0x10
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
var bgcolor = 0x30
|
|
end
|
|
|
|
// convert -size 48x -gravity center label:"6502\nECS" pbm: | pnmtopnm -plain
|
|
entity [KernelSection, BGColor, PFColor, Bitmap48]
|
|
const lines = 2
|
|
var pfcolor = 0xec
|
|
var bgcolor = 0x30
|
|
decode vcs_bitmap48 ---
|
|
000000000000000000000000000000000000000000011000
|
|
000000000000000000000000000000000000000000011000
|
|
000000000000000000000000000000000000000000011000
|
|
000000000000000000000000000000000000000000011000
|
|
000001111011000011111000000111110000001111011000
|
|
000011111111000111111100001111111000011111111000
|
|
000110000111001100001110011000001100110000111000
|
|
000110000011001100000110011000001100110000011000
|
|
000110000011001100000110011000001100110000011000
|
|
000110000011001100000110011000001100110000011000
|
|
000110000011001100000110011000001100110000011000
|
|
000110000011001100000110011000001100110000011000
|
|
000110000111001100000110011000001100110000111000
|
|
000011111111000111111100001111111000011111111000
|
|
000001111011000011111000000111110000001111011000
|
|
000000000011000000000000000000000000000000000000
|
|
000110000110000000000000000000000000000000000000
|
|
000111111110000000000000000000000000000000000000
|
|
000001111100000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
000000000110000000000000110000000000110000000000
|
|
000000000110000000000000110000000000110000000000
|
|
000000000000000000000000110000000000110000000000
|
|
000000000000000000000000110000000000110000000000
|
|
000000000110000111110000110111100000110000000000
|
|
000000000110001111111000111111110000110000000000
|
|
000000000110011100001100111000011000110000000000
|
|
000000000110011000001100110000011000110000000000
|
|
000000000110011000001100110000011000110000000000
|
|
000000000110011000001100110000011000110000000000
|
|
000000000110011000001100110000011000110000000000
|
|
000000000110011000001100110000011000000000000000
|
|
000000000110011000001100111000011000000000000000
|
|
000000000110001111111000111100110000110000000000
|
|
000000000110000111110000110111100000110000000000
|
|
000000000110000000000000000000000000000000000000
|
|
000000000110000000000000000000000000000000000000
|
|
000000011110000000000000000000000000000000000000
|
|
000000011100000000000000000000000000000000000000
|
|
000000000000000000000000000000000000000000000000
|
|
---
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
var bgcolor = 0x30
|
|
end
|
|
|
|
entity [KernelSection, BGColor]
|
|
const lines = 10
|
|
var bgcolor = 0x50
|
|
end
|
|
|
|
system Colors
|
|
on postframe do foreach [PFColor]
|
|
---
|
|
inc {{set pfcolor}}
|
|
bne :+
|
|
inc {{set bgcolor}}
|
|
inc {{set bgcolor}}
|
|
:
|
|
---
|
|
end
|
|
|
|
end
|
|
|
|
system Demo
|
|
on start do once
|
|
---
|
|
jmp Title__Start
|
|
---
|
|
end
|
|
|
|
end
|