Does this make sense? I won't post all of my code, because it is large. But take the function below. If I compile it reports 25916 Byes. If I comment out the draw_invader() lines (there are five of them) the compile reports 26348 Bytes.
The size difference doesn't matter, of course, but I don't understand why it would be a larger compile with less code. The draw_invader() function does get called elsewhere, but nothing else is being changed.
The size difference doesn't matter, of course, but I don't understand why it would be a larger compile with less code. The draw_invader() function does get called elsewhere, but nothing else is being changed.
Code:
void setup(PIO pio, uint sm) {uint8_t i,j,col;col = 38;for (i = 0; i < INVADERCOLS; i++) {draw_invader(pio, sm, squid, 0, col, 0, RGB565_GREEN);invaders[0][i] = (struct invader) {col, col+15, 0, 7, KIND_SQUID, 0, RGB565_GREEN, ALIVE};col += 15;}col = 38;for (i = 0; i < INVADERCOLS; i++) {draw_invader(pio, sm, crab, 14, col, 0, RGB565_GREEN);invaders[1][i] = (struct invader) {col, col+15, 14, 21, KIND_CRAB, 0, RGB565_GREEN, ALIVE};col += 15;}col = 38;for (i = 0; i < INVADERCOLS; i++) {draw_invader(pio, sm, crab, 28, col, 1, RGB565_CYAN);invaders[2][i] = (struct invader) {col, col+15, 28, 35, KIND_CRAB, 1, RGB565_CYAN, ALIVE};col += 15;}col = 38;for (i = 0; i < INVADERCOLS; i++) {draw_invader(pio, sm, octopus, 42, col, 0, RGB565_CYAN);invaders[3][i] = (struct invader) {col, col+15, 42, 49, KIND_OCTOPUS, 0, RGB565_CYAN, ALIVE};col += 15;}col = 38;for (i = 0; i < INVADERCOLS; i++) {draw_invader(pio, sm, octopus, 56, col, 1, RGB565_MAGENTA);invaders[4][i] = (struct invader) {col, col+15, 56, 63, KIND_OCTOPUS, 1, RGB565_MAGENTA, ALIVE};col += 15;}}
Statistics: Posted by Mike**K — Sat Oct 12, 2024 6:15 pm