Barotrauma

Barotrauma

Not enough ratings
Crazy Ivan's FizzBuzz
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
399.819 KB
1 Nov, 2020 @ 8:32pm
1 Change Note ( view )

Subscribe to download
Crazy Ivan's FizzBuzz

Description
Here's a working `computer` loaded with the well-known `FizzBuzz` program.

Features:
- 84 memory registers which, in the von Neumann style, store both variables *and* program instructions.
- Arithmetic Logic Unit with 6 instructions: Add, Set, Jump, Greater, Modulo, and And.
- A bus composed of 4 wifi channels which select a memory address and read or write to it; this makes adding additional memory cells easy via copy and paste.
- Output (and with a little modification, input) through a single terminal.
- A 1.88Hz clock controls program flow in 8 phases, which correspond to:
```
Read the next instruction and increment the location of the next instruction.
Read the operands for the instruction.
Execute the instruction.
Write the result to memory.
```

Here's the program (each step takes up 3 memory cells: an instruction and 2 variable addresses):
- Jmp sets the next instruction to the second operand if the first operand is zero.
- All other operations replace the first operand's value with the result of the operation.
- Memory conventions: InstructionType, variableAddress, CONSTANT_ADDRESS, @program_step_address //comment
```
Add counter ONE //@program_start
Set divisibleBy3 counter
Set divisibleBy5 counter
Mod divisibleBy3 THREE
Mod divisibileBy5 FIVE
Set divisibleBy3&5 divisibleBy3
And divisibleBy3&5 divisibleBy5
Jmp divisibleBy3&5 @divisible_by_3
Set output FIZZBUZZ
Jmp ZERO @loop_check
Jmp divisibleBy3 @divisible_by_5 //@divisible_by_3
Set output FIZZ
Jmp ZERO @loop_check
Jmp divisibleBy5 @else_section //@divisible_by_5
Set output BUZZ
Jmp ZERO @loop_check
Set output counter //@else_section
Set keepLooping counter //@loop_check
Gtr keepLooping LOOP_LIMIT
Jmp keepLooping @program_start
Jmp ZERO @program_end //@program_end
```

Happy to answer questions in #baro-subs !
Full video: https://youtu.be/1FwRDzWpAbU
Steam Workshop: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2274975394
4 Comments
Crazy Ivan  [author] 19 Jun, 2021 @ 8:53am 
@Voltz 84 registers because that's exactly how many the FizzBuzz program needed.
Voltz 17 Jun, 2021 @ 2:26am 
You, you made a computer in a game in another a computer. a computer so advanced it uses von neumann architecture and 84 memory registers. have to ask though, why 84?
Darksteelknight 20 Mar, 2021 @ 4:22pm 
Beautiful
Mexican Man 2 Jan, 2021 @ 8:30pm 
holy shiiiiiiit