This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
Conditional instructions, b2bf!
Now that's a large change!
This update features the following:
- Now, asm2bf has an internal flag register (inaccessible via normal means),
- The flag register can be set by the following:
ceq cne cle clt cge cgt
(equivalent toeq, ne, le, lt, ge, gt
). For instance:
mov r1, 23
ceq r1, 23
; will set the flag register to 1.
ceq r1, 0
; nope, didn't succeed, now clears the flag register.
- New jumps:
cjn cjz
, that depend on the state of the flag register. For example:
; Old way (trashes r3):
mov r3, r1
eq_ r3, 10
jnz r3, %target
; New way (no trashes):
ceq r1, 10
cjn %target
- New instructions! All of these execute, whenever the flag register is set to 1:
Conditional variant: cad csu cmu cdi cmd csl csr cpw cps cpo csw crv cmo crc cst
Classic variant: add sub mul div mod asl asr pow psh pop swp srv mov rcl sto
- b2bf (coined by comrade Maviek) - a B to asm2bf compiler. It's an initial release, so a few things in b2bf may be rigged, but it's able to produce decent code (just three times bigger than the handcoded and optimized assembly equivalent).