~rabbits/uxnbal

f5e0236064abaac22c30347524763a37241c95e2 — Devine Lu Linvega 3 months ago 07bdb9b
Optimized stdlib routines
1 files changed, 17 insertions(+), 14 deletions(-)

M src/uxnbal.tal
M src/uxnbal.tal => src/uxnbal.tal +17 -14
@@ 63,7 63,7 @@
		eval
		( | output success name )
		;src DUP2 <emit-line>/
		<sclr>/
		<sclr>
		BRK

(


@@ 82,8 82,8 @@
@parse ( pass* -- )
	;src OVR2 walk
	( unsafe ) JSR2
	( cleanup ) ;scope <sclr>/
	( cleanup ) ;memory/body !<sclr>/
	( cleanup ) ;scope <sclr>
	( cleanup ) ;memory/body !<sclr>

@walk ( src* fn* -- )
	;&fn STA2


@@ 109,13 109,13 @@
		( | change of scope )
		.token LDZ LIT "@ NEQ ?&>no-scope
			[ LIT2 &fn $2 ] JSR2
			( ) ;memory/body <sclr>/
			;token ;scope DUP2 <sclr>/
			( ) ;memory/body <sclr>
			;token ;scope DUP2 <sclr>
			<scpy> &>no-scope
		( | write body )
		;token ;memory/body scap/ wcpy POP2
		( ) #20 ;memory/body <sput>
		;token !<sclr>/
		;token !<sclr>

@pass1 ( -- )
	;memory/body DUP2 parse-type #00 EQU ?&>skip


@@ 127,7 127,7 @@
			( name* ) INC2k make-sublabel STH2
			count-def STH2r store-def &>no-sublbl
		wcap LDAk ?&w
	POP2 ;memory/body !<sclr>/
	POP2 ;memory/body !<sclr>

@pass2 ( -- )
	.scope LDZ ?&>has-scope


@@ 406,7 406,7 @@
		#00 JMP2r

@make-sublabel ( sub* -: sublabel* )
	;memory/sublabel-buf STH2k <sclr>/
	;memory/sublabel-buf STH2k <sclr>
	;scope/no-rune STH2kr <scpy>
	[ LIT "/ ] STH2kr <sput>
	( entry -> ) STH2kr scap/ wcpy POP2 STH2r JMP2r


@@ 597,7 597,7 @@
		INC2 GTH2k ?&l
	POP2 POP2 JMP2r

@chex ( c -: <val> )
@chex ( c -: ~val )
	LIT "0 SUB DUP #0a LTH ?&end
	#27 SUB DUP #10 LTH ?&end
	POP #ff


@@ 616,8 616,8 @@
	JMP2r

@<sput> ( chr str* -: )
	scap/ INC2k #00 ROT ROT STA
	STA
	STH2
	#00 STH2r scap/ STA2
	JMP2r

@skey ( key buf -: proc )


@@ 637,9 637,12 @@
	LDA2r LDA2 STH2r EQU2 JMP2r

@<sclr> ( str* -: )
	STH2k #00 STH2r STA
	INC2 & LDAk ?<sclr>
	POP2 JMP2r
	STH2
	#00 STH2r
	&w ( -- )
		STAk INC2 LDAk ?&w
	STA
	JMP2r

(
@|assets )