rendered paste bodysource ^subvar.bfm
source ^booland.bfm
source ^copy.bfm
source ^divvar.bfm
macro mod {result v1 v2 tmp tmp1 tmp2 tmp3} {
set tmp 0
set tmp1 0
set tmp2 0
set tmp3 0
while v1 {
copy v2 tmp tmp1
copy v1 tmp2 tmp1
booland tmp2 tmp tmp1 tmp3
while tmp2 {
subtract tmp 1
subtract v1 1
copy v1 tmp2 tmp1
booland tmp2 tmp tmp1 tmp3
}
comment #
}
set result 0
while tmp {
add result 2
subvar result tmp tmp1
set tmp 0
}
}
macro itoa {int a1 a2 a3 tmp tmp1 tmp2 tmp3 tmp4} {
set tmp 10
set a1 0
set a2 0
set a3 0
set tmp1 0
set tmp2 0
set tmp3 0
set tmp4 0
comment #
mod a1 int tmp tmp1 tmp2 tmp3 tmp4
comment #
divvar int tmp tmp1 tmp2 tmp3 tmp4
comment #
mod a2 int tmp tmp1 tmp2 tmp3 tmp4
comment #
divvar int tmp tmp1 tmp2 tmp3 tmp4
comment #
mod a3 int tmp tmp1 tmp2 tmp3 tmp4
comment #
divvar int tmp tmp1 tmp2 tmp3 tmp4
comment #
copy a3 tmp1 tmp2
add tmp2 1
comment #
while tmp1 {
add a3 48
add a2 48
add a1 48
set tmp1 0
set tmp2 0
}
while tmp2 {
copy a2 tmp1 tmp2
while tmp1 {
add a2 48
add a1 48
set tmp2 0
set tmp1 0
}
while tmp2 {
add a1 48
set tmp2 0
}
}
}
@ int 0
@ a1 1
@ a2 2
@ a3 3
@ temp 4
@ temp1 5
@ temp2 6
@ temp3 7
@ temp4 8
add int 20
itoa int a1 a2 a3 temp temp1 temp2 temp3 temp4
out a1
out a2
out a3