Skip to content

Commit

Permalink
Merged in bugfix/end_program (pull request #175)
Browse files Browse the repository at this point in the history
Bugfix/end program

Approved-by: Jose Rodriguez <[email protected]>
  • Loading branch information
boriel committed Sep 20, 2018
2 parents a1e0167 + f034ee4 commit 13a7656
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[bumpversion]
current_version = 1.8.5
current_version = 1.8.6
files = version.py

4 changes: 2 additions & 2 deletions arch/zx48k/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def visit_STRING(self, node):
yield node.t

def visit_END(self, node):
arg = (yield node.children[0])
yield node.children[0]
__DEBUG__('END')
self.emit('end', arg)
self.emit('end', node.children[0].t)

def visit_ERROR(self, node):
# Raises an error
Expand Down
42 changes: 42 additions & 0 deletions tests/functional/opt1_endtest.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
org 32768
__START_PROGRAM:
di
push ix
push iy
exx
push hl
exx
ld hl, 0
add hl, sp
ld (__CALL_BACK__), hl
ei
ld hl, (_N)
ld b, h
ld c, l
__END_PROGRAM:
di
ld hl, (__CALL_BACK__)
ld sp, hl
exx
pop hl
exx
pop iy
pop ix
ei
ret
__CALL_BACK__:
DEFW 0
ld hl, 0
ld b, h
ld c, l
jp __END_PROGRAM

ZXBASIC_USER_DATA:
_N:
DEFB 39h
DEFB 30h
; Defines DATA END --> HEAP size is 0
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
; Defines USER DATA Length in bytes
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
END
4 changes: 4 additions & 0 deletions tests/functional/opt1_endtest.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

DIM N as uinteger = 12345
end N

38 changes: 38 additions & 0 deletions tests/functional/opt3_endtest.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
org 32768
__START_PROGRAM:
di
push ix
push iy
exx
push hl
exx
ld hl, 0
add hl, sp
ld (__CALL_BACK__), hl
ei
ld bc, (_N)
__END_PROGRAM:
di
ld hl, (__CALL_BACK__)
ld sp, hl
exx
pop hl
pop iy
pop ix
exx
ei
ret
__CALL_BACK__:
DEFW 0
ld bc, 0
jp __END_PROGRAM

ZXBASIC_USER_DATA:
_N:
DEFB 39h
DEFB 30h
; Defines DATA END --> HEAP size is 0
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
; Defines USER DATA Length in bytes
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
END
4 changes: 4 additions & 0 deletions tests/functional/opt3_endtest.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

DIM N as uinteger = 12345
end N

2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.8.5'
VERSION = '1.8.6'

0 comments on commit 13a7656

Please sign in to comment.