Compare commits
No commits in common. "bbcf9111fc0c15214ad4dceb4037c4cc44e85b32" and "ed717cd95de6d3b36639cc80577601a836059947" have entirely different histories.
bbcf9111fc
...
ed717cd95d
7 changed files with 30 additions and 195 deletions
BIN
footer.1line
BIN
footer.1line
Binary file not shown.
BIN
footer.pbm
BIN
footer.pbm
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
|||
P4
|
||||
8 8
|
||||
鉗鉗鉗鉗
|
||||
BIN
one_line.txt
BIN
one_line.txt
Binary file not shown.
|
|
@ -1,9 +1,9 @@
|
|||
|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
|
||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
||||
|80 @Controller/vector $2 &button $1 &key $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
|
||||
|
||||
|
||||
|
||||
|58 @canvas-width
|
||||
|1f @canvas-height
|
||||
|
|
@ -33,13 +33,6 @@
|
|||
( set pxs-pt to start of pixels )
|
||||
;pxs ;pxs-pt STA2
|
||||
;on-mouse .Mouse/vector DEO2
|
||||
;on-controller .Controller/vector DEO2
|
||||
BRK
|
||||
|
||||
@on-controller
|
||||
.Controller/key DEI
|
||||
( if "e" key is pressed )
|
||||
#65 EQU ?write-drawing-file-to-disk
|
||||
BRK
|
||||
|
||||
@add-px-to-drawing
|
||||
|
|
@ -86,13 +79,6 @@
|
|||
&end
|
||||
JMP2r
|
||||
|
||||
@write-drawing-file-to-disk
|
||||
;/filename .File/name DEO2
|
||||
#1550 .File/length DEO2
|
||||
;pxs .File/write DEO2
|
||||
JMP2r
|
||||
&filename "footer.1line $1
|
||||
|
||||
@on-mouse ( -> )
|
||||
.Mouse/x DEI2 .x STZ2
|
||||
.Mouse/y DEI2 .y STZ2
|
||||
|
|
|
|||
141
one_line_gen.tal
141
one_line_gen.tal
|
|
@ -1,141 +0,0 @@
|
|||
|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
|
||||
|
||||
%dbug { #01 .System/debug DEO }
|
||||
|
||||
(
|
||||
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
|
||||
hexdump -C footer.pbm
|
||||
)
|
||||
|
||||
|1550 @drawing-size
|
||||
|15f @image-size ( header 9 + data 341 = 350 )
|
||||
|
||||
|0100
|
||||
@on-reset
|
||||
( set img-pt to start of img )
|
||||
;img ;img-pt STA2
|
||||
( file header )
|
||||
LIT "P write-to-image
|
||||
LIT "4 write-to-image
|
||||
#0a write-to-image
|
||||
LIT "8 write-to-image
|
||||
LIT "8 write-to-image
|
||||
#20 write-to-image
|
||||
LIT "3 write-to-image
|
||||
LIT "1 write-to-image
|
||||
#0a write-to-image
|
||||
( image data )
|
||||
load-drawing
|
||||
#1f ;/y STA
|
||||
&y-loop
|
||||
#58 ;/x STA
|
||||
#01 ;/i STA
|
||||
&row-loop
|
||||
;/x LDA #07 ADD ;/y LDA get-pixel
|
||||
;/x LDA #06 ADD ;/y LDA get-pixel
|
||||
;/x LDA #05 ADD ;/y LDA get-pixel
|
||||
;/x LDA #04 ADD ;/y LDA get-pixel
|
||||
;/x LDA #03 ADD ;/y LDA get-pixel
|
||||
;/x LDA #02 ADD ;/y LDA get-pixel
|
||||
;/x LDA #01 ADD ;/y LDA get-pixel
|
||||
;/x LDA ;/y LDA get-pixel
|
||||
build-byte
|
||||
write-to-image
|
||||
;/x LDA #08 ADD ;/x STA
|
||||
;/i LDA INC ;/i STA
|
||||
;/i LDA #0c NEQ ?/row-loop ( run 11 times )
|
||||
;/y LDA #01 ADD ;/y STA
|
||||
;/y LDA #3e
|
||||
NEQ ?/y-loop ( run 31 times )
|
||||
save-file
|
||||
BRK
|
||||
&i $1
|
||||
&y $1
|
||||
&x $1
|
||||
|
||||
( take 8 01 / 00 off the stack and create a byte with them )
|
||||
@build-byte ( p p p p p p p p )
|
||||
LITr 00 ( p p p p p p p p | 00 )
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
STHr
|
||||
JMP2r
|
||||
|
||||
( given a pixel x,y figure out if it is part of the drawing )
|
||||
@get-pixel ( x y -> bool )
|
||||
,/y STR ( x )
|
||||
,/x STR ( )
|
||||
;drawing ,/pt STR2
|
||||
&loop
|
||||
( looped through the entire drawing? )
|
||||
,/pt LDR2 ( pt* )
|
||||
;drawing ;drawing-size ADD2 ( pt* end-of-drawing* )
|
||||
EQU2 ?/not-found
|
||||
( check if current x y has already been visited )
|
||||
,/pt LDR2 LDA2 ( x1 y1 )
|
||||
,/x LDR ( x1 y1 x )
|
||||
,/y LDR ( x1 y1 x y )
|
||||
EQU2 ?/found
|
||||
( incrment pointer and save it )
|
||||
,/pt LDR2 ( pt* )
|
||||
#0002 ADD2 ( pt+2* )
|
||||
,/pt STR2
|
||||
!/loop
|
||||
¬-found #01 JMP2r
|
||||
&found #00 JMP2r
|
||||
&pt $2
|
||||
&x $1
|
||||
&y $1
|
||||
|
||||
( load .1line drawing file from disk to memory )
|
||||
@load-drawing
|
||||
;/filename .File/name DEO2
|
||||
;drawing-size .File/length DEO2
|
||||
;drawing .File/read DEO2
|
||||
JMP2r
|
||||
&filename "footer.1line $1
|
||||
|
||||
( write a single byte to the image buffer )
|
||||
@write-to-image ( val )
|
||||
;img-pt LDA2 ( val pt* )
|
||||
STA ( )
|
||||
;img-pt LDA2 ( pt* )
|
||||
#0001 ADD2 ( pt*+1 )
|
||||
;img-pt STA2
|
||||
JMP2r
|
||||
|
||||
( save the image buffer to disk )
|
||||
@save-file
|
||||
;/filename .File/name DEO2
|
||||
;image-size .File/length DEO2
|
||||
;img .File/write DEO2
|
||||
JMP2r
|
||||
&filename "footer.pbm $1
|
||||
|
||||
@img-pt $2
|
||||
@img $image-size
|
||||
@drawing $drawing-size
|
||||
|
|
@ -2,42 +2,35 @@
|
|||
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||
|
||||
|
||||
|
||||
|0100
|
||||
@on-reset
|
||||
#01
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#01
|
||||
build-byte
|
||||
(
|
||||
#0a ( b )
|
||||
#10 SFT ( b )
|
||||
#00 ( b 00 )
|
||||
?{ #01 ORA }
|
||||
)
|
||||
#0aa8
|
||||
#0058
|
||||
NIP
|
||||
( mem-test )
|
||||
BRK
|
||||
|
||||
@build-byte ( p p p p p p p p )
|
||||
LITr 00 ( p p p p p p p p | 00 )
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
LITr 10 SFTr
|
||||
?{ LITr 01 ORAr }
|
||||
STHr
|
||||
JMP2r
|
||||
@mem-test ( a b c -- x)
|
||||
!{
|
||||
&a $1
|
||||
&b $1
|
||||
&c $1
|
||||
}
|
||||
,/a STR
|
||||
,/b STR
|
||||
,/c STR
|
||||
|
||||
,/a LDR
|
||||
,/b LDR
|
||||
ADD
|
||||
,/c LDR
|
||||
ADD ( 06 )
|
||||
|
||||
STH
|
||||
#00 STH
|
||||
SWP2r
|
||||
JMP2r
|
||||
|
||||
|
||||
|
||||
( !{ &a $1 } )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue