Jump to content


River Raid Ending?

81 replies to this topic

#76 davyK OFFLINE  



  • 427 posts
  • Location:Northern Ireland

Posted Sun Jul 16, 2017 1:09 PM

hmmmm....lots of NOPs dealing with screensaver mode. But looking even at the game select code that takes advantage of 2 variations it might be better (certainly easier!) to use the colour/bw switch to enable a random seed.

Edited by davyK, Sun Jul 16, 2017 1:25 PM.

#77 Lord Tom OFFLINE  

Lord Tom

    Combat Commando

  • 4 posts

Posted Sun Jul 16, 2017 6:30 PM

BTW, thanks so much to Thomas J for your disassembly! River Raid was (along with Pitfall II) one of the first games I played over and over as a kid, and getting to see how its source code works so many years later was a huge treat. I don't think I would have even attempted my simulator/bot project without the insights reading your comments provided.

#78 davyK OFFLINE  



  • 427 posts
  • Location:Northern Ireland

Posted Wed Jul 19, 2017 11:31 AM

So I got some time to look at this. Had to butcher the screen saver code to find the room for my bloated coding   :)


This section lets the user select a 3rd variation:

       LSR                      ; 2
       BCS    .noSelect         ; 2
       DEC    gameDelay         ; 5             SELECT was pressed
       BPL    .skipSelect       ; 2
       LDA    gameVariation     ; 3             increment game variation (1-3)
       ADC    #$01              ; ?
       CMP    #$03              ; ?
       BNE    .gPlus1           ; 2
       LDA    #$00
       STA    gameVariation     ; 3?
;       STA    player            ; 3
       ASL                      ; 2
       ASL                      ; 2
       ASL                      ; 2
       ADC    #DIGIT_H          ; 2
       JSR    SetScorePtrs      ; 6
       JSR    FinishGame        ; 6
       LDY    #$1E              ; 2
       STY    gameDelay         ; 3

And this is the change I made when the user presses reset to reseed (I don't think the first section will change since that is already generated from the original hard-coded seed selected by Activision?)   :

; *** check switches: ***
       LDA    SWCHB             ; 4
       LSR                      ; 2
       BCS    .noReset          ; 2
       LDA    gameVariation     ; 3             RESET was pressed
       CMP    #$02              ; ?
       BNE    .normalMode       ; 2
       LDA    #$45             ; ?             random seed changed
       STA    SEED_HI           ; 3
       LDA    #$00              ; 3
       STA    gameVariation     ; 3
       STA    player            ; 3
       LDX    #$F7              ; 2
       JMP    Reset             ; 3

I've hard-coded a new seed just to experiment but 2 questions:


1. Do I need to change both bytes SEED_Hi and LO?

2. Can I use something like INTIM to get a random seed? I know this could result in a unoptimal sequence but I like the "lucky dip" aspect of doing it this way.


I ask this because this is up and running but I don't see a big change in the river (though I am not overly familiar with this game).


Just noticed batari has already done a similar thing (far nicer job) but I'd like to complete this for my own development. 

Edited by davyK, Wed Jul 19, 2017 11:56 AM.

#79 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

  • 23,538 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Wed Jul 19, 2017 12:35 PM

A random seed may be outside the original sequence, because that covers only 57337 of the 65535 possible screens. And if its outside the sequence, then only about 8000 (or even way! less) screens before repeating are there. Better would be to call the random number generator multiple, random times (e.g. 1000 times) to create a new seed. Then you are sure the seed is in the original sequence.


And yes, you can use INTIM. Either for the seed (changing only one byte is OK) or e.g. multiplied with 128 for the number of random number generator calls.

Edited by Thomas Jentzsch, Wed Jul 19, 2017 12:36 PM.

#80 davyK OFFLINE  



  • 427 posts
  • Location:Northern Ireland

Posted Wed Jul 19, 2017 2:04 PM

Good idea to multi-call the RND code a number of times to stay "on the path". I could have x = INTIM*128  and call the RND code x times? I have plenty of bytes to implement that. Reckon I could do a 2 player mode as well.  Thanks for the fast response.

Edited by davyK, Wed Jul 19, 2017 2:05 PM.

#81 Atari-Collector OFFLINE  



  • 274 posts
  • Location:Ridgetown, Ontario, Canada

Posted Wed Jul 19, 2017 3:46 PM

I never get far enough to worry about there being an end to the game...

#82 accousticguitar OFFLINE  



  • 6,941 posts
  • Sherlock made it to 15 before he left us.
  • Location:Idaho

Posted Wed Jul 19, 2017 6:35 PM

I never get far enough to worry about there being an end to the game...

Same here.  :-D

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users