Skip to content

Commit 46c7288

Browse files
authored
Merge pull request #594 from boriel/bugfix/print_failing_in_48k
Bugfix/print failing in 48k
2 parents 8508583 + 5645d50 commit 46c7288

80 files changed

Lines changed: 1474 additions & 1097 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/end.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# END
2+
3+
4+
##Syntax
5+
```
6+
END [<value>]
7+
```
8+
9+
Terminates execution and returns to the Operating System (i.e. to the Sinclair
10+
BASIC interpreter). An optional value can be used (defaults to 0 if not specified)
11+
that will be returned to the OS.
12+
13+
```basic
14+
PRINT "HELLO WORLD"
15+
END 32: REM The value 32 will be returned to the OS
16+
```
17+
18+
End is also a keyword used to close [scopes](scope.md) in [FUNCTION](function.md) and [SUB](sub.md)
19+
and compound sentences in [IF](if.md), [WHILE](while.md).

docs/gosub.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#GO SUB
2+
3+
4+
##Syntax
5+
```
6+
GO SUB <label>
7+
GOSUB <label>
8+
```
9+
Continues the execution at the given label or line number.
10+
The current execution point is pushed (stored) onto the stack,
11+
to be recovered later.
12+
13+
When a [RETURN](return.md) is found and executed, the previous
14+
execution point is popped out (recovered) from the stack and
15+
continues just after the GO SUB. This is a way to create simple
16+
subroutines.
17+
18+
This sentence exists just for compatibility with legacy BASIC
19+
dialects. You should use [SUB](sub.md) or [FUNCTION](function.md) instead.
20+
21+
GO SUB cannot be used within neither subroutines nor functions.
22+
You can't GOSUB into a function or sub. So GOSUB is limited to
23+
global [scope](scope.md)
24+
25+
> **WARNING**: Using GO SUB continuously without returning with
26+
> RETURN will eventually fill the stack (stack overflow) and crash
27+
> your program.
28+
29+
### Example with GO SUB
30+
31+
```
32+
10 LET number = 10
33+
20 GOSUB 1000 : REM calls the subroutine
34+
30 LET number = 20
35+
40 GOSUB 1000 : REM calls the subroutine again
36+
100 END : REM the program must end here to avoid entering the subroutine without using GOSUB
37+
1000 REM Subroutine that prints number + 1
38+
1010 PRINT "number + 1 is "; number + 1
39+
1020 RETURN : REM return to the caller
40+
```
41+
42+
This will output:
43+
44+
```
45+
number + 1 is 11
46+
number + 1 is 21
47+
```
48+
49+
50+
##Remarks
51+
* This statement is Sinclair BASIC compatible.
52+
* GO SUB cannot be used within subrutines nor functions.
53+
54+
##See also
55+
* [RETURN](return.md)
56+
* [FUNCTION](function.md)
57+
* [SUB](sub.md)

docs/goto.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#GO TO
2+
3+
4+
##Syntax
5+
```
6+
GO TO <label>
7+
GOTO <label>
8+
```
9+
Continues (jumps) the execution at the given label or line number.
10+
11+
This sentence exists just for compatibility with legacy BASIC
12+
dialects. You should use [DO...LOOP](do.md), [FOR](for.md), [SUB](sub.md)
13+
or [FUNCTION](function.md) instead.
14+
15+
You can't GOTO into a function or sub.
16+
17+
### Example with GO TO
18+
19+
```
20+
10 GOTO 30
21+
20 END
22+
30 PRINT "This is executed before END"
23+
40 GOTO 20
24+
```
25+
26+
This will `This is executed before END` and then jump into
27+
line 20, finishing the program.
28+
29+
30+
##Remarks
31+
* This statement is Sinclair BASIC compatible.
32+
33+
##See also
34+
* [GO SUB](gosub.md)

docs/return.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#RESTORE
1+
#RETURN
22

33

44
##Syntax

0 commit comments

Comments
 (0)