Skip to content

Commit 139cf1e

Browse files
committed
Add test opt4 for block reg propagation
This tests the values of one basic block is propagated to another one.
1 parent bd894f1 commit 139cf1e

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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, (_x)
14+
ld de, 25
15+
add hl, de
16+
ld a, 50
17+
cp (hl)
18+
jp nc, __LABEL1
19+
ld hl, (_x)
20+
add hl, de
21+
xor a
22+
ld (hl), a
23+
__LABEL1:
24+
ld bc, 0
25+
__END_PROGRAM:
26+
di
27+
ld hl, (__CALL_BACK__)
28+
ld sp, hl
29+
exx
30+
pop hl
31+
pop iy
32+
pop ix
33+
exx
34+
ei
35+
ret
36+
__CALL_BACK__:
37+
DEFW 0
38+
39+
ZXBASIC_USER_DATA:
40+
_x:
41+
DEFB 00, 00
42+
; Defines DATA END --> HEAP size is 0
43+
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP
44+
; Defines USER DATA Length in bytes
45+
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
46+
END
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
REM checks for register propagation
2+
REM the cpu state of the preceding basic block(s)
3+
REM can be propagated to the current one for deeper
4+
REM optimizations
5+
6+
DIM x As Uinteger
7+
#define spriteTimer (x + 25)
8+
9+
if peek(spriteTimer)>50 then
10+
poke spriteTimer,0
11+
end if
12+

0 commit comments

Comments
 (0)