KarolS/millfork

endless loop occurrence & glitches

zbyti opened this issue · 3 comments

zbyti commented

see landscape-endless.mfk in zip archive, additionally sometimes glitches occur during landscape rendering.

atari005 atari005

landscape.zip

zbyti commented

As for the endless loop... Maybe the OS overwrites $ff? I'll check it tomorrow.
But why is there a glitch? I don't know...

zbyti commented

It was OS I assume.

alias prev_x = os_OLDCOL
alias cursor_x = os_COLCRS
alias prev_y = os_OLDROW
alias cursor_y = os_ROWCRS
alias color = os_ATACHR

byte tmp, i

array(byte) color_height = [
  170,150,144,144,122,122,110,110,94,94,86,86,82,80
]

asm void openmode(byte register(a) m) @ $ef9c extern
asm void drawto() @ $f9c2 extern

void main(){
  openmode(9)
  os_COLOR4 = $b0

  for i,0,to,79 {
    cursor_x = i
    prev_x = i
    color = 13
    prev_y = 1

    while color != $ff {
      cursor_y = color_height[color]
      tmp = color_height[color]

      if (pokey_random & 1) != 0 {
        tmp += 1
      } else {
        if (pokey_random & 1) != 0 {
          tmp -= 1
        }
      }

      color_height[color] = tmp
      drawto()
      color -= 1
    }
  }

  while true {}
}
zbyti commented

works, my bad