ecs: accept 0/1 for bitmaps

This commit is contained in:
Steven Hugg 2022-02-19 16:19:16 -06:00
parent 479c2f24b8
commit d96296675b
4 changed files with 990 additions and 195 deletions

View File

@ -22,9 +22,10 @@ abstract class LineDecoder {
let b = 0;
for (let i=0; i<n; i++) {
let bit;
if (s.charAt(i) == 'x') bit = 1;
else if (s.charAt(i) == '.') bit = 0;
else throw new ECSError('need x or .');
let ch = s.charAt(i);
if (ch == 'x' || ch == 'X' || ch == '1') bit = 1;
else if (ch == '.' || ch == '0') bit = 0;
else throw new ECSError('need x or . (or 0 or 1)');
if (bit) {
if (msbfirst) b |= 1 << (n-1-i);
else b |= 1 << i;

View File

@ -323,7 +323,7 @@ export class Dialect_CA65 {
}
warningIfMoreThan(bytes: number, startlabel: string) {
return `
.assert (* - ${startlabel}) <= ${bytes}, error, "${startlabel} does not fit in ${bytes} bytes!"`
.assert (* - ${startlabel}) <= ${bytes}, error, .sprintf("${startlabel} does not fit in ${bytes} bytes, it took %d!", (* - ${startlabel}))`
}
alignIfLessThan(bytes: number) {
return `

View File

@ -26,31 +26,26 @@ system Kernel48Pixel
sta NUSIZ0
sta NUSIZ1 ; both players have 3 copies
sta WSYNC
SLEEPH 34
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
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
SLEEPH 24-8 ; sleep 24 cycles
sta HMCLR ; clear HMOVE registers
---
/* already exists on StaticKernel
on kernelsetup do if [BGColor] ---
lda {{<bgcolor}}
sta COLUBK
---
*/
on kernelsetup do if [PFColor] ---
lda {{<pfcolor}}
sta COLUP0
sta COLUP1
---
on kerneldraw do if [Bitmap48] ---
on kerneldraw do if [Bitmap48] critical fit 63
---
txa
pha
@Loop:
@ -78,15 +73,26 @@ system Kernel48Pixel
---
end
demo Main
demo TitleDemo
scope Title
//using FrameLoop, StaticKernel, Kernel48Pixel
using FrameLoop, Kernel48Pixel, StaticKernel
using JoyButton
// TODO
entity [Player]
end
system Advance
on joybutton do once
---
FRAME_END
jmp Title2__Start
---
end
entity [KernelSection, BGColor]
const lines = 10
const lines = 60
const bgcolor = $a0
end
@ -95,26 +101,50 @@ demo Main
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 ---
x.............................................xx
xx.........................................xxx.x
xxxx....................................xxx....x
xx..xxxx..............................xx.......x
xx......xx...........................x.........x
xx...x....x............xx............x.........x
xx...x....x...........x..x.........xx..........x
xx...x..x..x....x......xx.....x...x............x
xx...xxxx...x...xxx...x..x..xxx..x.............x
xx...x..x..x......x....xx...x.....x............x
xx...x....x...........x..x.........xx..........x
xx......xx.............xx............x.........x
xx..xxxx..............................xx.......x
xxxx....................................xxxxxxxx
................................................
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
@ -128,4 +158,92 @@ xxxx....................................xxxxxxxx
const bgcolor = $a0
end
end
scope Title2
using FrameLoop, Kernel48Pixel, StaticKernel
entity [KernelSection, BGColor]
const lines = 60
const bgcolor = $50
end
entity [KernelSection, BGColor]
const lines = 10
const bgcolor = $52
end
// convert -size 48x -gravity center label:"6502\nECS" pbm: | pnmtopnm -plain
entity [KernelSection, BGColor, PFColor, Bitmap48]
const lines = 2
const bgcolor = 0x54
const pfcolor = 0xec
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
const bgcolor = $52
end
entity [KernelSection, BGColor]
const lines = 10
const bgcolor = $50
end
end
system Demo
on start do once
---
jmp Title__Start
---
end
end

File diff suppressed because it is too large Load Diff