vextoly/cryn

make string "\n" nleol

define nl result nothing
  address nleol
  output text
  set nothing
  return
end

[# fizzbuzz 1..30: no strings needed, just markers #]
define main
  make int64 i
  make int64 fizz
  make int64 buzz

  set 1
  move i
  write

  mark loop
  move i
  read
  compare 30
  jump done when greater
  set 0
  home

  move i
  read
  remainder 3
  move fizz
  write

  move i
  read
  remainder 5
  move buzz
  write
  set 0
  home

  move fizz
  read
  home
  compare 0
  jump checkBuzz when equal
  move buzz
  read
  home
  compare 0
  jump printB when equal
  move i
  read
  output
  home
  call nl
  set 0
  jump next

  mark checkBuzz
  move buzz
  read
  home
  compare 0
  jump printFB when equal
  set 'F'
  output
  home
  call nl
  set 0
  jump next

  mark printB
  set 'B'
  output
  home
  call nl
  set 0
  jump next

  mark printFB
  set 'F'
  output
  set 'B'
  output
  home
  call nl
  set 0

  mark next
  move i
  read
  add 1
  move i
  write
  set 0
  jump loop

  mark done
  return
end