4 ms·
I wrote a little fibonacci: RAM AD PC ADDR ________ _ _ ---- |---****-|-|*| ---* |----**-*|-|-| --*- |---***--|-|-| --** |--
by ketralnis 11y ago
I wrote a little fibonacci:
RAM AD PC
ADDR ________ _ _
---- |---****-|-|*|
---* |----**-*|-|-|
--*- |---***--|-|-|
--** |--*-***-|-|-|
-*-- |---***-*|-|-|
-*-* |----**--|-|-|
-**- |---*****|-|-|
-*** |-*------|-|-|
*--- |--------|-|-|
*--* |--------|-|-|
*-*- |--------|-|-|
*-** |--------|-|-|
**-- |--------|-|-|
**-* |-------*|-|-|
***- |--------|-|-|
**** | OUTPUT |-|-|
But due to the saturating arithmetic, it gets to 255 and then just prints 255 over and over. I tried to write one that would reset itself when that happens, but I can't seem to do it in 15 bytes (I have a 14 instruction+3 variable version but of course 17 bytes won't fit in RAM)
Edit: I can save one of the variables with a set-immediate instruction :) https://github.com/gto76/comp-cpp/pull/7 https://github.com/gto76/comp-cpp/pull/7