init one_line_gen with whole byte sample image

This commit is contained in:
Travis Shears 2025-07-02 20:15:09 +02:00
parent e042895190
commit 6330088ba5
3 changed files with 86 additions and 3 deletions

BIN
one_line.pbm Normal file

Binary file not shown.

View file

@ -5,8 +5,6 @@
|90 @Mouse/vector $2 &x $2 &y $2 &state $5 &scrolly &scrolly-hb $1 &scrolly-lb $1 |90 @Mouse/vector $2 &x $2 &y $2 &state $5 &scrolly &scrolly-hb $1 &scrolly-lb $1
|a0 @File/vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |a0 @File/vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|58 @canvas-width |58 @canvas-width
|1f @canvas-height |1f @canvas-height
@ -93,7 +91,7 @@
#1550 .File/length DEO2 #1550 .File/length DEO2
;pxs .File/write DEO2 ;pxs .File/write DEO2
JMP2r JMP2r
&filename "one_line.txt $1 &filename "one_line.1line $1
@on-mouse ( -> ) @on-mouse ( -> )
.Mouse/x DEI2 .x STZ2 .Mouse/x DEI2 .x STZ2

85
one_line_gen.tal Normal file
View file

@ -0,0 +1,85 @@
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|a0 @File/vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
(
Portable BitMap
https://en.wikipedia.org/wiki/Netpbm#File_formats
P4
# This is an example binary format of the letter "J" with each byte in decimal notation
6 10
8 8 8 8 8 8 136 112 0 0
88x31 pixel image
row of 88px -> 11 bytes 8 bits per byte
31 rows -> 341 bytes
)
|00
@img-pt $2
@img $20
|0100
@on-reset
( set img-pt to start of img )
;img ;img-pt STA2
LIT2 00 "P write-to-image
LIT2 00 "4 write-to-image
#000a write-to-image
#0008 write-to-image
#0008 write-to-image
#0020 write-to-image
#0008 write-to-image
#000a write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
#00e7 write-to-image
save-file
BRK
@write-to-image ( val* )
;img-pt LDA2 ( val* pt* )
STA2 ( )
;img-pt LDA2 ( pt* )
#0002 ADD2 ( pt*+2 )
;img-pt STA2
JMP2r
@save-file
;/filename .File/name DEO2
#0020 .File/length DEO2
;img .File/write DEO2
JMP2r
&filename "one_line.pbm $1
(
@gen-image
( set image-pt to start of image )
;image ;image-pt STA2
LIT2 00 "P write-to-image
LIT2 00 "4 write-to-image
#000a write-to-image
#0008 write-to-image
#0020 write-to-image
#0008 write-to-image
#00ff write-to-image
JMP2r
@image-pt $2
( todo include space for header )
@image $155
( @drawing $1550 ( 5456 ) )
)