Use the volatile keyword with all inline assembly to make sure the optimizer doesn't remove it.

This commit is contained in:
Jeremy Rand 2018-10-21 14:26:19 -04:00
parent 209b1ef23e
commit 74cf2775f1
4 changed files with 2 additions and 2 deletions

View File

@ -70,7 +70,7 @@ SRCDIRS+=
# If you want to add arguments to the compile commandline, add them
# to this variable:
CFLAGS += -Oi
CFLAGS += -O
# If you want to add arguments to the assembly commandline, add them
# to this variable:

Binary file not shown.

View File

@ -33,7 +33,7 @@ void playSound(int8_t freq, int16_t duration)
return;
while (duration > 0) {
asm ("STA %w", 0xc030);
asm volatile ("STA %w", 0xc030);
while (freq > 0) {
freq--;
}