Skip to content

Commit 13a7656

Browse files
committed
Merged in bugfix/end_program (pull request #175)
Bugfix/end program Approved-by: Jose Rodriguez <[email protected]>
2 parents a1e0167 + f034ee4 commit 13a7656

File tree

7 files changed

+92
-4
lines changed

7 files changed

+92
-4
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[bumpversion]
2-
current_version = 1.8.5
2+
current_version = 1.8.6
33
files = version.py
44

arch/zx48k/translator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ def visit_STRING(self, node):
318318
yield node.t
319319

320320
def visit_END(self, node):
321-
arg = (yield node.children[0])
321+
yield node.children[0]
322322
__DEBUG__('END')
323-
self.emit('end', arg)
323+
self.emit('end', node.children[0].t)
324324

325325
def visit_ERROR(self, node):
326326
# Raises an error

tests/functional/opt1_endtest.asm

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
org 32768
2+
__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld hl, 0
10+
add hl, sp
11+
ld (__CALL_BACK__), hl
12+
ei
13+
ld hl, (_N)
14+
ld b, h
15+
ld c, l
16+
__END_PROGRAM:
17+
di
18+
ld hl, (__CALL_BACK__)
19+
ld sp, hl
20+
exx
21+
pop hl
22+
exx
23+
pop iy
24+
pop ix
25+
ei
26+
ret
27+
__CALL_BACK__:
28+
DEFW 0
29+
ld hl, 0
30+
ld b, h
31+
ld c, l
32+
jp __END_PROGRAM
33+
34+
ZXBASIC_USER_DATA:
35+
_N:
36+
DEFB 39h
37+
DEFB 30h
38+
; Defines DATA END --> HEAP size is 0
39+
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
40+
; Defines USER DATA Length in bytes
41+
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
42+
END

tests/functional/opt1_endtest.bas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
DIM N as uinteger = 12345
3+
end N
4+

tests/functional/opt3_endtest.asm

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
org 32768
2+
__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld hl, 0
10+
add hl, sp
11+
ld (__CALL_BACK__), hl
12+
ei
13+
ld bc, (_N)
14+
__END_PROGRAM:
15+
di
16+
ld hl, (__CALL_BACK__)
17+
ld sp, hl
18+
exx
19+
pop hl
20+
pop iy
21+
pop ix
22+
exx
23+
ei
24+
ret
25+
__CALL_BACK__:
26+
DEFW 0
27+
ld bc, 0
28+
jp __END_PROGRAM
29+
30+
ZXBASIC_USER_DATA:
31+
_N:
32+
DEFB 39h
33+
DEFB 30h
34+
; Defines DATA END --> HEAP size is 0
35+
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
36+
; Defines USER DATA Length in bytes
37+
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
38+
END

tests/functional/opt3_endtest.bas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
DIM N as uinteger = 12345
3+
end N
4+

version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '1.8.5'
1+
VERSION = '1.8.6'

0 commit comments

Comments
 (0)