~rabbits/dotgrid

2a44cce1a0574950a37054a88f2cb1de65041d9d — Devine Lu Linvega 10 months ago 2e24f39
Use accessors
1 files changed, 48 insertions(+), 30 deletions(-)

M src/dotgrid.tal
M src/dotgrid.tal => src/dotgrid.tal +48 -30
@@ 5,15 5,15 @@
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2

|0 @Shapes &nil $1 &color $1 &patt $1 &line $1
|0 @Shapes &nil $1 &color $1 &patt $1 &line $1 &rect $1

|0000

|0100

	#ca0f .System/r DEO2
	#ca0f .System/g DEO2
	#ca0f .System/b DEO2
	#fc0f .System/r DEO2
	#a80f .System/g DEO2
	#a80f .System/b DEO2

	;on-mouse .Mouse/vector DEO2



@@ 35,47 35,61 @@ BRK
@|shapes )

@shape-null ( shape* -- next* )

	INC2
JMP2r

@shape-color ( memory* -- next* )

	INC2 LDAk #05 MUL ;draw-point/color STA
	INC2

JMP2r

@shape-patt ( memory* -- next* )

	INC2k .Screen/addr DEO2
	#0009 ADD2

JMP2r

@shape-line ( memory* -- next* )
	INC2k get-x1 get-y1 get-x2 get-y2 POP2
		draw-line
	( handle )
	INC2k get-x1 get-y1 POP2
		draw-handle
	INC2k get-x2 get-y2 POP2
		draw-handle
	( next shape ) #0009 ADD2
JMP2r

	INC2k STH2
	( x1,y1 )
		LDA2kr STH2r INC2r INC2r
		LDA2kr STH2r INC2r INC2r
	( x2,y2 )
		LDA2kr STH2r INC2r INC2r
		LDA2r STH2r
	draw-line

	INC2k STH2
	( x1,y1 )
		LDA2kr STH2r INC2r INC2r
		LDA2kr STH2r INC2r INC2r
	draw-handle
	( x2,y2 )
		LDA2kr STH2r INC2r INC2r
		LDA2r STH2r
	draw-handle

@shape-rect ( memory* -- next* )
	INC2k get-x1 get-y1 get-x2 get-y1 POP2
		draw-line
	INC2k get-x2 get-y1 get-x2 get-y2 POP2
		draw-line
	INC2k get-x2 get-y2 get-x1 get-y2 POP2
		draw-line
	INC2k get-x1 get-y2 get-x1 get-y1 POP2
		draw-line
	( handle )
	INC2k get-x1 get-y1 POP2
		draw-handle
	INC2k get-x2 get-y2 POP2
		draw-handle
	( next shape ) #0009 ADD2
JMP2r

@get-x1 ( mem* -- x1* mem* )
	LDA2k SWP2
JMP2r

@get-y1 ( mem* -- x1* mem* )
	INC2k INC2 LDA2 SWP2
JMP2r

@get-x2 ( mem* -- x1* mem* )
	INC2k #0003 ADD2 LDA2 SWP2
JMP2r

@get-y2 ( mem* -- x1* mem* )
	INC2k #0005 ADD2 LDA2 SWP2
JMP2r

(


@@ 199,6 213,7 @@ JMP2r
	=shape-color
	=shape-patt
	=shape-line
	=shape-rect

@cursor-icn
	[ 80c0 e0f0 f8e0 1000 ]


@@ 211,7 226,7 @@ JMP2r
@|memory )

@picture
	-Shapes/color [ 03 ]
	-Shapes/color [ 02 ]
	-Shapes/patt [ 3c7e ffff ffff 7e3c ]
	-Shapes/line [ 0020 0030 0074 00a1 ]
	-Shapes/patt [ 0000 0010 0100 0000 ]


@@ 219,7 234,10 @@ JMP2r
	-Shapes/color [ 02 ]
	-Shapes/patt [ 0000 0018 1800 0000 ]
	-Shapes/line [ 0023 0093 0088 0058 ]
	-Shapes/color [ 01 ]
	-Shapes/color [ 02 ]
	-Shapes/line [ 0042 003f 0142 0124 ]
	-Shapes/color [ 02 ]
	-Shapes/patt [ 0000 0018 1800 0000 ]
	-Shapes/rect [ 0042 003f 0142 0124 ]
	$1