The current URL is datacrystal.tcrf.net.
EarthBound Beginnings/Objects
Objects are things on the map which respond to player actions such as talking. Objects in EB0 are organized by the area of the map sector they are in. There are three banks of object data: 20010-2200F for areas 00-19, 22010-2400F for areas 1A-2A, and 24010-25DF5 for areas 2B-3F. Each bank begins with a pointer table for with one pointer for each area; these point to a second level of pointer tables (terminated with $0000) which point to the objects themselves.
Object header
The object header is 4, 6, or 8 bytes long, depending on the object type. The meaning of the first 4 bytes is always the same.
- Bytes 0-1:
- Bits 0-5: Type
- Bits 6-15: X location
- Bytes 2-3:
- Bits 0-5: Direction
- Bits 6-15: Y location
- Bytes 4-5: Sprite
- Byte 6: Present item
- Byte 7: Present ID (00-49)
- Bytes 4-5:
- Bits 0-5: Target music
- Bits 6-15: Target X location
- Bytes 6-7:
- Bits 0-5: Target direction
- Bits 6-15: Target Y location
Scripts
Some types of objects have a script after the object header. This script is executed whenever the object is interacted with. Script codes range from 00 to 6B; a list of the meanings of some script codes follows. Positions in scripts are offsets from the start of the object itself, not the script.
00 end script 01 pp unconditional jump (pp=position) 02 oo oo pp call subroutine (oo=object pointer) 03 return from subroutine 04 tt delay (tt=time) 05 ff object disappears when flag set 06 ff object appears when flag set 07 (unused, freezes game) 08 tt tt display text 09 pp ask yes/no, jump if "no" selected or B pressed 0A pp jump unless TALKing 0B pp jump unless CHECKing 0C ii pp jump unless using PSI (01=telepathy) 0D ii pp jump unless using item 0E (unused, freezes game) 0F reset NES 10 ff set flag 11 ff clear flag 12 ff pp jump unless flag set 13 cc decrease counter 14 cc increase counter 15 cc set counter to 0 16 cc nn pp jump if counter less than value 17 vv nn change map variable (1B-1E) 18 pp choose character, jump if B pressed 19 cc select specific character 1A cc pp jump unless character selected 1B pp jump if no money added to bank acct since last call 1C pp input a number, jump if B pressed 1D nn nn load a number 1E nn nn pp jump if number less than value 1F show money 20 pp choose item from inventory, jump if B pressed 21 pp choose item from closet, jump if B pressed 22 ii ii ii ii pp choose item from list, jump if B pressed 23 ii pp jump unless item in character's inventory 24 ii pp jump unless item in closet 25 ii select specific item 26 ii pp jump unless item selected 27 ii pp jump unless item in any character's inventory 28 pp give money, jump if can't hold any more 29 pp take money, jump if not enough 2A pp add to bank account, jump if can't hold any more 2B pp take from bank account, jump if not enough 2C pp jump if item unsellable 2D pp add item to inventory, jump if full 2E pp remove item from inventory, jump if not present 2F pp add item to closet, jump if full 30 pp remove item from closet, jump if not present 31 nn pp select character's nn'th item (first is 0), jump if empty slot 32 nn multiply number by nn/100 33 cc pp jump if character not present 35 pp jump unless touching object 37 tt tt p1 p2 show 2-option menu, jump to p1 if second option selected or jump to p2 if B selected 38 pp jump if no items in inventory 39 pp jump if no items in closet 3A nn pp select nn'th character in party (first is 0), jump if not present 3B tt change object type (tt=type) e.g. 26=run away 3D xx xx yy yy teleport player 3E mm mm move object (mm=pointer to movement data, after script) 3F oo signal another object (oo=object number) 40 pp jump unless signaled 41 teleport to saved game location 42 cc pp add character to party, jump if party full 43 cc pp remove character from party, jump if absent 44 gg start battle (gg=enemy group) 45 multiply by number of characters 46 dd rocket (dd=direction) 47 dd airplane 48 dd tank 49 dd boat 4A train 4B dd elevator 4C dd no vehicle 50 pp jump if at less than max HP 51 nn heal HP 52 ss pp jump if character has status 53 ss remove statuses not in ss 54 ll pp jump if character below level 55 sleep 56 save game 57 load character's exp needed for next level 58 load money 59 ss inflict status on character 5A mm change background music 5B ss play sound (1) 5C ss play sound (2) 5D ss play sound (3) 5E (unused, freezes game) 5F teach characters 1 and 2 to Teleport 60 pp jump if at less than max PP 61 nn heal PP 62 pp take weapon, jump if none 63 pp select confiscated weapon, jump if none 64 live show 65 pp jump unless all 8 melodies learned 66 register your name 67 darken palette (Magicant end) 68 land mine 69 horiz. shake (EVE?) 6A XX crystal