Flying Notes and Bytes Oh My!

Discussion in 'Sega Discussion' started by Scorpion Illuminati, Nov 17, 2015.

  1. Scorpion Illuminati

    Scorpion Illuminati Scorpion Illuminati Lead Developer(Site Supporter)

    Joined:
    Oct 1, 2015
    Messages:
    25
    Likes Received:
    1
    Hi guys,

    Been having a bit of trouble converting a small bit of code to use less ram and am getting a very strange effect.

    Changing this:
    Code:
     ; ************************************
          ; initialize everything
          ; ************************************
          move.w #1, (tempo)                                                       ; initialize tempo
          move.w #note_start_position_y, (greennote_position_y)                    ; Set green note's y position
          move.w #note_start_position_y, (rednote_position_y)                      ; Set red note's y position
          move.w #note_start_position_y, (yellownote_position_y)                   ; Set yellow note's y position
          move.w #rockindicator_start_position_x, (rockindicator_position_x)       ; Set rock indicator's x position
    
          ; ******************************************************************
          ; Main game loop
          ; ******************************************************************
    GameLoop:
    
          ; green note movement code
          move.w (greennote_position_y), d0                                        ; green note y position in d0
          add.w (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @GreenNoteNotWithinBounds                                            ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @GreenNoteNotWithinBounds:
          move.w d0, (greennote_position_y)                                        ; set the green note's position normally
    
          ; red note movement code
          move.w (rednote_position_y), d0                                          ; red note y position in d0
          add.w (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @RedNoteNotWithinBounds                                              ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @RedNoteNotWithinBounds:
          move.w d0, (rednote_position_y)                                        ; set the red note's position normally
    
          ; yellow note movement code
          move.w (yellownote_position_y), d0                                       ; yellow note y position in d0
          add.w (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @YellowNoteNotWithinBounds                                           ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @YellowNoteNotWithinBounds:
          move.w d0, (yellownote_position_y)                                       ; set the yellow note's position normally
    
    To this:
    Code:
     ; ************************************
          ; initialize everything
          ; ************************************
          move.b #1, (tempo)                                                       ; initialize tempo
          move.w #note_start_position_y, (greennote_position_y)                    ; Set green note's y position
          move.w #note_start_position_y, (rednote_position_y)                      ; Set red note's y position
          move.w #note_start_position_y, (yellownote_position_y)                   ; Set yellow note's y position
          move.w #rockindicator_start_position_x, (rockindicator_position_x)       ; Set rock indicator's x position
    
          ; ******************************************************************
          ; Main game loop
          ; ******************************************************************
    GameLoop:
    
          ; green note movement code
          move.w (greennote_position_y), d0                                        ; green note y position in d0
          add.b (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @GreenNoteNotWithinBounds                                            ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @GreenNoteNotWithinBounds:
          move.w d0, (greennote_position_y)                                        ; set the green note's position normally
    
          ; red note movement code
          move.w (rednote_position_y), d0                                          ; red note y position in d0
          add.b (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @RedNoteNotWithinBounds                                              ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @RedNoteNotWithinBounds:
          move.w d0, (rednote_position_y)                                        ; set the red note's position normally
    
          ; yellow note movement code
          move.w (yellownote_position_y), d0                                       ; yellow note y position in d0
          add.b (tempo), d0                                                        ; add the tempo
          cmp.w  #(note_plane_border_offset-note_bounds_bottom), d0                ; does the player miss the note entirely
          blt @YellowNoteNotWithinBounds                                           ; branch if the player hasn't
          move.w #note_start_position_y, d0                                        ; otherwise the player has so move the note back to the top
    @YellowNoteNotWithinBounds:
          move.w d0, (yellownote_position_y)                                       ; set the yellow note's position normally
    
    Causes the notes to gain super speed for some reason. Changing just the initiation code stops it from moving. I'm very new to 68k assembly so i'm gonna chalk it up to a newbie mistake. Any assistance in this matter would be greatly appreciated.

    Sincerely,

    Scorpion Illuminati
     
  2. dutchconsolefreak

    dutchconsolefreak Peppy Member

    Joined:
    Sep 8, 2005
    Messages:
    319
    Likes Received:
    4
    Using add.b on a word sized register is only affecting the lower 8 bits. There is probably a reason the original code is using word sized parameters?
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page