Skip to content

Commit 15bfcb0

Browse files
committed
Add test for jump optimization
1 parent b288c30 commit 15bfcb0

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

tests/functional/opt3_gogogoto.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+
jp __LABEL__10
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+
__LABEL__10:
28+
__LABEL__20:
29+
jp __LABEL__10
30+
__LABEL__30:
31+
jp __LABEL__10
32+
33+
ZXBASIC_USER_DATA:
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_gogogoto.bas

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
GOTO 10
4+
END
5+
10 GOTO 20
6+
END
7+
20 GOTO 10
8+
END
9+
30 GOTO 20
10+

0 commit comments

Comments
 (0)