35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
; FizzBuzz classical challenge in MU8A for mu808 VM
|
|
; Outputs first 100 FizzBuzz numbers
|
|
; Created by Luxferre in 2025, released into public domain
|
|
|
|
set 100 0 51 ; store constant 100 into loc 51
|
|
set 3 0 3 ; store constant 3 into loc 3
|
|
set 5 0 5 ; store constant 5 into loc 5
|
|
set 70 0 60 ; store Fi into loc 60-61
|
|
set 105 0 61
|
|
set 66 0 62 ; store Buz + LF into loc 62-65
|
|
set 117 0 63
|
|
set 122 0 64
|
|
set 10 0 65
|
|
set 1 0 1 ; counter in loc 1
|
|
:lp mdf 1 3 2 ; loop start; store counter mod 3 into loc 2
|
|
mdf 1 5 4 ; store counter mod 5 into loc 4
|
|
set 1 0 10 ; set normal output flag to loc 10
|
|
jne 2 :bu ; jump next if not divisible by 3
|
|
out 60 61 1 ; output Fizz sequence
|
|
out 64 64 1
|
|
out 64 64 1
|
|
set 0 0 10 ; unset normal output flag
|
|
:bu jne 4 :no ; jump next if not divisible by 5
|
|
out 62 63 1 ; output Buzz sequence
|
|
out 64 64 1
|
|
out 64 64 1
|
|
set 0 0 10 ; unset normal output flag
|
|
:no jeq 10 :n ; jump next if normal output flag is off
|
|
out 1 1 0 ; normal counter output
|
|
juc :le ; jump to the end of the loop
|
|
:n out 65 65 1 ; output a newline
|
|
:le inc 1 ; increment the counter
|
|
sub 1 51 6 ; save the difference into loc 6
|
|
jle 6 :lp ; go back in the loop if not every number is displayed yet
|