Skip to content

brain-labs/brainstation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain Logo

Open Source Love Progress Coverage Code Climate Coverage Status dependencies Status GPL Licence

BrainStation

Perhaps the smallest full-working video game console for Arduino based on the NES Emulator jamulator. It is also a proof of concept for the Brainduino interpreter

table of contents

Proof of Concept

HumanWalking

  • Human Jump // Avoiding obstacles controlling the character through Bluetooth

  • Game:

HumanJump

  • Code:
setup
>>>>>>>?:++; we will only have two sprites at cell 7
build values for distant cells for later jump
>?<<<<<:++++++++>+*>+*>+++++++*<--*<---*<<<<<<;

?->>>>>>^>>>+<<<<^:<<; if btn DOWN add Y of human object
?->>>>>>>>^>>>-<<<<^; if btn UP subtract Y of human object

player
>>>>>>>>^?:++; make number two if cell 41 is empty
<<?:++++++;>> go to cell 38 and make it 6 if empty
>+% add 1 to cell 42 and take it mod 2 because of the sprite number
<<?:+;^ go back to cell 1

monster 1
>>>>>>>>>^?:++; go to cell 48 and make number two if cell 48 is empty
>+%++ add 1 to cell 49 and take it mod 2 and add 2 because of monster sprite
>?--:++>_%<++++++++++++; if cell 16 is equal to 0 then we reset it to 15

?: if cell 50 is equal to zero
   > go to cell 51
   ? check if it is different from zero
     <<<<<<<< go to cell 43
     ?<<<<<^?:+;; if cell 43 different from zero then game over
   : if cell 51 equal to zero
     <<<<<<<< go to cell 43
     ?:<<<<<^?:+;; if cell equal to zero then game over
   ; 
;

Status

In development mode, please check the dev branch

To Do In Progress Done
PostIt PostIt PostItPostIt
PostItPostIt
PostItPostIt

Installation

You can follow the instructions given here: https://github.com/brain-labs/brainduino

How it works

BrainStation is based on old video game consoles such as NES and SNES and has its own PPU (Picture Processing Unit). That being said, the Arduino will follow some steps:

  • Check for external user input and set the cells 0 trough 5, if they are active.
  • Run the Brainduino as the CPU cycle (setting the values of the fields).
  • Run the BrainStation as the PPU cycle (drawing the elements on the LCD).

The BrainStation uses the Brainduino cells (100 cells because of the Arduino limitation) as its Turing Tape and has this format:

Control Cells

LEFT BTN UP BTN RIGHT BTN DOWN BTN A BTN B BTN IsGameOver N Sprites
Cell 0 Cell 1 Cell 2 Cell 3 Cell 4 Cell 5 Cell 6 Cell 7
  • Cell 0: Left Button
  • Cell 1: Up Button
  • Cell 2: Right Button
  • Cell 3: Down Button
  • Cell 4: A Button
  • Cell 5: B Button
  • Cell 6: IsGameOver? (0: false, 1: true)
  • Cell 7: NSprites (Number of objects shown at same time on LCD)

Custom Cells

Custom Custom Custom Custom Custom Custom Custom Custom Custom Custom
Cell 8 Cell 9 Cell 10 ... ... ... ... Cell 33 Cell 34 Cell 35
  • Cells 8 through 35: Custom Cells (You can use them for any kind of operation)

Object 1 Cells

Custom Obj1 Custom Obj1 Custom Obj1 Custom Obj1 Custom Obj1 Obj1 #Sprite Obj1 #X Pos Obj1 #Y Pos
Cell 36 Cell 37 Cell 38 Cell 39 Cell 40 Cell 41 Cell 42 Cell 43
  • Cells 36 through 40: Custom Operations for the first object
  • Cell 41: The sprite number of the object 1 at a given point (values are 0 through 7 because of the LCD limitation)
  • Cell 42: X Position of object 1
  • Cell 43: Y Position of object 1

Object 2 Cells

Custom Obj2 Custom Obj2 Custom Obj2 Custom Obj2 Custom Obj2 Obj2 #Sprite Obj2 #X Pos Obj2 #Y Pos
Cell 44 Cell 45 Cell 46 Cell 47 Cell 48 Cell 49 Cell 50 Cell 51
  • Cells 44 through 48: Custom Operations for the second object
  • Cell 49: The sprite number of the object 2 at a given point (values are 0 through 7 because of the LCD limitation)
  • Cell 50: X Position of object 2
  • Cell 51: Y Position of object 2

Obs.: From the Cell 36 on, every 8 cells represent a new object. Obs.2: The BrainStation has a maximum of 7 objects because of the Arduino and LCD limitations.

BrainStation

Help

Feel free to send your pull requests. :)

LICENSE

This project extends GNU GPL v. 3, so be aware of that, regarding copying, modifying and (re)destributing.