Rocket Pong

Easy68k is an IDE made to make programming in assembly a little bit more comprehendible.

I won’t include all the files of course, but here what the main function read (a very small portion of the code base, but it gives you an overall view of the program’s logic):

*-----------------------------------------------------------
* Title      : Rocket Pong
* Written by : R Mike Livingston
* Date       : 10/10/22            
* Description: Each script has a paragraph or so explaining their
*               functions, and the over-all flow below should be easy
*               to read. All the same:
*               The main focus of this game is the unique way in which
*               the "ball" of rocket pong moves. It constantly changes
*               directions every time it bounces off of a surface,
*               making fielding it more challenging. So in addition
*               to tracking movement and acceleration, the game tracks
*               gradual changes to acceleration.
*-----------------------------------------------------------
ALL_REG                 REG     D0-D7/A0-A6
    org    $4
    
    INCLUDE     "BMPDisplay/MAINBmpDisplay.X68"
    INCLUDE     "SevenSegmentLED.x68"
    INCLUDE     "InputReceiver.x68"
    INCLUDE     "BallController.x68"
    INCLUDE     "RandomNumberGenerator.x68"
    INCLUDE     "FXController.x68"
    
    ORG    $1500
START:                  ; first instruction of program
    *Set double buffer mode
    move.l          #92,d0
    move.l          #17,d1
    trap            #15
    ;.........................................READ FILE
    JSR         InitialBMPRun 
    ;.........................................LOAD BACKGROUND
    jsr         SetInputsForFullBackground
    
    *display to buffer
    move.l      #94,d0
    trap        #15
    
    JSR         SetUpForMainLoopDrawImage
    jsr         InitializeBothScoreboards

    
    *display to buffer
    move.l      #94,d0
    trap        #15
    
    *first time-get
    move.l          #E_TimeSinceMidnite,d0
    trap            #15
    lea             LastFrameTime,a1
    move.l          d1,(a1)
    
    *seed random num generator
    jsr     seedRandomNumber
    
Loop
    *get time since last frame (d1)
    jsr             UpdateFrameState
    
    *draw bg over blockers
    jsr             SetPenBlack
    jsr             DrawRightBlocker
    jsr             DrawLeftBlocker
    
    *draw bg over ship
    jsr             DrawBGAtRocket
    
    *check button presses, adjust intended blocker locations
    jsr             CheckButtonPresses
    
    *draw blockers
    jsr             SetPenOffWhite
    jsr             DrawRightBlocker
    jsr             DrawLeftBlocker
    
    *calculate new ship pos/collision check
    jsr             CalcNewBallPos
    
    *draw ship
    jsr             SetInputsForRocket1
    jsr             SetUpForMainLoopDrawImage
    
    *Possibly clear fx
    jsr             CheckOnDrawHitFX
    
    
    *display to buffer
    move.l      #94,d0
    trap        #15
    
    bra             Loop
    
GameEndedLoop
        *display to buffer
    move.l      #94,d0
    trap        #15
    bra             GameEndedLoop

* Put program code here
EndProgram
    SIMHALT             ; halt simulator

* Put variables and constants here

    END    START        ; last line of source

To play, install easy68k, download this file, and open the file named “RocketPong.X68”. The project is available for download here: https://drive.google.com/file/d/1nsjMh26tIK51-0F_rugNRT01amPLiilQ/view?usp=sharing

Leave a comment

Design a site like this with WordPress.com
Get started