GrainFimple

From Esolang
Jump to: navigation, search

GrainFimple is an esoteric programming language by User:Zzo38 based on Brainfuck and BF-RLE, and which can be used to make games.

Header

Each program must start with a header containing the following fields:

  • SPEED=number of frames per second.
  • CHARSET=ASCII7 or DOSASCII.
    • If ASCII7, then 32-126 are printable characters, 0-31 and 127 are blank, and 128-255 are reverse-video.
    • If DOSASCII, then 0-255 are DOS ASCII symbols.
  • ROWS=number of rows in video memory.
  • COLS=number of columns in video memory.
  • MEMORY=bytes of normal memory required by the program.
  • START indicates the end of the header and the start of program execution.

Commands

  • All BF-RLE commands except . and ,.
  • ; = Read input of buttons: Bit0=A Bit1=B Bit2=SELECT Bit3=START Bit4=RIGHT Bit5=LEFT Bit6=UP Bit7=DOWN.
  • : = Switch between normal memory and video memory.
  • ? = Get the value y at the current memory position and the value x at the next memory position and play a sound with frequency (256*y+x) Hz. If y and x are both zero then stop the sound.
  • ! = Breakpoint.
  • ~~ = Comment until end of line.
  • $ = Next frame.
  • ^ = Number of frames passed since last $ (used to test speed).
  • " = Set memory to the ASCII character after the quotation mark.
  • & = Compute NAND of the values at the current and next memory positions.

Example

SPEED=30
CHARSET=ASCII7
ROWS=10
COLS=16
MEMORY=256
START
:"P>"R>"E>"S>"S>" >"S>"T>"A>"R>"T>"!:
+[;>+5<&>[-]-<&-5]
:<8"H>"e>"l>"l>"o>" >"W>"o>"r>"l>"d>"!:
+[]