Jump to content
IGNORED

Space Raid source code


nanochess

Recommended Posts

Hi all.

 

Just I've released the source code to Space Raid

 

https://github.com/nanochess/Space-Raid

 

The only caveat is that all comments are in Spanish. Being my first Atari game never thought in writing commments in English, maybe someday I'll translate them.

 

I hope it's useful for someone.

 

Enjoy it! :)

  • Like 5
Link to comment
Share on other sites

That is impressive! I do suggest you use ds (declare space) and let dasm manage your RAM. With this:

;===============================================================================
; Define RAM Usage
;===============================================================================
 
    ; define a segment for variables
    ; .U means uninitialized, does not end up in ROM
        SEG.U VARS
    
    ; RAM starts at $80
        ORG $80             
 
    ; Holds 2 digit score for each player, stored as BCD (Binary Coded Decimal)
Score:          ds 2    ; stored in $80-81
    ; CODING TIP - The : is optional. However, if you remember to include the :
    ;              in all of your labels you can then easily find where
    ;              something is defined by including : in the search.
    ;              Find "Score:" will bring you here, find "Score" will locate
    ;              all places that the variable Score is used.
 
    ; Offsets into digit graphic data
DigitOnes:      ds 2    ; stored in $82-83, DigitOnes = Score, DigitOnes+1 = Score+1
DigitTens:      ds 2    ; stored in $84-85, DigitTens = Score, DigitTens+1 = Score+1
 
    ; graphic data ready to put into PF1 during display score routine
ScoreGfx:       ds 2    ; stored in $86-87
 
    ; scratch variable
Temp:           ds 1    ; stored in $88
 
    ; object X positions in $89-8D
ObjectX:        ds 5    ; player0, player1, missile0, missile1, ball
 
    ; object Y positions in $8E-92
ObjectY:        ds 5    ; player0, player1, missile0, missile1, ball

Then later on if you decided to increase the score display from 2 digits for each player to 4 you'd change the Score to this:

Score:          ds 4    ; stored in $80-83

and all other RAM usage would automatically shift by 2 bytes. I wouldn't bother with those "stored in" comments either, I just put those into Collect so people going through the tutorial would understand where in RAM everything ended up.

 

To keep an eye on how much RAM you've used just add an echo to the end of your RAM definitions. In Medieval Mayhem I allocated 4 bytes for the stack, so after the last RAM definition I added:

 

  echo "----",($00FC - *) , "bytes of RAM left"
  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...