Jump to content

Photo

Pitfall!x256 (was: Pitfall!x16)

Pitfall! Hack

56 replies to this topic

#51 Cafeman OFFLINE  

Cafeman

    Quadrunner

  • 6,451 posts
  • Location:Allegheny Mountains east of the Monongahela River

Posted Sun Aug 13, 2017 2:50 PM

You can still play difficulty B and do the mapping there. A is only for the very brave. :)

 

Oh yeah, I was forgetting there is a more vanilla difficulty B! 



#52 AlwaysOnPlanetPatrol OFFLINE  

AlwaysOnPlanetPatrol

    Star Raider

  • 57 posts
  • Location:Markham. Ontario. Canada.

Posted Mon Aug 14, 2017 11:32 AM

I had thought about a spreadsheet doing the work, but then I got lazy. icon_smile.gif

 

Funny, I was thinking of doing exactly that. 

 

Are you sharing your code for your new LFSR routine?

 

BTW, this is outstanding.  I should be working now and just spent 45 minutes playing the game!  Excellent mod.

 

Someone should Mr Crane about this, I'm sure he would be impressed.  Well done!



#53 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

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

  • Topic Starter
  • 22,782 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Mon Aug 14, 2017 12:25 PM

Sure! 
 
; seeding:
    lda     gameIdx     ; selected game variation number - 1
    and     #$0f
    tay
    eor     gameIdx         
    eor     NextRndTbl,y
    eor     #%10100101 
    sta     random      
    ...

; retrieve number of random loops:
; Y = gameIdx & $0f
    lda     gameIdx
    and     #$0f
    tay
; X = iterTbl[gameIdx >> 4]
    eor     gameIdx
    lsr
    lsr
    lsr
    lsr
    tax
    lda     IterTbl,x
    tax 
    ...

; going right:
    lda     random
.loopRandom:
    lsr
    bcc     .skipEor
    eor     NextRndTbl,y
.skipEor
    dex                    
    bne     .loopRandom    
    sta     random
    ...

; going left:
    lda     NextRndTbl,y
    sec
    rol
    sta     temp
    lda     random
.loopRandom:
    asl             
    bcc     .skipEor
    eor     temp
.skipEor
    dex                  
    bne     .loopRandom  
    sta     random
    ...

NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32
Please let me know if something is missing. I am really looking forward to your mapping and hope you can detect passages.

#54 AlwaysOnPlanetPatrol OFFLINE  

AlwaysOnPlanetPatrol

    Star Raider

  • 57 posts
  • Location:Markham. Ontario. Canada.

Posted Fri Aug 18, 2017 1:12 PM

Sure! 

 
; seeding:
    lda     gameIdx     ; selected game variation number - 1
    and     #$0f
    tay
    eor     gameIdx         
    eor     NextRndTbl,y
    eor     #%10100101 
    sta     random      
    ...

; retrieve number of random loops:
; Y = gameIdx & $0f
    lda     gameIdx
    and     #$0f
    tay
; X = iterTbl[gameIdx >> 4]
    eor     gameIdx
    lsr
    lsr
    lsr
    lsr
    tax
    lda     IterTbl,x
    tax 
    ...

; going right:
    lda     random
.loopRandom:
    lsr
    bcc     .skipEor
    eor     NextRndTbl,y
.skipEor
    dex                    
    bne     .loopRandom    
    sta     random
    ...

; going left:
    lda     NextRndTbl,y
    sec
    rol
    sta     temp
    lda     random
.loopRandom:
    asl             
    bcc     .skipEor
    eor     temp
.skipEor
    dex                  
    bne     .loopRandom  
    sta     random
    ...

NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32
Please let me know if something is missing. I am really looking forward to your mapping and hope you can detect passages.

 

First, thank you for this.

 

Now I need to brush up on my assembly ;)



#55 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

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

  • Topic Starter
  • 22,782 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Sat Aug 19, 2017 2:19 AM

I can post pseudo code instead, if you prefer that.



#56 AlwaysOnPlanetPatrol OFFLINE  

AlwaysOnPlanetPatrol

    Star Raider

  • 57 posts
  • Location:Markham. Ontario. Canada.

Posted Sun Aug 20, 2017 6:29 PM

I can post pseudo code instead, if you prefer that.

 

That would save me a lot of time, thank you.  If you have it handy, that's greatly appreciated.

 

I've started building some code to decipher the scenType byte.  I used your original decompile of Pitfall! as the source.

 

My goal is to build a) a mapper for all 255 variations, b) find the shortest path to collect the 32 treasures.

 

 

Thomas, if I may, how did you figure out how to create your own LFSR?  Technically the 255 variations are the same 255 screens in different sequences from what I can tell.  I guess the possible sequences are 255! (factorial)? 

 

Again, this is brilliant.



#57 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

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

  • Topic Starter
  • 22,782 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Mon Aug 21, 2017 2:28 AM

Pseudo code:

; Notes:
;   gameIdx = selected game variation number - 1 (0..255)
;   & = bitwise AND
;   all values are 8 bit
 
; seeding:
    random = (gameIdx & $f0) XOR NextRndTbl[gameIdx & $0f] XOR %10100101
 
; retrieve number of random loops:
    loops = IterTbl[gameIdx >> 4]
 
; going right:
   for i = 1 to loops
     if ((random & 1) == 0) random = random >> 1
     else random = (random >> 1) XOR NextRndTbl[gameIdx & $0f]
 
; going left:
   xorVal = (NextRndTbl[gameIdx & $0f] << 1) + 1 ; inverse XOR value
   for i = 1 to loops
      if ((random & $80) == 0) random = random << 1
      else random = (random << 1) XOR xorVal
 
NextRndTbl
    .byte   $8e, $95, $c6, $a6, $af, $b1, $b2, $b4
    .byte   $b8, $c3, $96, $d4, $e1, $e7, $f3, $fa

IterTbl
    .byte  1,  2,  4,  7,  8, 11, 13, 14
    .byte 16, 19, 23, 26, 28, 29, 31, 32

Yes, the 255 screens are the same as in the original in difficulty B, for A I added a bit more variety. All 16 LFSR I am using generate a sequence of 255 random numbers (so called Maximum Length LFSR Sequences), so all games are 255 screens long. The code for the LFSR is pretty standard, as it is used in many games (especially homebrews).


Edited by Thomas Jentzsch, Mon Aug 21, 2017 4:07 AM.






Also tagged with one or more of these keywords: Pitfall!, Hack

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users