get image export working
This commit is contained in:
parent
940f8e235c
commit
529a4a7e65
4 changed files with 111 additions and 37 deletions
BIN
footer.1line
BIN
footer.1line
Binary file not shown.
BIN
footer.pbm
BIN
footer.pbm
Binary file not shown.
|
@ -1,7 +1,8 @@
|
|||
|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 }
|
||||
%print { .Console/write DEO }
|
||||
(
|
||||
Portable BitMap
|
||||
https://en.wikipedia.org/wiki/Netpbm#File_formats
|
||||
|
@ -35,16 +36,82 @@
|
|||
#0a write-to-image
|
||||
( image data )
|
||||
load-drawing
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
#e7 write-to-image
|
||||
( get first 8 pixels )
|
||||
#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
|
||||
|
||||
|
||||
@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
|
||||
|
||||
@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
|
||||
|
||||
( @remove-offset )
|
||||
|
||||
|
||||
@load-drawing
|
||||
;/filename .File/name DEO2
|
||||
|
|
|
@ -2,35 +2,42 @@
|
|||
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||
|
||||
|
||||
|
||||
|0100
|
||||
@on-reset
|
||||
#0aa8
|
||||
#0058
|
||||
NIP
|
||||
( mem-test )
|
||||
#01
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#00
|
||||
#01
|
||||
build-byte
|
||||
(
|
||||
#0a ( b )
|
||||
#10 SFT ( b )
|
||||
#00 ( b 00 )
|
||||
?{ #01 ORA }
|
||||
)
|
||||
BRK
|
||||
|
||||
@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
|
||||
@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
|
||||
|
||||
|
||||
|
||||
( !{ &a $1 } )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue