Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUTBASIC requires a space which BBC BASIC's own tokeniser doesn't #65

Open
ZornsLemma opened this issue Oct 29, 2021 · 0 comments
Open

Comments

@ZornsLemma
Copy link
Collaborator

ZornsLemma commented Oct 29, 2021

Thanks to mikroman for reporting this in the discussion of #64.

The attached zip file contains a test case. The generated BASIC program fails when run, but re-typing the line at the BASIC prompt and re-running works fine:
putbasic-problem.zip
Screenshot at 2021-10-29 02-58-43

Adding a space before "MOD" allows PUTBASIC to tokenise this correctly, but I don't think it should be necessary if BBC BASIC doesn't require it.

Homo-carbonis pushed a commit to Homo-carbonis/beebasm that referenced this issue Aug 31, 2022
These were dumped in examples for want of anywhere better, but now we
have a test harness which executes (other copies of) them, they can be
removed - they aren't all that instructive as examples.
diff --git a/examples/basicrhstoken.6502 b/examples/basicrhstoken.6502
deleted file mode 100644
index e46a8c2..0000000
--- a/examples/basicrhstoken.6502
+++ /dev/null
@@ -1 +0,0 @@
-putbasic "basicrhstoken.bas", "RHSTOK"
diff --git a/examples/basicrhstoken.bas b/examples/basicrhstoken.bas
deleted file mode 100644
index f2d9a47..0000000
--- a/examples/basicrhstoken.bas
+++ /dev/null
@@ -1,13 +0,0 @@
-p=PAGE
-PRINT p
-?&900=PAGE MOD 256
-PRINT FNpage
-PRINT ?&900
-?&901=TIME MOD 256
-PRINT ?&901
-PRINT FNtime
-END
-DEF FNpage
-=PAGE
-DEF FNtime
-=TIME
diff --git a/examples/errorlinenumber1.6502 b/examples/errorlinenumber1.6502
deleted file mode 100644
index f7d1382..0000000
--- a/examples/errorlinenumber1.6502
+++ /dev/null
@@ -1,17 +0,0 @@
-org &2000
-.start
-
-macro foo
-	for i, 0, 2
-		nop
-	next
-
-	lda stardot#10
-	ldx (&70),y
-endmacro
-
-foo
-
-.end
-
-save "foo", start, end
diff --git a/examples/errorlinenumber2.6502 b/examples/errorlinenumber2.6502
deleted file mode 100644
index b585b14..0000000
--- a/examples/errorlinenumber2.6502
+++ /dev/null
@@ -1,15 +0,0 @@
-org &2000
-.start
-
-for i, 0, 2
-	nop
-next
-
-lda stardot#10
-ldx (&70),y
-
-foo
-
-.end
-
-save "foo", start, end
diff --git a/examples/invalidbasic1.6502 b/examples/invalidbasic1.6502
deleted file mode 100644
index 74738f2..0000000
--- a/examples/invalidbasic1.6502
+++ /dev/null
@@ -1,7 +0,0 @@
-org &2000
-.start
-	rts
-.end
-
-save "test", start, end
-putbasic "invalidbasic1.bas", "ib1"
diff --git a/examples/invalidbasic1.bas b/examples/invalidbasic1.bas
deleted file mode 100644
index 62eb4c3..0000000
--- a/examples/invalidbasic1.bas
+++ /dev/null
@@ -1 +0,0 @@
-10PRINT "Hello
diff --git a/examples/invalidbasic2.6502 b/examples/invalidbasic2.6502
deleted file mode 100644
index b46d583..0000000
--- a/examples/invalidbasic2.6502
+++ /dev/null
@@ -1,7 +0,0 @@
-org &2000
-.start
-	rts
-.end
-
-save "test", start, end
-putbasic "invalidbasic2.bas", "ib2"
diff --git a/examples/invalidbasic2.bas b/examples/invalidbasic2.bas
deleted file mode 100644
index 7482ead..0000000
--- a/examples/invalidbasic2.bas
+++ /dev/null
@@ -1 +0,0 @@
-10REM This line just goes on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on and on...
diff --git a/examples/local-forward-branch-1.6502 b/examples/local-forward-branch-1.6502
deleted file mode 100644
index 161a6e2..0000000
--- a/examples/local-forward-branch-1.6502
+++ /dev/null
@@ -1,20 +0,0 @@
-org &2000
-
-.start
-
-.ok
-	for i,1,65
-		lda stardot#65
-	next
-	{
-		cmp stardot#65:beq ok:jmp boom:.ok
-	}
-	rts
-
-.boom
-	lda stardot#7:jsr &ffee
-	jmp boom
-
-.end
-
-save "test", start, end
diff --git a/examples/local-forward-branch-2.6502 b/examples/local-forward-branch-2.6502
deleted file mode 100644
index e46fd65..0000000
--- a/examples/local-forward-branch-2.6502
+++ /dev/null
@@ -1,24 +0,0 @@
-org &2000
-
-macro branch_if_eq target
-	beq target
-endmacro
-
-.start
-
-.ok
-	for i,1,65
-		lda stardot#65
-	next
-	{
-		cmp stardot#65:branch_if_eq ok:jmp boom:.ok
-	}
-	rts
-
-.boom
-	lda stardot#7:jsr &ffee
-	jmp boom
-
-.end
-
-save "test", start, end
diff --git a/examples/local-forward-branch-3.6502 b/examples/local-forward-branch-3.6502
deleted file mode 100644
index 758f8b1..0000000
--- a/examples/local-forward-branch-3.6502
+++ /dev/null
@@ -1,15 +0,0 @@
-org &2000
-
-a = &70
-
-macro foo zp
-	lda zp
-endmacro
-
-.start
-
-	foo a
-
-.end
-
-save "test", start, end
diff --git a/examples/local-forward-branch-4.6502 b/examples/local-forward-branch-4.6502
deleted file mode 100644
index aa06f44..0000000
--- a/examples/local-forward-branch-4.6502
+++ /dev/null
@@ -1,19 +0,0 @@
-org &2000
-
-a = &70
-
-macro load_a_and_maybe_x i, do_x
-	lda #i
-	if do_x
-		ldx #i
-	endif
-endmacro
-
-.start
-
-	load_a_and_maybe_x 42, FALSE
-	load_a_and_maybe_x 65, TRUE
-
-.end
-
-save "test", start, end
diff --git a/examples/local-forward-branch-5.6502 b/examples/local-forward-branch-5.6502
deleted file mode 100644
index 852472f..0000000
--- a/examples/local-forward-branch-5.6502
+++ /dev/null
@@ -1,30 +0,0 @@
-org &2000
-
-\ Some buggy changes to the assembler caused the values emitted by equw
-\ to be incorrect; no obvious failure occurred. So it's important to check
-\ the output of this to see that it's right, unlike the earlier
-\ local-forward-branch-n.6502 tests which simply failed to assemble.
-
-macro bar x
-	equw x
-endmacro
-
-macro foo x
-	bar x-1
-endmacro
-
-.start
-
-	lda stardot#65
-.baz
-
-	foo start ; should emit &ff &1f
-	foo baz   ; should emit &01 &20
-
-	ldx stardot#42
-
-	foo end   ; should emit &09 &20
-
-.end
-
-save "test", start, end
diff --git a/examples/putbasicnonexistentdemo.6502 b/examples/putbasicnonexistentdemo.6502
deleted file mode 100644
index 790fce6..0000000
--- a/examples/putbasicnonexistentdemo.6502
+++ /dev/null
@@ -1,7 +0,0 @@
-org &2000
-.start
-	rts
-.end
-
-save "test", start, end
-putbasic "nonexistent", "ne"
diff --git a/examples/putfilenonexistentdemo.6502 b/examples/putfilenonexistentdemo.6502
deleted file mode 100644
index fe9dcd8..0000000
--- a/examples/putfilenonexistentdemo.6502
+++ /dev/null
@@ -1,7 +0,0 @@
-org &2000
-.start
-	rts
-.end
-
-save "test", start, end
-putfile "nonexistent", "ne", 0, 0
mungre added a commit to mungre/beebasm that referenced this issue Oct 16, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 16, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 17, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 18, 2022
mungre added a commit that referenced this issue Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant