1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-26 10:49:17 +00:00
8bitworkshop/test/ecs/titles.ecs

306 lines
9.3 KiB
Plaintext
Raw Normal View History

//#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
2022-02-28 01:46:26 +00:00
---
// TODO: should factor out this code, but doesnt
on kernelsetup do if [Bitmap48] ---
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
2022-02-19 22:19:16 +00:00
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
2022-02-19 22:19:16 +00:00
SLEEPH 24-8 ; sleep 24 cycles
sta HMCLR ; clear HMOVE registers
---
on kernelsetup do if [PFColor] ---
lda {{<pfcolor}}
sta COLUP0
sta COLUP1
---
2022-02-28 01:46:26 +00:00
on kerneldraw do critical fit 63
if [Bitmap48]
2022-02-19 22:19:16 +00:00
---
txa
pha
2022-02-28 01:46:26 +00:00
:
ldy {{$0}} ; counts backwards
2022-02-28 01:46:26 +00:00
{{!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
2022-02-28 01:46:26 +00:00
bpl :- ; repeat until < 0
pla
tax
---
end
2022-02-19 22:19:16 +00:00
demo TitleDemo
scope Title
2022-02-28 01:46:26 +00:00
using FrameLoop, StandardKernel
using Kernel48Pixel with [#Name]
using Kernel48Pixel with [#Copyright]
2022-02-19 22:19:16 +00:00
using JoyButton
2022-02-19 22:19:16 +00:00
entity [Player]
end
system Advance
on joybutton do once
---
jmp Title2__Start
---
end
entity [KernelSection, BGColor]
2022-02-28 01:46:26 +00:00
const lines = 30
const bgcolor = $a0
end
entity [KernelSection, BGColor]
const lines = 10
const bgcolor = $a2
end
2022-02-19 22:19:16 +00:00
// convert -size 48x -gravity center label:"6502\nECS" pbm: | pnmtopnm -plain
2022-02-28 01:46:26 +00:00
entity Name [KernelSection, BGColor, PFColor, Bitmap48]
const lines = 2
const bgcolor = 0xa4
const pfcolor = 0xfc
decode vcs_bitmap48 ---
2022-02-19 22:19:16 +00:00
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
2022-02-28 01:46:26 +00:00
entity Copyright [KernelSection, BGColor, PFColor, Bitmap48]
const lines = 2
const bgcolor = 0xa4
const pfcolor = 0x8c
decode vcs_bitmap48 ---
000000000000000000000000000000100000000100000100
000000000000000000000000000000000000000100000100
000111000111001111010001101110100011010111101110
001001001001001101111001001100100100110110100100
001001001000101000101001001000100100110100010100
011000011000101000101001001000101100010100010100
011000011000101000101010001000101100010100010100
011001001000101000100110001000100100110100010100
001001001001001001000110001000100100110100010110
000110000111001111000110001000100011110100010000
000000000000001000000100000000000000010000000000
000000000000001000000100000000000100100000000000
000000000000001000001000000000000111100000000000
000000000000000000000000000000000000000000000000
000000000000001110001110001110001110000000000000
000000000000010011011010010011010011000000000000
000000000000010001010011010011010001000000000000
000000000000000001110001000001000001000000000000
000000000000000011110001000011000011000000000000
000000000000000110110001000110000110000000000000
000000000000001100110001001100001000000000000000
000000000000010000010001010000010000000000000000
000000000000010000010010010000010000000000000000
000000000000111111001110111111111111000000000000
000000000000000000000000000000000000000000000000
---
end
entity [KernelSection, BGColor]
const lines = 10
const bgcolor = $a2
end
entity [KernelSection, BGColor]
const lines = 10
const bgcolor = $a0
end
2022-02-19 22:19:16 +00:00
end
scope Title2
2022-02-28 01:46:26 +00:00
using FrameLoop, Kernel48Pixel, StandardKernel
2022-02-19 22:19:16 +00:00
entity [KernelSection, BGColor]
2022-02-28 01:46:26 +00:00
var lines = 60
var bgcolor = 0x10
2022-02-19 22:19:16 +00:00
end
entity [KernelSection, BGColor]
2022-02-28 01:46:26 +00:00
var lines = 30
var bgcolor = 0x30
2022-02-19 22:19:16 +00:00
end
// convert -size 48x -gravity center label:"6502\nECS" pbm: | pnmtopnm -plain
entity [KernelSection, BGColor, PFColor, Bitmap48]
2022-02-28 01:46:26 +00:00
var lines = 2
var pfcolor = 0xec
var bgcolor = 0x30
2022-02-19 22:19:16 +00:00
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]
2022-02-28 01:46:26 +00:00
var lines = 20
var bgcolor = 0x30
2022-02-19 22:19:16 +00:00
end
entity [KernelSection, BGColor]
2022-02-28 01:46:26 +00:00
var lines = 20
var bgcolor = 0x50
2022-02-19 22:19:16 +00:00
end
system Colors
on postframe do foreach [PFColor]
---
inc {{set pfcolor}}
bne :+
inc {{set bgcolor}}
2022-02-28 01:46:26 +00:00
:
---
on postframe do foreach [KernelSection]
---
dec {{set lines}}
bne :+
lda #1
sta {{set lines}}
:
---
end
2022-02-19 22:19:16 +00:00
end
system Demo
on start do once
---
2022-02-28 01:46:26 +00:00
{{start Title}}
2022-02-19 22:19:16 +00:00
---
end
2022-02-24 19:30:10 +00:00
end demo