~rabbits/drifblim

390e96bd7c48e4c407bad8acd2ae246bb5720912 — neauoire 3 months ago 5e880ad
Fixed issue with label names
1 files changed, 21 insertions(+), 18 deletions(-)

M src/drifblim.tal
M src/drifblim.tal => src/drifblim.tal +21 -18
@@ 179,22 179,6 @@
	&ignore ( t* -- )
		POP2 JMP2r

@lambda
	&push ( -- name* )
		[ LIT &count $1 ] INCk ,&count STR
		DUP [ LIT2 &ptr =memory/lambda ] INC2k ,&ptr STR2
		STA
		!lambda/name
	&pop ( -- )
		,&ptr LDR2 #0001 SUB2 LDAk lambda/name <create-symbol>
		,&ptr STR2
		JMP2r
	&name ( id -- str* )
		( x0 ) DUP #04 SFT LIT "0 ADD
		( 0x ) SWP #0f AND LIT "0 ADD ,&id STR2
		;&sym JMP2r
		&sym "lambda &id "00 $1

(
@|primitives )



@@ 317,6 301,22 @@
	&found ( symbols* -- <addr>* )
		#0003 SUB2 NIP2 JMP2r

@lambda
	&push ( -- name* )
		[ LIT &count $1 ] INCk ,&count STR
		DUP [ LIT2 &ptr =memory/lambda ] INC2k ,&ptr STR2
		STA
		!lambda/name
	&pop ( -- )
		,&ptr LDR2 #0001 SUB2 LDAk lambda/name <create-symbol>
		,&ptr STR2
		JMP2r
	&name ( id -- str* )
		( x0 ) DUP #04 SFT hexc
		( 0x ) SWP hexc ,&id STR2
		;&sym JMP2r
		&sym "lambda &id "00 $1

(
@|helpers )



@@ 371,14 371,14 @@
	;dst/buf DUP2 scap/ ;dict/sym-ext OVR2 <scpy>
	SWP2 .File2/name DEO2
	;memory/symbols
	&l ( -- )
	&w ( -- )
		( | addr )
		#0002 .File2/length DEO2
		DUP2 .File2/write DEO2
		( | name )
		#0003 ADD2 DUP2 slen INC2 STH2k .File2/length DEO2
		DUP2 .File2/write DEO2
		STH2r ADD2 DUP2 #0003 ADD2 LDA ?&l
		STH2r ADD2 DUP2 #0003 ADD2 LDA ?&w
	POP2 #00 ROT ROT STA
	JMP2r



@@ 460,6 460,9 @@
		POP #ff &>end
	JMP2r

@hexc ( id -- char )
	#0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD JMP2r

@shex ( str* -- val* )
	[ LIT2r 0000 ]
	&w ( -- )