Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Const array access seems broken in 1.3

A topic by JavaJack created 42 days ago Views: 36 Replies: 3
Viewing posts 1 to 2

It seems like the act of reading a const array either mangles the array or subsequent reads are reading the wrong thing. This is a regression from 1.2.

@OPTION SYSTEM vic20.orig
'   1
'   2631
'   84268421
const PIPS(5) as u8 = %
    .X......        
    ..X....X        
    .X..XX..        
    ..X.XX.X        
    .XX.XX.X        
    ..XXXXXX        
END%
print PIPS[2]; " "; PIPS[2] & 1   > 0
print PIPS[2]; " "; PIPS[2] & 2   > 0
print PIPS[2]; " "; PIPS[2] & 4   > 0
print PIPS[2]; " "; PIPS[2] & 8   > 0
print PIPS[2]; " "; PIPS[2] & 16  > 0
print PIPS[2]; " "; PIPS[2] & 32  > 0
print PIPS[2]; " "; PIPS[2] & 64  > 0
print PIPS[2]; " "; PIPS[2] & 128 > 0

Output (I would expect to see 76s all the way down the first column):

**** cbm basic v2 ****
3583 bytes free
ready.
load"pips",8,1
searching for pips
loading
ready.
run:
76 1
255 1
255 1
255 1
255 1
255 1
255 1
255 1
ready.
(+1)

Yup, this is a regression with the peephole optimizer, it's fixed and will be in the next release.  All of the array work I was doing caused this to show up.  Unit test added to ensure it doesn't happen again too.   :)

Thanks for the report, super helpful!

Any ETA for 1.4? :)

(+1)

Is my house bugged? 

Hey @JavaJack, either later today or early tomorrow.    :)
On the Discord I'm considering releasing betas for folks to test if you are interested.  That would start after 1.4.0