Browse code

Stopped using relative offsets in sublabels

Andrew Alderwick authored on 15/05/2021 18:00:57
Showing 1 changed files
... ...
@@ -149,7 +149,6 @@
149 149
 	#0000 ;asma/error STA2
150 150
 	;asma-heap ;asma/heap STA2
151 151
 	#0000 ;asma-trees/labels STA2
152
-	( FIXME should walk the label tree and remove any in the heap )
153 152
 	;asma-opcodes/_entry ;asma-trees/opcodes STA2
154 153
 	#0000 ;asma-trees/macros STA2
155 154
 
... ...
@@ -192,7 +191,7 @@
192 191
 	POP POP2 POP2
193 192
 	JMP2r
194 193
 
195
-@asma [ &pass $1 &state $1 &line $2 &token $2 &orig-token $2 &heap $2 &addr $2 &written-addr $2 &flush-fn $2 &scope-addr $2 &error $2 ]
194
+@asma [ &pass $1 &state $1 &line $2 &token $2 &orig-token $2 &heap $2 &addr $2 &written-addr $2 &flush-fn $2 &error $2 ]
196 195
 @asma-trees [ &labels $2 &macros $2 &opcodes $2 &scope $2 ]
197 196
 
198 197
 (
... ...
@@ -500,14 +499,12 @@
500 499
 	JMP2r
501 500
 
502 501
 @asma-label-define
503
-	#0000 ;asma/scope-addr STA2
504 502
 	;asma-trees/labels ,asma-label-helper JSR
505 503
 	,&already-existed JCN
506 504
 
507 505
 	#0000 ;asma-append-heap-short JSR2 ( data2: subtree incoming ptr )
508 506
 
509 507
 	&already-existed
510
-	;asma/addr LDA2 ;asma/scope-addr STA2
511 508
 	#0002 ADD2 ;asma-trees/scope STA2
512 509
 	JMP2r
513 510
 
... ...
@@ -534,8 +531,7 @@
534 531
 
535 532
 	;asma/heap LDA2
536 533
 
537
-	;asma/addr LDA2 ;asma/scope-addr LDA2 SUB2
538
-	;asma-append-heap-short JSR2 ( data1: address )
534
+	;asma/addr LDA2 ;asma-append-heap-short JSR2 ( data1: address )
539 535
 	#00 JMP2r
540 536
 
541 537
 @asma-pad-absolute
... ...
@@ -614,14 +610,14 @@
614 610
 @asma-addr-helper ( -- addr* )
615 611
 	;asma/token LDA2 LDAk #26 NEQ ,&not-local JCN
616 612
 	#0001 ADD2 ;asma/token STA2
617
-	;asma/scope-addr LDA2 ;asma-trees/scope LDA2
613
+	;asma-trees/scope LDA2
618 614
 	,&final-lookup JMP
619 615
 
620 616
 	&not-local ( token* )
621 617
 	LDAk
622 618
 	DUP ,&not-end JCN
623 619
 	POP POP2
624
-	#0000 ;asma-trees/labels
620
+	;asma-trees/labels
625 621
 	,&final-lookup JMP
626 622
 
627 623
 	&not-end ( token* char )
... ...
@@ -633,23 +629,26 @@
633 629
 	DUP2 #00 ROT ROT STA
634 630
 	;asma-trees/labels ;asma-traverse-tree JSR2 STH
635 631
 	SWP2 DUP2 #2f ROT ROT STA
636
-	STHr ,&not-found JCN
632
+	STHr ,&not-found2 JCN
637 633
 	( token* binary-ptr* )
638 634
 	#0001 ADD2 ;asma/token STA2
639
-	LDA2k SWP2 #0002 ADD2
635
+	#0002 ADD2
640 636
 
641 637
 	&final-lookup ( addr-offset* incoming-ptr* )
642
-	;asma-traverse-tree JSR2 ,&not-found JCN
643
-	LDA2 ADD2
638
+	;asma-traverse-tree JSR2
639
+	,&not-found JCN
640
+	LDA2
644 641
 	JMP2r
645 642
 
646
-	&not-found ( dummy* dummy* )
643
+	&not-found2 ( dummy* dummy* )
644
+	POP2
645
+	&not-found ( dummy* )
646
+	POP2
647 647
 
648 648
 	;asma/pass LDA #00 EQU ,&ignore-error JCN
649 649
 	;asma-msg-label ;asma/error STA2
650 650
 	&ignore-error
651 651
 
652
-	POP2 POP2
653 652
 	;asma/addr LDA2
654 653
 	JMP2r
655 654