~rabbits/orca-toy

b25d778974f9ed71f326b98cfee466df160282fe — Devine Lu Linvega 2 months ago 1345ede
Combined helpers
1 files changed, 28 insertions(+), 31 deletions(-)

M src/orca.tal
M src/orca.tal => src/orca.tal +28 -31
@@ 608,13 608,6 @@ JMP2r

( operations )

@b36chr ( b36 -- char ) #24 MOD #00 SWP ;b36clc ADD2 LDA JMP2r
@chrb36 ( char -- b36 ) #20 SUB #00 SWP ;values ADD2 LDA JMP2r
@chrmid ( char -- midi ) DUP ,chrb36 JSR SWP ;ciuc JSR2 #24 MUL ADD #00 SWP ;notes ADD2 LDA JMP2r

@set-cell ( x y c -- ) ROT ROT ,get-cell JSR ;data/cells ADD2 STA JMP2r
@get-cell ( x y -- addr* ) #00 SWP #00 .grid/width LDZ MUL2 ROT #00 SWP ADD2 JMP2r

@get-bang ( -- bang )

	.head/addr LDZ2 ;data/cells ADD2 STH2k


@@ 650,7 643,8 @@ JMP2r
	[ LIT2 &x $2 ] .Screen/x DEO2
	[ LIT2 &y $2 ] .Screen/y DEO2
	( value )
	.dpad LDZ #04 ;draw-byte JSR2
	#04 ;draw-chr/color STA
	.dpad LDZ ;draw-byte JSR2
	( space )
	#00 .Screen/sprite DEO
	( icon )


@@ 667,11 661,11 @@ JMP2r
		SWP2 SUB2 DUP2
		&normal
	( value )
	POP2 #01 ;draw-short JSR2
	#01 ;draw-chr/color STA
	POP2 ;draw-short JSR2
	( icon )
	;selector-icn #00 [ .Controller/vector DEI2 ;on-button-insert EQU2 ] #40 SFT2 ADD2
	#02 .selection/from LDZ2 .selection/to LDZ2 EQU2 ADD
		;draw-sprite JSR2
	;selector-icn #00 [ .Controller/vector DEI2 ;on-button-insert EQU2 ] #40 SFT2 ADD2 .Screen/addr DEO2
	#02 .selection/from LDZ2 .selection/to LDZ2 EQU2 ADD .Screen/sprite DEO

JMP2r



@@ 680,8 674,9 @@ JMP2r
	[ LIT2 &x $2 ] .Screen/x DEO2
	[ LIT2 &y $2 ] .Screen/y DEO2
	( value )
	.timer/frame-lb LDZ 
		DUP #03 .timer/playing LDZ DUP ADD SUB ;draw-byte JSR2
	.timer/frame-lb LDZ
		DUP #03 .timer/playing LDZ DUP ADD SUB ;draw-chr/color STA
		;draw-byte JSR2
	( icon )
	;beat-icn .Screen/addr DEO2
	#03 SWP #07 AND #00 EQU SUB .Screen/sprite DEO


@@ 693,7 688,8 @@ JMP2r
	[ LIT2 &x $2 ] .Screen/x DEO2
	[ LIT2 &y $2 ] .Screen/y DEO2
	( value )
	.timer/speed LDZ #01 ;draw-byte JSR2
	#01 ;draw-chr/color STA
	.timer/speed LDZ ;draw-byte JSR2
	( th )
	;&th #03 ;draw-str-color JSR2



@@ 705,7 701,8 @@ JMP2r
	[ LIT2 &x $2 ] .Screen/x DEO2
	[ LIT2 &y $2 ] .Screen/y DEO2
	( icon )
	;save-icn #01 .state/changed LDZ ADD ;draw-sprite JSR2
	;save-icn .Screen/addr DEO2
	#01 .Screen/sprite DEO

JMP2r



@@ 830,23 827,17 @@ JMP2r

JMP2r

@draw-short ( short* color -- )

	STH SWP STHkr ,draw-byte JSR STHr
@draw-short ( short* -- )

@draw-byte ( byte color -- )
	SWP ,draw-byte JSR

	STH DUP #04 SFT STHkr ,draw-hex JSR STHr
@draw-byte ( byte -- )

@draw-hex ( byte color -- )
	DUP #04 SFT ,draw-hex JSR

	STH #0f AND ;b36chr JSR2
	#20 SUB #00 SWP #40 SFT2 ;font ADD2 STHr
@draw-hex ( byte -- )

@draw-sprite ( addr* color -- )

	STH .Screen/addr DEO2
	STHr .Screen/sprite DEO
	 #0f AND DUP #09 GTH #07 MUL ADD #30 ADD ,draw-chr JSR

JMP2r



@@ 1020,6 1011,15 @@ JMP2r

( helpers )

@b36chr ( b36 -- char ) #24 MOD #00 SWP ;b36clc ADD2 LDA JMP2r
@chrb36 ( char -- b36 ) #20 SUB #00 SWP ;values ADD2 LDA JMP2r
@chrmid ( char -- midi ) DUP ,chrb36 JSR SWP ,ciuc JSR #24 MUL ADD #00 SWP ;notes ADD2 LDA JMP2r
@ciuc ( char -- bool ) DUP #40 GTH SWP #5b LTH AND JMP2r
@ci-key ( char -- bool ) DUP #20 GTH SWP #7b LTH AND JMP2r

@set-cell ( x y c -- ) ROT ROT ,get-cell JSR ;data/cells ADD2 STA JMP2r
@get-cell ( x y -- addr* ) #00 SWP #00 .grid/width LDZ MUL2 ROT #00 SWP ADD2 JMP2r

@raw-to-b128 ( raw -- b128 )

	;chrb36 JSR2


@@ 1070,9 1070,6 @@ JMP2r

JMP2r

@ciuc ( char -- bool ) DUP #40 GTH SWP #5b LTH AND JMP2r
@ci-key ( char -- bool ) DUP #20 GTH SWP #7b LTH AND JMP2r

( generics )

@mfil ( src* len* -- )