This commit is contained in:
Brooke Vibber 2022-12-07 16:12:15 -08:00
parent 8fe6ef06c0
commit c29955ac83
10 changed files with 10 additions and 9 deletions

View file

@ -1,4 +1,4 @@
all : sample0.xex sample1.xex sample2.xex sample3.xex sample4.xex sample5.xex sample6.xex all : sample0.xex sample1.xex sample2.xex sample3.xex sample4.xex sample5.xex sample6.xex fruit.xex mapclock.xex sailboat.xex sunset.xex train404.xex
# sample5.s from sample5.jpg # sample5.s from sample5.jpg
@ -29,6 +29,7 @@ clean :
rm -f sample[0-6].s.[0-9].png rm -f sample[0-6].s.[0-9].png
rm -f sample[0-6].s.palette.png rm -f sample[0-6].s.palette.png
rm -f sample[0-6].s.gif rm -f sample[0-6].s.gif
rm -f *.xex
rm -f chickens.s rm -f chickens.s
rm -f chickens.o rm -f chickens.o

View file

@ -740,7 +740,7 @@ async function main() {
} }
let nbits = 2; let nbits = 2;
let reps = 4; let reps = 2;
let {width, height, lines} = await convert(process.argv[2], nbits, reps); let {width, height, lines} = await convert(process.argv[2], nbits, reps);

BIN
fruit.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 KiB

2
gif.sh
View file

@ -1,4 +1,4 @@
fps=30000/1001 fps=60000/1001
ffmpeg \ ffmpeg \
-r $fps -i "$1.%01d.png" \ -r $fps -i "$1.%01d.png" \

BIN
mapclock.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

2
mp4.sh
View file

@ -1,4 +1,4 @@
fps=30000/1001 fps=60000/1001
ffmpeg \ ffmpeg \
-r $fps -i "$1.%01d.png" \ -r $fps -i "$1.%01d.png" \

View file

@ -24,19 +24,21 @@ function to4bit(val8) {
function pack(audio) { function pack(audio) {
let packed = []; let packed = [];
/*
for (let i = 0; i < audio.length; i += 2) { for (let i = 0; i < audio.length; i += 2) {
// little-endian 4-bit samples
let low = to4bit(audio[i]); let low = to4bit(audio[i]);
let high = to4bit(audio[i + 1]); let high = to4bit(audio[i + 1]);
let byte = low | (high << 4); let byte = low | (high << 4);
packed.push(byte); packed.push(byte);
} }
*/ /*
// raw push bytes
for (let i = 0; i < audio.length; i += 2) { for (let i = 0; i < audio.length; i += 2) {
let val = to4bit(audio[i]); let val = to4bit(audio[i]);
let byte = val | 0x10; let byte = val | 0x10;
packed.push(byte); packed.push(byte);
} }
*/
return packed; return packed;
} }
@ -62,8 +64,6 @@ let infile = process.argv[2];
let outfile = process.argv[3]; let outfile = process.argv[3];
let buffer = readFileSync(infile); let buffer = readFileSync(infile);
// @FIXME fix
buffer = buffer.slice(0, 262);
let asm = wav2assembly(buffer); let asm = wav2assembly(buffer);
writeFileSync(outfile, asm, 'utf-8'); writeFileSync(outfile, asm, 'utf-8');

BIN
sailboat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

BIN
sunset.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 KiB

BIN
train404.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB