-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error checking for accepting only first-pass computed expression valu…
…es (#60) Machinery to accept only expression values in segment start/end that are possible to compute in the first pass of compilation. This should handle most cases, although I guess conditional compilation could still leak forward label values into segment arguments. Not sure if there's a reasonable way to fix this.
- Loading branch information
Showing
11 changed files
with
144 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1000: A9 00 LDA #$00 | ||
1002: A9 01 LDA #$01 | ||
1004: A9 02 LDA #$02 | ||
1006: A9 03 LDA #$03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
!let a = $1000 | ||
|
||
!segment code(start=a, end=a+16) | ||
|
||
!segment code | ||
lda #0 ; default segment | ||
lda #1 | ||
lda #2 | ||
lda #3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1000: A9 00 LDA #$00 | ||
1002: A9 01 LDA #$01 | ||
1004: A9 02 LDA #$02 | ||
1006: A9 03 LDA #$03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
* = $1000 | ||
lbl: | ||
|
||
!let a = lbl | ||
|
||
!segment code(start=lbl, end=lbl+100) | ||
|
||
!segment code | ||
lda #0 | ||
lda #1 | ||
lda #2 | ||
lda #3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/errors/require_1stpass1.input.asm:4:21: error: !segment 'start' must evaluate to a value in the first pass | ||
test/errors/require_1stpass1.input.asm:5:32: error: !segment 'end' must evaluate to a value in the first pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
* = $801 | ||
|
||
!segment code1(start=lbl1, end=1000) ; forward refs not accepted for segments | ||
!segment code2(start=$1000, end=lbl1) ; forward refs not accepted for segments | ||
|
||
lbl1: | ||
lda #0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/errors/require_1stpass2.input.asm:5:21: error: !segment 'start' must evaluate to a value in the first pass | ||
test/errors/require_1stpass2.input.asm:6:31: error: !segment 'end' must evaluate to a value in the first pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
* = $801 | ||
|
||
!let a = lbl1 | ||
!segment code1(start=a, end=$1000) ; forward refs for start, should propagate through 'a' | ||
!segment code2(start=$801, end=a) ; ditto but for end | ||
|
||
lbl1: | ||
lda #0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test/errors/require_1stpass3.input.asm:16:33: error: !segment 'end' must evaluate to a value in the first pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
* = $801 | ||
|
||
!let a = $900 | ||
!let b = a + 4 | ||
|
||
!segment code(start=a, end=b) ; should be ok | ||
|
||
!! b = b + 1 | ||
|
||
!segment code2(start=a+100, end=100+b) ; should still be ok | ||
|
||
!let foo = lbl | ||
!! b = b + foo | ||
|
||
!segment code3(start=a+200, end=200+b) ; fail, first pass error propagates through foo | ||
|
||
* = $2000 | ||
lbl: |