Super Mario 64

From Esolang
Jump to navigation Jump to search

Super Mario 64 is a joke language where the code is represented by a `.m64` tas file (and maybe a savestate)

When certain things happen in the game, certain things happen in this programming language's memory.

Memory

This is separate from the game's memory - and shared across the game's savefiles

You have 8 MB to use, and 2 pointers. (I have no idea what I'm saying)

At the start the two pointers are read and write pointers respectively, and the "main" pointer is the read pointer.

The pointers start at the first bit.

If a pointer is at the first bit and moves left, it ends up at the last bit. So it loops around. Same thing with going right.

Steps that read/write bits automatically move the reading/writing pointer to the bit after the last bit of the read/write.

Actions

For each frame, the following When conditions are checked in order.

If a condition is true, the corresponding Do is done

SM64 programming language action table
When Do
The L button is pressed Move the main pointer 1 bit to the right
The R button is pressed Move the main pointer 1 bit to the left
Mario is ground pounding Switch which pointer the main pointer is
Mario is in the freefall state and the rng index is a multiple of 1024 Switch which type of pointer the main pointer is
Mario collects a coin Toggle the bit at the main pointer without affecting the main pointer
A star is collected on a save that has pressed A Doubles the memory
A new savefile is started Sets every bit of memory to 0.
If the memory is already empty, it cuts the amount of memory in half. The memory is gone forever.
The product of mario's x, y, and z position is more than 1 billion If one pointer is a read pointer, and the other pointer is a write pointer, then:
  1. If joystick[x] is even, Read+Write joystick[x] amount of bits.
  2. Else Read+Write joystick[y] amount of bits
A star is collected on a save that hasn't pressed A If both pointers are read pointers, then:
  1. Let bits = 0
  2. Switch which pointer the main pointer is
  3. While the bit at the read pointer is 1
    1. bits++
    2. Move the non-main read pointer to the right
    3. if bits > the amount of bits in memory, exit the while loop
  4. If the star that was collected hasn't been collected in that file before, multiply bits by 8
  5. While bits > 0
    1. bits--
    2. Output the bit at the read pointer
    3. Move the main read pointer to the right
The amount of lives mario has changes (like a 1-up) Do the previous action again
A whole day (= 24 hours) (in game time) passes Toggle every bit, then if the main pointer is a read pointer, output the bit at the main pointer.
The rng is 0 If both pointers are read pointers, XOR the bits of both pointers, turn the main pointer into a write pointer, move the main pointer 1 to the left, write the result of the XOR, and finally turn the main pointer back into a read pointer.
The game crashes Crash

Usefulness

This is probably an extremely difficult language to program (and achieve stuff) in. Although I wonder what normal TASes

There's only two ways to output anything, and they're both non-trivial to do.

And unless you want to run your program manually, you'll have to invent a sm64 interpreter.

Although, technically, this language might be turing complete. Its do functions say it has all the necessary functionality: "infinite" memory, "if", and "increment" / "decrement". I have no idea how you would make a quine or something.

This language could be made much more useful with the use of the joystick. If anyone tries this, feel free to edit this and add more controls.