KarolS / KarolS/millfork

Non-constant literal initialization is not supported

Open
#98 3 comments 0 reactions 0 assignees View on GitHub
compiler documentation
Dominant language
Scala
Stars
279
Forks
21
PR merge metrics
No merged PRs in 30d

Description

The compiler allows you to initialize a global variable with a literal: `const byte test = 1`, but doesn't actually generate any code to initialize those variables on program start.

```
word input = 1000
byte output

void main() {
func(input)

if (output == 0) {
asm {
kil
}
}

while (true) {}
}

void func(word func_input) {
output = func_input.hi
}

void nmi() {

}

void irq() {

}
```

Built with `java -jar millfork.jar main.mfk -o build/rom.nes -t nes_small -g -s -fsource-in-asm -fillegals`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.