microsoft / pxt-adafruit

Microsoft MakeCode editor for Adafruit Circuit Playground Express
https://makecode.adafruit.com
Other
81 stars 77 forks source link

Assembler error on array of large numbers #1207

Open riknoll opened 2 years ago

riknoll commented 2 years ago

Reported on the forum here: https://forum.makecode.com/t/2d-array-works-but-then-not/12006

For some reason the assembler doesn't seem to like arrays with a bunch of large numbers. This does not repro in arcade or micro:bit; just adafruit. The fix is probably just to update PXT

Here's a minimal repro:

let array2D = [
    16515072, 14164992, 11553792, 8942592, 6331392, 3981312, 1370112, 60432, 50232, 40032, 30852, 20652, 10452, 2359512, 4718772, 7340172, 9961572, 12582972, 14942232,
    16711680, 14622720, 12533760, 10444800, 8421376, 6332160, 4243200, 2154240, 65280, 57120, 48960, 40800, 32896, 24735, 16575, 8415, 255, 2097375, 4194495, 6291615, 8388736
];

console.log(array2D.length)

Note that you have to try and download to hardware to get the error to show up.