Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

The Little Mermaid/ROM map: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


  0x8000
  0x8000
  Runs the action scripts of every object slot (other than Ariel) from lowest to highest.
  Runs the action scripts of every object slot from lowest to highest and checks for collisions each frame.
  06:8000:A5 B1    LDA $00B1  ; Check Ariel's health
  06:8000:A5 B1    LDA $00B1  ; Check Ariel's health
  06:8002:F0 3A    BEQ $803E  ; Exit if zero  
  06:8002:F0 3A    BEQ $803E  ; Exit if zero  
Line 38: Line 38:
  06:803C:D0 CA    BNE $8008
  06:803C:D0 CA    BNE $8008
  06:803E:60        RTS -----------------------------------------
  06:803E:60        RTS -----------------------------------------
Page 07 (0xC000-0xFFFF)
Location in ROM: 0x1C010-0x2000F
0xC250
Advance random number generator each frame
07:C250:A2 00    LDX #$00
07:C252:A0 04    LDY #$04
07:C254:B5 E4    LDA $E4,X
07:C256:29 02    AND #$02
07:C258:85 00    STA $0000
07:C25A:B5 E5    LDA $E5,X
07:C25C:29 02    AND #$02
07:C25E:45 00    EOR $0000 ; If 0x02 bits of 0xE4 and 0xE5
07:C260:18        CLC      ;  are the same, highest bit of
07:C261:F0 01    BEQ $C264 ;  new RNG value will be zero.
07:C263:38        SEC      ;    Otherwise, it will be one.
07:C264:76 E4    ROR $E4,X ;    Then shift all previous bits right.
07:C266:E8        INX
07:C267:88        DEY
07:C268:D0 FA    BNE $C264
07:C26A:60        RTS -----------------------------------------

Revision as of 22:15, 27 December 2018

Page 06 (0x8000-0xBFFF)

Address in ROM: 0x18010-0x1C00F

0x8000
Runs the action scripts of every object slot from lowest to highest and checks for collisions each frame.
06:8000:A5 B1     LDA $00B1   ; Check Ariel's health
06:8002:F0 3A     BEQ $803E   ; Exit if zero 
06:8004:A2 01     LDX #$01
06:8006:86 EF     STX $00EF   ; Current slot #
06:8008:A9 06     LDA #$06
06:800A:85 99     STA $0099   ; ?

06:800C:BD 00 03  LDA $0300,X 
06:800F:10 25     BPL $8036   ; Skip ahead if slot is empty
06:8011:BD A0 04  LDA $04A0,X ; Check if object is stunned
06:8014:D0 16     BNE $802C   ;  If so, skip action script

06:8016:BC 10 03  LDY $0310,X
06:8019:B9 20 85  LDA $8520,Y ; Obtain address of action script
06:801C:85 00     STA $0000   ;  from jump table located
06:801E:B9 80 85  LDA $8580,Y ;   at 0x8520,0x8580
06:8021:85 01     STA $0001
06:8023:A9 80     LDA #$80    ; Set return address
06:8025:48        PHA
06:8026:A9 2B     LDA #$2B
06:8028:48        PHA
06:8029:6C 00 00  JMP ($0000) ; Run object's action script

06:802C:E0 03     CPX #$03    ; Check if object is a bubble
06:802E:90 06     BCC $8036   ; Jump ahead if so
06:8030:20 3F 80  JSR $803F   ; Run action if object is colliding with Ariel
06:8033:20 FF 80  JSR $80FF   ; Run action if object is colliding with a bubble 

06:8036:E6 EF     INC $00EF   ; Tick up to next object slot
06:8038:A6 EF     LDX $00EF   
06:803A:E0 10     CPX #$10    ; Loop until all slots examined
06:803C:D0 CA     BNE $8008
06:803E:60        RTS -----------------------------------------

Page 07 (0xC000-0xFFFF)

Location in ROM: 0x1C010-0x2000F

0xC250
Advance random number generator each frame 
07:C250:A2 00     LDX #$00
07:C252:A0 04     LDY #$04
07:C254:B5 E4     LDA $E4,X
07:C256:29 02     AND #$02
07:C258:85 00     STA $0000
07:C25A:B5 E5     LDA $E5,X
07:C25C:29 02     AND #$02
07:C25E:45 00     EOR $0000 ; If 0x02 bits of 0xE4 and 0xE5
07:C260:18        CLC       ;  are the same, highest bit of
07:C261:F0 01     BEQ $C264 ;   new RNG value will be zero.
07:C263:38        SEC       ;    Otherwise, it will be one.
07:C264:76 E4     ROR $E4,X ;     Then shift all previous bits right.
07:C266:E8        INX
07:C267:88        DEY
07:C268:D0 FA     BNE $C264
07:C26A:60        RTS -----------------------------------------