Chip 'n Dale Rescue Rangers/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
No edit summary
No edit summary
Line 91: Line 91:
  8F3D: BNE $8F55
  8F3D: BNE $8F55


Phase 0:
Phase 0:
  8F3F: LDA #$33
  8F3F: LDA #$33
  8F41: STA $0530,X
  8F41: STA $0530,X
  8F44: LDA #$01
  8F44: LDA #$01
  8F46: STA $0540,X
  8F46: STA $0540,X ; Set x-speed to ~1.2 pixels/frame
  8F49: JSR $F328
  8F49: JSR $F328
  8F4C: LDA #$1E
  8F4C: LDA #$1E
  8F4E: STA $0490,X ; Set counter for 30 frames
  8F4E: STA $0490,X ; Set counter to 30 frames
  8F51: INC $04D0,X ; Advance to Phase 1
  8F51: INC $04D0,X ; Advance to Phase 1


Line 107: Line 107:
  8F5A: BNE $8F71
  8F5A: BNE $8F71


Phase 1:
Phase 1:
  8F5C: DEC $0490,X ; Tick down timer
  8F5C: DEC $0490,X ; Tick down timer
  8F5F: BNE $8F54  ; End if timer not at zero
  8F5F: BNE $8F54  ; End if timer not at zero
Line 114: Line 114:
  8F63: STA $0420,X ; Switch to walking animation
  8F63: STA $0420,X ; Switch to walking animation
  8F66: LDA #$00
  8F66: LDA #$00
  8F68: STA $0430,X
  8F68: STA $0430,X  
  8F6B: STA $0410,X
  8F6B: STA $0410,X ; Go to beginning of animation
  8F6E: INC $04D0,X ; Advance to Phase 2
  8F6E: INC $04D0,X ; Advance to Phase 2


Phase 2:
Phase 2:
  8F71: LDA $95
  8F71: LDA $95
  8F73: AND #$0F
  8F73: AND #$0F
Line 149: Line 149:
  8FA1: BCC $8FC0
  8FA1: BCC $8FC0


  8FA3: INC $0480,X
  8FA3: INC $0480,X ; Tick up jump counter
  8FA6: LDA $0480,X
  8FA6: LDA $0480,X
  8FA9: CMP #$04
  8FA9: CMP #$04   ; After 3 jump attempts in a row,
  8FAB: BEQ $8FB8
  8FAB: BEQ $8FB8   ;  turn around instead


Jump:
  8FAD: LDA #$9E
  8FAD: LDA #$9E
  8FAF: STA $0550,X
  8FAF: STA $0550,X
  8FB2: LDA #$04
  8FB2: LDA #$04
  8FB4: STA $0560,X
  8FB4: STA $0560,X ; Set y-speed to ~4.6 pixels/frame
  8FB7: RTS
  8FB7: RTS


Turn Around:
  8FB8: LDA $0580,X
  8FB8: LDA $0580,X
  8FBB: EOR #$03
  8FBB: EOR #$03
  8FBD: STA $0580,X
  8FBD: STA $0580,X
 
Reset jump counter:
  8FC0: LDA #$00
  8FC0: LDA #$00
  8FC2: STA $0480,X
  8FC2: STA $0480,X


  8FC5: RTS
  8FC5: RTS

Revision as of 15:55, 31 May 2019

PRG

Page 06

Function 06:8000

Cycles through & executes the action script for each non-player object.

8000: LDX #$02
8002: STX $4D     ; Set current object to 02 (skipping over Chip/Dale)
8004: LDA $04D0,X
8007: BPL $8082   ; Skip slot if unoccupied (if status flag 80 is not set)
8009: LDY $04E0,X ; 
800C: LDA $80A7,Y
800F: STA $00
8011: LDA $810C,Y
8014: STA $01     ; Retrieve address of object's action script from pointer table
8016: LDA #$80
8018: PHA
8019: LDA #$1E
801B: PHA         ; Set return address
801C: JMP ($00)   ; Execute action script
801F: LDA $0570,X
8022: AND #$40    
8024: BEQ $8029   ; Skip ahead if object can't be damaged
8026: JSR $8E15   ; Check for collision damage against enemy
8029: LDA $04D0,X
802C: AND #$40
802E: BEQ $8082   ; Skip ahead if object doesn't cause damage
8030: JSR $F92B   ; Check for collision with player
8033: BCS $8082   ; Skip ahead if no collision
8035: LDA $5E,Y   ; Check if player has i-frames
8038: BNE $8082   ; Skip ahead if so
803A: LDA $54,Y
803D: CMP #$03
803F: BCS $8082   ; Can't be damaged while picking up item
8041: LDA $0420,Y
8044: BEQ $804D
8046: LDA #$09
8048: STA $54,Y   ; Set phase to "damaged"
804B: BNE $8082   ; Jump ahead (always true)
804D: JSR $808E
8050: LDA $56,Y
8053: BPL $8082
8055: AND #$0F
8057: PHA
8058: LDA #$00
805A: STA $56,Y
805D: PLA 
805E: TAY
805F: LDA #$80
8061: STA $04D0,Y
8064: LDA #$3E
8066: STA $04E0,Y
8069: LDA #$00
806B: STA $0410,Y
806E: STA $0430,Y
8071: LDA $0420,Y
8074: CMP #$22
8076: BEQ $8082
8078: CMP #$23
807A: BEQ $8082
807C: SEC
807D: SBC #$09
807F: STA $0420,Y
8082: INC $4D     ; Tick up to next object slot
8084: LDX $4D
8086: CPX #$10
8088: BEQ $808D   ; Exit if at end of list
808A: JMP $8004   ; Repeat
808D: RTS         ; Exit function

Function 06:8F38

Action Script 02 - Robot Dog

8F38: LDA $04D0,X
8F3B: AND #$0F    ; Check current phase
8F3D: BNE $8F55

Phase 0:

8F3F: LDA #$33
8F41: STA $0530,X
8F44: LDA #$01
8F46: STA $0540,X ; Set x-speed to ~1.2 pixels/frame
8F49: JSR $F328
8F4C: LDA #$1E
8F4E: STA $0490,X ; Set counter to 30 frames
8F51: INC $04D0,X ; Advance to Phase 1
8F54: RTS         ; Exit function
8F55: LDA $04D0,X
8F58: AND #$02
8F5A: BNE $8F71

Phase 1:

8F5C: DEC $0490,X ; Tick down timer
8F5F: BNE $8F54   ; End if timer not at zero
8F61: LDA #$1C
8F63: STA $0420,X ; Switch to walking animation
8F66: LDA #$00
8F68: STA $0430,X 
8F6B: STA $0410,X ; Go to beginning of animation
8F6E: INC $04D0,X ; Advance to Phase 2

Phase 2:

8F71: LDA $95
8F73: AND #$0F
8F75: BNE $8F7C
8F77: LDA #$1A
8F79: JSR $F379
8F7C: LDY #$02
8F7E: LDA #$10
8F80: JSR $F0FB
8F83: PHP
8F84: LDY #$02
8F86: LDA $0580,X
8F89: AND #$01
8F8B: BEQ $8F95
8F8D: LDA #$0A
8F8F: JSR $F000
8F92: JMP $8F9A
8F95: LDA #$0D
8F97: JSR $F066
8F9A: PLP
8F9B: BCC $8FC5
8F9D: LDA $10
8F9F: CMP #$03
8FA1: BCC $8FC0
8FA3: INC $0480,X ; Tick up jump counter
8FA6: LDA $0480,X
8FA9: CMP #$04    ; After 3 jump attempts in a row,
8FAB: BEQ $8FB8   ;  turn around instead

Jump:

8FAD: LDA #$9E
8FAF: STA $0550,X
8FB2: LDA #$04
8FB4: STA $0560,X ; Set y-speed to ~4.6 pixels/frame
8FB7: RTS

Turn Around:

8FB8: LDA $0580,X
8FBB: EOR #$03
8FBD: STA $0580,X

Reset jump counter:

8FC0: LDA #$00
8FC2: STA $0480,X
8FC5: RTS