Disney's Chip 'n Dale: Rescue Rangers:ROM map

From Data Crystal
Revision as of 02:16, 31 May 2019 by Dugongue (talk | contribs)
Jump to navigation Jump to search

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
804B: BNE $8082
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
8084: LDX $4D
8086: CPX #$10
8088: BEQ $808D
808A: JMP $8004
808D: RTS         ; Exit function