ARM2 Assembly

  • 8091 lines of code in one single file

Input Flow

  • .Player1flag holds the player’s input along %xxxFUDLR (Function, Up, Down, Left, Right). The holder is set in various places, according to the input method (joystick, keyboard)
  • Line 4411 loads Player1flag into register R1
    • LDRB R1,Player1flag
  • The code proceeds to check the input and reacts accordingly
  • Line 4413 for example compares the flag with with the pattern for the input for left and branches of to .noLeft if not.
    • TST R1,#%00010:CMPEQ R13,#0:BNE noleft ; LEFT ;
  • On Line 4430, if .Player1flag is set for left, the code also checks if Space was pressed, the input for doing an action.
    • CMP R14,#0:TSTEQ R1,#%10000:BNE FinishReadKey ; SPACE ; ;
    • If that is the case, the code continues, or branches of to .FinishReadKey.
    • Several things can happen: block breaks, electric fence is activated, or the block is pushed.
  • This routine is copied and slightly adjusted for the four directions Pengo can move.
  • I didn’t figure out yet, how a block’s rule come into play at this point

Game Loop

  • Initiated at the label .Loooop at line 74, which then branches of into .MainGameand .MainGame1

Python

  • All the python files that make up the game have 3233 lines of code together.

Input Flow

  • Input control is provided by pygame via pygame.joystick.Joystick(0) which can be a joystick or d-pad (or simulated d-pad)
  • Directions are checked from lines 809-835.
  • Inputs, like directions or specific keys, are managed in an instance of the Key class from constants.py

Game Loop

  • Initiated through while running on line 776, which checks then all the states the game is in and acts accordingly in one single loop