(Called when lifting or destroying bushes, rocks, grass squares, signs, pots, big square blocks, or rock piles.) 06/8161: 48 PHA (preserve type of object we're lifting or destroying) 06/8162: A9 0A LDA #$0A 06/8164: 9D D0 0D STA $0DD0,X 06/8167: A9 EC LDA #$EC 06/8169: 9D 20 0E STA $0E20,X 06/816C: A5 00 LDA $00 06/816E: 9D 10 0D STA $0D10,X 06/8171: A5 01 LDA $01 06/8173: 9D 30 0D STA $0D30,X 06/8176: A5 02 LDA $02 06/8178: 9D 00 0D STA $0D00,X 06/817B: A5 03 LDA $03 06/817D: 9D 20 0D STA $0D20,X 06/8180: 22 18 B8 0D JSR $0DB818 06/8184: A5 EE LDA $EE 06/8186: 9D 20 0F STA $0F20,X 06/8189: 68 PLA 06/818A: 9D B0 0D STA $0DB0,X (save type of object we're lifting or destroying) 06/818D: C9 06 CMP #$06 06/818F: 90 07 BCC $8198 (branch if it's not a big light gray or dark gray rock, a big gray square block, or a rock pile) 06/8191: 48 PHA 06/8192: A9 A6 LDA #$A6 06/8194: 9D 40 0E STA $0E40,X 06/8197: 68 PLA 06/8198: C9 02 CMP #$02 06/819A: D0 09 BNE $81A5 (branch if object isn't a normal green or purple bush or a pot [they use the same ID]) 06/819C: A5 1B LDA $1B 06/819E: F0 05 BEQ $81A5 (branch if we're outdoors, meaning it's a bush) 06/81A0: A9 80 LDA #$80 06/81A2: 9D 50 0F STA $0F50,X 06/81A5: 8B PHB 06/81A6: 4B PHK 06/81A7: AB PLB 06/81A8: A8 TAY 06/81A9: B9 CA AA LDA $AACA,Y 06/81AC: 9D 50 0F STA $0F50,X 06/81AF: A9 09 LDA #$09 06/81B1: 9F 2C FA 7F STA $7FFA2C,X 06/81B5: A9 02 LDA #$02 06/81B7: 8D 14 03 STA $0314 06/81BA: 8D B2 0F STA $0FB2 06/81BD: A9 10 LDA #$10 06/81BF: 9D F0 0D STA $0DF0,X 06/81C2: A5 EE LDA $EE 06/81C4: 9D 20 0F STA $0F20,X 06/81C7: 9E C0 0D STZ $0DC0,X 06/81CA: AD 9C 0B LDA $0B9C 06/81CD: C9 FF CMP #$FF 06/81CF: F0 21 BEQ $81F2 (branch if FFh is the ID assigned to under the object. dunno when this is the case.) 06/81D1: 05 1B ORA $1B (holds 0 for outdoors, 1 for indoors) 06/81D3: D0 0D BNE $81E2 (branch if we're indoors, and/or have a nonzero item ID) 06/81D5: BD B0 0D LDA $0DB0,X (type of the object being lifted/destroyed) 06/81D8: 3A DEC 06/81D9: 3A DEC 06/81DA: C9 02 CMP #$02 06/81DC: B0 04 BCS $81E2 (branch if it's not a grass square or a purple or normal green [as opposed to brownish green] bush) 06/81DE: 22 DB FB 1A JSR $1AFBDB ("randomly" choose an ID for what's under the bush/grass, as there was no specific entity assigned to it) 06/81E2: AD 9C 0B LDA $0B9C 06/81E5: 10 08 BPL $81EF (branch if the object isn't covering something special, like an entrance?) 06/81E7: 29 7F AND #$7F 06/81E9: 9D C0 0D STA $0DC0,X (save the type of entrance?) 06/81EC: 9C 9C 0B STZ $0B9C (zero the item ID) 06/81EF: 20 64 82 JSR $8264 (determine the actual sprite based on our item ID) 06/81F2: AB PLB 06/81F3: 6B RTL (List of possible sprites found under bushes, grass squares, pots, signs, rocks, and rock piles. Note that when nothing is under grass or a bush [or when Item 00-Nothing is literally assigned to it], the game might randomly pick something using function 1A/FBDB instead.) 06/81F3: 6B (Just an RTL; not data. Consider it a placeholder for position #0.) 06/81F4: D9 (Green Rupee) 06/81F5: 3E (Rock Spider/Beetle/Crab/Hoarder) 06/81F6: 79 (Bee) 06/81F7: D9 (Green Rupee. Unused, because 04 represents Random, a special case which will pick between 06/8206, 8207, 8208, and 8209.) 06/81F8: DC (Bomb x 1) 06/81F9: D8 (Heart) 06/81FA: DA (Blue Rupee) 06/81FB: E4 (Key) 06/81FC: E1 (Arrow x 5) 06/81FD: DC (Bomb x 1) 06/81FE: D8 (Heart) 06/81FF: DF (Partial Magic refill) 06/8200: E0 (Full Magic refill) 06/8201: 0B (Cucco/Chicken) 06/8202: 42 (Green Soldier with Sword) 06/8203: D3 (Stal / Awakening Skull Rock) 06/8204: 41 (Blue Soldier with Sword [LW] or Blue Helmeted Bull with Poker [DW]) 06/8205: D4 (Ground Bomb aka Land Mine) 06/8206: D9 (Green Rupee) 06/8207: E3 (Faerie/Fairy) 06/8208: D8 (Heart) 06/8209: 00 (Nothing) 06/820A: 00 06/820B: 01 06/820C: 01 06/820D: 00 06/820E: 00 06/820F: 00 06/8210: 00 ----------------------------- 06/8262: 18 CLC 06/8263: 60 RTS (Convert the Item ID to a Sprite ID, but return nothing 1/2 the time. Also, do various things to prepare the sprite.) 06/8264: A5 1B LDA $1B 06/8266: D0 08 BNE $8270 (branch if indoors) 06/8268: 22 71 BA 0D JSR $0DBA71 (get a random #) 06/826C: 29 08 AND #$08 (is bit 3 set?) 06/826E: D0 F2 BNE $8262 (exit 1/2 the time, yielding nothing) 06/8270: AC 9C 0B LDY $0B9C 06/8273: F0 ED BEQ $8262 (exit if the ID under the bush/grass/pot/ sign/rock/rock pile is 00-Nothing) 06/8275: C0 04 CPY #$04 (is the ID under the lifted/destroyed object 04-Random?) 06/8277: D0 0A BNE $8283 (branch if not) 06/8279: 22 71 BA 0D JSR $0DBA71 (get a random #) 06/827D: 29 03 AND #$03 (make it [0..3]) 06/827F: 18 CLC 06/8280: 69 13 ADC #$13 (make the ID [13h..16h]) 06/8282: A8 TAY 06/8283: 84 0D STY $0D 06/8285: B9 F3 81 LDA $81F3,Y (get the sprite based on our ID) 06/8288: F0 D8 BEQ $8262 (exit if it's zero [nothing]) 06/828A: 22 5D F6 1D JSR $1DF65D 06/828E: 30 D2 BMI $8262 06/8290: DA PHX 06/8291: A6 0D LDX $0D 06/8293: BD 09 82 LDA $8209,X 06/8296: 99 80 0D STA $0D80,Y 06/8299: BD 35 82 LDA $8235,X 06/829C: 99 A0 0B STA $0BA0,Y 06/829F: BD 4B 82 LDA $824B,X 06/82A2: 99 80 0F STA $0F80,Y 06/82A5: A5 00 LDA $00 06/82A7: 18 CLC 06/82A8: 7D 1F 82 ADC $821F,X 06/82AB: 99 10 0D STA $0D10,Y 06/82AE: A5 01 LDA $01 06/82B0: 69 00 ADC #$00 06/82B2: 99 30 0D STA $0D30,Y 06/82B5: A5 02 LDA $02 06/82B7: 99 00 0D STA $0D00,Y 06/82BA: A5 03 LDA $03 06/82BC: 99 20 0D STA $0D20,Y 06/82BF: A5 04 LDA $04 06/82C1: 99 70 0F STA $0F70,Y 06/82C4: A9 00 LDA #$00 06/82C6: 99 C0 0D STA $0DC0,Y 06/82C9: A9 20 LDA #$20 06/82CB: 99 10 0F STA $0F10,Y 06/82CE: A9 30 LDA #$30 06/82D0: 99 10 0E STA $0E10,Y 06/82D3: BE 20 0E LDX $0E20,Y 06/82D6: E0 E4 CPX #$E4 (is the sprite a Key?) 06/82D8: D0 06 BNE $82E0 (branch if not) 06/82DA: DA PHX 06/82DB: BB TYX 06/82DC: 20 62 92 JSR $9262 06/82DF: FA PLX 06/82E0: E0 0B CPX #$0B (is it a Chicken/Cucco?) 06/82E2: D0 0F BNE $82F3 (branch if not) 06/82E4: A9 30 LDA #$30 06/82E6: 8D 2E 01 STA $012E 06/82E9: AD 8E 04 LDA $048E 06/82EC: C9 01 CMP #$01 06/82EE: D0 03 BNE $82F3 06/82F0: 99 30 0E STA $0E30,Y 06/82F3: E0 42 CPX #$42 (is it a Green soldier carrying sword?) 06/82F5: F0 0F BEQ $8306 (branch if so) 06/82F7: E0 41 CPX #$41 (is it a Blue helmeted bull carrying poker?) 06/82F9: F0 0B BEQ $8306 (branch if so) 06/82FB: E0 3E CPX #$3E (is it a Rock Spider/Beetle/Crab/ Hoarder?) 06/82FD: D0 18 BNE $8317 (branch if not) 06/82FF: A9 09 LDA #$09 06/8301: 99 50 0F STA $0F50,Y 06/8304: 80 1F BRA $8325 06/8306: A9 04 LDA #$04 06/8308: 8D 2F 01 STA $012F 06/830B: A9 00 LDA #$00 06/830D: 99 E2 0C STA $0CE2,Y 06/8310: A9 A0 LDA #$A0 06/8312: 99 F0 0E STA $0EF0,Y 06/8315: 80 05 BRA $831C (...BRA $8325?) 06/8317: A9 FF LDA #$FF 06/8319: 99 58 0B STA $0B58,Y 06/831C: E0 79 CPX #$79 (is it a Bee?) 06/831E: D0 05 BNE $8325 (branch if not) 06/8320: A9 20 LDA #$20 06/8322: 99 90 0D STA $0D90,Y 06/8325: 38 SEC 06/8326: FA PLX 06/8327: 60 RTS ------------------------------------------------------------------------ (List of bush/grass prize bitmasks for the overworld map. The world is like an 8x8 grid. Position 00h corresponds to the top left square, and Position 3Fh corresponds to the bottom right. So the index advances as we move left to right, and up to down -- like reading a book. Note that with a large 2x2 screen, one Position will take the place of 4 positions. So for example, the Mysterious Woods / Skeleton Forest is all indexed with Position 00h, rather than with 00h, 01h, 08h, and 09h. Fortunately, the data here is repeated between those "encompassed" positions anyway in MOST cases.) When a bit is enabled here, it can prevent you from randomly getting a certain prize from grass/bushes that are found on the corresponding map square and have nothing specific assigned to them. This data is reused between the Light World and Dark World, but WHICH prizes, if any, this data disables does depend on whether we're in the Light World or Dark World. A prize entry in 1A/FBBB (Light World) or 1A/FBC3 (Dark World) will only be disabled if the corresponding entry in 1A/FBCB (LW) or 1A/FBD3 (DW) has a bit set AND the map square in this data has the same bit set.) (I have no idea why many of the entries have Bit 2 set, as that bit is not set in the 1A/FBCB or 1A/FBD3 structures.) 1A/FB7B: 00 (Mysterious Woods / Skeleton Forest) 1A/FB7C: 00 (see position 00h - FB7B) 1A/FB7D: 00 (Area with Lumberjack's House / Goods Shop) 1A/FB7E: 00 (Death Mountain West) 1A/FB7F: 00 (see position 03h - FB7E) 1A/FB80: 00 (Death Mountain Central) 1A/FB81: 00 (see position 05h - FB80) 1A/FB82: 04 (Death Mountain East) --- 1A/FB83: 00 (see position 00h - FB7B) 1A/FB84: 00 (see position 00h - FB7B) 1A/FB85: 00 (Area with cave to Death Mountain / cave to Heart Piece) 1A/FB86: 00 (see position 03h - FB7E) 1A/FB87: 00 (see position 03h - FB7E) 1A/FB88: 00 (see position 05h - FB80) 1A/FB89: 00 (see position 05h - FB80) 1A/FB8A: 00 (Area with Waterfall of Wishing / Lake of Ill Omen [has catfish]) --- 1A/FB8B: 04 (Wooded area south of forest and north of village) 1A/FB8C: 04 (Area with fortune teller's hut south of forest) 1A/FB8D: 06 (Area with little lake west of Sanctuary / Storyteller) 1A/FB8E: 04 (Area with Sanctuary / Storyteller and red trees) 1A/FB8F: 04 (Graveyard [aka Cemetary] / area with rock clusters and statues) 1A/FB90: 06 (East of graveyard / rock and statue area, west of Magic Hut / Goods Shop, at bend in river) 1A/FB91: 00 (Area with Witch and Magic Hut / Goods Shop) 1A/FB92: 00 (Area east of Witch and Magic Hut / Goods Shop) --- 1A/FB93: 0F (Kakariko Village / Village of Outcasts) 1A/FB94: 0F (see position 18h - FB93) 1A/FB95: 04 (Wooded area west of Hyrule Castle / wooded area west of Pyramid of Power with shop that sells red shield) 1A/FB96: 05 (Hyrule castle / Pyramid of Power) 1A/FB97: 05 (see position 1Bh - FB96) 1A/FB98: 04 (Area with bridge northeast of Hyrule Castle / area with broken bridge northeast of Pyramid of Power) 1A/FB99: 06 (Outside of Eastern Palace / Palace of Darkness) 1A/FB9A: 06 (see position 1Eh - FB99) --- 1A/FB9B: 0F (see position 18h - FB93) 1A/FB9C: 0F (see position 18h - FB93) 1A/FB9D: 04 (Area with Blacksmiths' cottage / wrecked house with locked chest) 1A/FB9E: 05 (see position 1Bh - FB96) 1A/FB9F: 05 (see position 1Bh - FB96) 1A/FBA0: 07 (Area with large mounds east of Hyrule Castle / Pyramid of Power) 1A/FBA1: 06 (see position 1Eh - FB99) 1A/FBA2: 06 (see position 1Eh - FB99) --- 1A/FBA3: 1F (Area with heart piece timed maze / Digging Game) 1A/FBA4: 1F (Area with Library and Chest Game / Smithy's Partner and Archery Game) 1A/FBA5: 04 (Haunted Grove) 1A/FBA6: 07 (Area west of Link's House / Bomb Shop) 1A/FBA7: 07 (Area with Link's House / Bomb Shop) 1A/FBA8: 04 (Area east of Link's House / Bomb Shop and north of Lake Hylia) 1A/FBA9: 06 (Area south of Eastern Palace / Palace of Darkness, bordering river, has Faerie Cave) 1A/FBAA: 06 (Area south of Eastern Palace / Palace of Darkness, further east, has 12 stakes forming octagon or square) --- 1A/FBAB: 06 (Desert of Mystery / Misery Mire) 1A/FBAC: 07 (see position 30h - FBAB, but no idea why this doesn't match) 1A/FBAD: 02 (Area south of Haunted Grove, has bushes in arrow) 1A/FBAE: 00 (Swamp land, northwest quadrant) 1A/FBAF: 00 (Swamp land, northeast quadrant) 1A/FBB0: 00 (Lake Hylia) 1A/FBB1: 00 (see position 35h - FBB0) 1A/FBB2: 00 (Area northeast of Lake Hylia, has three caves) --- 1A/FBB3: 06 (see position 30h - FBAB) 1A/FBB4: 06 (see position 30h - FBAB) 1A/FBB5: 02 (Area east of Desert of Mystery / Misery Mire, has guy with sign in LW) 1A/FBB6: 00 (Swamp land, southwest quadrant) 1A/FBB7: 00 (Part Swamp land southeast quadrant, part dry land) 1A/FBB8: 00 (see position 35h - FBB0) 1A/FBB9: 00 (see position 35h - FBB0) 1A/FBBA: 00 (Area southeast of Lake Hylia) ("Prize packs" for each world. One of the following can be randomly picked for a bush or grass square when nothing specific is assigned to it. The values are indexes into the sprite list at 06/81F3.) (Light World) 1A/FBBB: 01 (Green Rupee) 1A/FBBC: 01 (Green Rupee) 1A/FBBD: 01 (Green Rupee) 1A/FBBE: 01 (Green Rupee) 1A/FBBF: 0F (Green Soldier with Sword) 1A/FBC0: 01 (Green Rupee) 1A/FBC1: 01 (Green Rupee) 1A/FBC2: 12 (Ground Bomb) (Dark World) 1A/FBC3: 10 (Stal / Awakening Skull Rock) 1A/FBC4: 01 (Green Rupee) 1A/FBC5: 01 (Green Rupee) 1A/FBC6: 01 (Green Rupee) 1A/FBC7: 11 (Blue Helmeted Bull with Poker) 1A/FBC8: 01 (Green Rupee) 1A/FBC9: 01 (Green Rupee) 1A/FBCA: 03 (Bee) (Prevention Flags - When the value below is nonzero AND the matching bit is set in a region's 1A/FB7B map data, this will prevent the corresponding entity in 1A/FBBB from randomly turning up in that region's bushes and grass.) (As you can see, green rupees and the bee aren't disable-able here. Also, tables $FBCB and $FBD3 don't use any of the same map bits. This allows the designers to turn on bits in the map data to prohibit items in one world without jeopardizing items in the other world, and to maintain this independence without having to duplicate the 64-byte 1A/FB7B bitmask data.) (Light World) 1A/FBCB: 00 1A/FBCC: 00 1A/FBCD: 00 1A/FBCE: 00 1A/FBCF: 02 (Bit 1 - disables Green Soldier with Sword) 1A/FBD0: 00 1A/FBD1: 00 1A/FBD2: 08 (Bit 3 - disables Ground Bomb) (Dark World) 1A/FBD3: 10 (Bit 4 - disables Awakening Skull Rock) 1A/FBD4: 00 1A/FBD5: 00 1A/FBD6: 00 1A/FBD7: 01 (Bit 0 - disables Blue Helmeted Bull with Poker) 1A/FBD8: 00 1A/FBD9: 00 1A/FBDA: 00 ------------------------------- ("Randomly" choose an ID for what's under a bush or square of grass, as there was no specific entity assigned to it) 1A/FBDB: 8B PHB 1A/FBDC: 4B PHK 1A/FBDD: AB PLB 1A/FBDE: 22 71 BA 0D JSR $0DBA71 (get a random #) 1A/FBE2: 29 01 AND #$01 (is bit 0 set?) 1A/FBE4: D0 49 BNE $FC2F (exit [and yield nothing] 1/2 the time) 1A/FBE6: 64 0D STZ $0D (zero out a temporary counter) 1A/FBE8: A0 0F LDY #$0F 1A/FBEA: B9 D0 0D LDA $0DD0,Y 1A/FBED: F0 09 BEQ $FBF8 1A/FBEF: B9 20 0E LDA $0E20,Y (check the sprite/enemy in this slot) 1A/FBF2: C9 6C CMP #$6C (is it 6Ch [whatever that is]?) 1A/FBF4: F0 02 BEQ $FBF8 (branch if so) 1A/FBF6: E6 0D INC $0D (if it isn't, increment our counter) 1A/FBF8: 88 DEY 1A/FBF9: 10 EF BPL $FBEA (iterate 16 times) 1A/FBFB: A5 0D LDA $0D 1A/FBFD: C9 04 CMP #$04 1A/FBFF: B0 2E BCS $FC2F (branch if our counter >= 4. the purpose seems to be to not produce a prize from the grass/bush if there are already a bunch of sprites onscreen, avoiding crowding.) 1A/FC01: AF C5 F3 7E LDA $7EF3C5 (get our current Phase of the game) 1A/FC05: C9 02 CMP #$02 1A/FC07: 90 26 BCC $FC2F (branch if we're not at least in Phase 2 [i.e. we haven't brought Princess Zelda to the Sanctuary yet]) 1A/FC09: AD F7 0C LDA $0CF7 (load our grass/bush prize counter. it's used to iterate through the prizes in 1A/FBBB in the Light World, and 1A/FBC3 in the Dark World.) (reinitialized to zero after a reset or powerdown, but can be temporarily retained and copied between files with Save and Quit, then reload) 1A/FC0C: EE F7 0C INC $0CF7 (point to the next prize) 1A/FC0F: 29 07 AND #$07 (trim the counter so it's 0-7) 1A/FC11: AC FF 0F LDY $0FFF (0 for Light World, 1 for Dark) 1A/FC14: F0 02 BEQ $FC18 (branch if Light World) 1A/FC16: 09 08 ORA #$08 (turn on bit 3 of our index, so as to use tables $FBC3 and $FBD3 rather than $FBBB and $FBCB.) 1A/FC18: A8 TAY 1A/FC19: DA PHX 1A/FC1A: AD 0A 04 LDA $040A (get our current location index. the 0-63 map square # is held in bits 0-5, the World is held in bit 6 [0 = Light, 1 = Dark], and some values for 80h and up are used for special screens not part of the normal world maps.) 1A/FC1D: 29 3F AND #$3F (isolate the square # in bits 0-5. the problem here is that bit 7 is knocked off without being checked, so the special screens will quietly use the bush/grass prize bitmask data of an unrelated normal map screen. for example, screen 81h, Zora's Waterfall, will use the data for screen 01h [which is a duplicate of the Screen 00h, Mysterious Woods, data]. the Woods allows all the random sprites in the 1A/FBBB list to show up under its bushes, so we can also encounter all these sprites in the Zora area. that includes the Green Soldier with Sword, which the Zora screen lacks the tilesets to properly display.. so you'll get some crazy amalgamation of sprites charging after Link. we should arguably be branching to 1A/FC2E to skip the prize/sprite assignment if Bit 7 is set.) 1A/FC1F: AA TAX 1A/FC20: BD 7B FB LDA $FB7B,X (get bush/grass prize bitmask for this region of the map. note that unlike with $FBBB and $FBCB, the same data is used for the Light and Dark Worlds.) 1A/FC23: 39 CB FB AND $FBCB,Y (is the prize entry that's pointed to by our grass/bush prize counter disable-able, and is it disabled on this section of the map?) 1A/FC26: D0 06 BNE $FC2E (branch if both are the case, so we'll get nothing.) 1A/FC28: B9 BB FB LDA $FBBB,Y (otherwise, load our prize index) 1A/FC2B: 8D 9C 0B STA $0B9C (...and save it.) 1A/FC2E: FA PLX 1A/FC2F: AB PLB 1A/FC30: 6B RTL