Skip to content

Commit b9a1018

Browse files
authored
Merge pull request #976 from boriel-basic/fix/crash_on_cast_u32_to_i32
fix: crash on cast i32 to u32
2 parents 80abefe + 9b13bf8 commit b9a1018

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

src/arch/z80/backend/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ def to_long(stype: DataType) -> list[str]:
392392
output.append("ld e, a")
393393
output.append("ld d, a")
394394

395+
elif stype in (U32_t, I32_t):
396+
return []
397+
395398
elif stype == U16_t:
396399
output.append("ld de, 0")
397400

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
org 32768
2+
.core.__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld (.core.__CALL_BACK__), sp
10+
ei
11+
jp .core.__MAIN_PROGRAM__
12+
.core.__CALL_BACK__:
13+
DEFW 0
14+
.core.ZXBASIC_USER_DATA:
15+
; Defines USER DATA Length in bytes
16+
.core.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_END - .core.ZXBASIC_USER_DATA
17+
.core.__LABEL__.ZXBASIC_USER_DATA_LEN EQU .core.ZXBASIC_USER_DATA_LEN
18+
.core.__LABEL__.ZXBASIC_USER_DATA EQU .core.ZXBASIC_USER_DATA
19+
_a:
20+
DEFB 00, 00, 00, 00
21+
.core.ZXBASIC_USER_DATA_END:
22+
.core.__MAIN_PROGRAM__:
23+
ld hl, (_a)
24+
ld de, (_a + 2)
25+
ld (_a), hl
26+
ld (_a + 2), de
27+
ld hl, 0
28+
ld b, h
29+
ld c, l
30+
.core.__END_PROGRAM:
31+
di
32+
ld hl, (.core.__CALL_BACK__)
33+
ld sp, hl
34+
exx
35+
pop hl
36+
exx
37+
pop iy
38+
pop ix
39+
ei
40+
ret
41+
;; --- end of user code ---
42+
END
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DIM a as ULong
2+
3+
LET a = INT(a)
4+

0 commit comments

Comments
 (0)