Jump to content

Photo

Space Raid source code


4 replies to this topic

#1 nanochess ONLINE  

nanochess

    Processorus Polyglotus

  • 5,835 posts
  • Coding something good
  • Location:Mexico City

Posted Sun Mar 4, 2018 8:00 PM

Hi all.

Just I've released the source code to Space Raid

https://github.com/n...hess/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! :)

#2 CurtisP OFFLINE  

CurtisP

    Moonsweeper

  • 260 posts

Posted Wed Mar 7, 2018 11:58 AM

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.

 

The comments are easy enough to translate. I am impressed by how detailed the comments are. 



#3 nanochess ONLINE  

nanochess

    Processorus Polyglotus

  • Topic Starter
  • 5,835 posts
  • Coding something good
  • Location:Mexico City

Posted Wed Mar 7, 2018 3:40 PM

 
The comments are easy enough to translate. I am impressed by how detailed the comments are. 


Thanks! :)

#4 SpiceWare ONLINE  

SpiceWare

    Draconian

  • 12,698 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Wed Mar 7, 2018 4:11 PM

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"


#5 nanochess ONLINE  

nanochess

    Processorus Polyglotus

  • Topic Starter
  • 5,835 posts
  • Coding something good
  • Location:Mexico City

Posted Wed Mar 7, 2018 4:24 PM

Wow! Cool! didn't knew of these facilities in dasm :)

Thanks! :thumbsup:




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users