Main Menu
Main Page
Forums
New pages
Recent changes
Random page
Help

Glitches
Arbitrary code execution
Pokémon cloning
Pomeg glitch and Glitzer Popping
Tweaking and voiding
Glitches by generation
Glitch categories

References/Resources
Databases
Disassembly projects
The Big HEX List
Pokémon cheat codes
Pokémon glitch terminology
Useful tools
More

Affiliates
Legendary Star Blob 2 (Hakuda) (日本語/Japanese)
Pokémon Speedruns wiki (English)
PRAMA Initiative (Français/French)
MissingNo. Glitch City (Italiano/Italian)
Become an affiliate!

Technical
Site source code

Search Wiki

 

Search Forums

 

Author Topic: J glitch item  (Read 452 times)

0 Members and 1 Guest are viewing this topic.

likebeingawesome

  • The game reset master
  • GCLF Member
  • Offline Offline
  • Gender: Male
  • DARN IT I RESET MY GAME
    • View Profile
J glitch item
« on: July 09, 2017, 12:32:07 pm »
I was wondering if I could get more information on this item. Including why it exists between your items and the area with random items when performing item underflow. As well as what it does and why it sells for 414925 pokedollars in sI shops.
« Last Edit: July 09, 2017, 12:33:11 pm by likebeingawesome »
I need to double check codes before I use them


TheZZAZZGlitch

  • Distinguished Member
  • *
  • Offline Offline
  • Gender: Male
  • Unknown opcode fc at 801a
    • View Profile
Re: J glitch item
« Reply #1 on: July 09, 2017, 04:12:07 pm »
'j.' is a glitch item with hex ID 00.
You get to see it a lot during item underflow, simply because 0 is a popular number and it occurs many times throughout the game's memory. Which is what item underflow really is - viewing the memory beyond inventory data as items.

This item happens to execute code from $01D1, which is in the middle of map header pointers. This garbage code (which isn't really game code, but the game has to interpret it somehow) eventually causes a jump to $BE42, in the middle of SRAM.
It could be potentially used for arbitrary code execution, although only theoretically, since there's no easy way to control data at $BE42 without cheating or resorting to another form of arbitrary code execution.

j.'s sell price of 414925 is completely accidental.
The game keeps a table of all item prices. This table only has 96 entries. Item 0 is actually interpreted as item 256, so the game tries to grab the 256th entry of this list, and ends up reading past the table.
Just so happens, item names are located there, and the game reads the last 3 bytes of "X ACCURACY(end marker)" (0x82, 0x98, 0x50) as an item price.

So, the item's buy price is 829850.
The sell price is dynamically calculated by the game to be the half of the buy price.
829850 divided by 2 is - you guessed it - 414925.
« Last Edit: July 09, 2017, 04:13:11 pm by TheZZAZZGlitch »
qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF

likebeingawesome

  • The game reset master
  • GCLF Member
  • Offline Offline
  • Gender: Male
  • DARN IT I RESET MY GAME
    • View Profile
Re: J glitch item
« Reply #2 on: July 09, 2017, 04:16:44 pm »
Thanks for telling me this is really cool
I need to double check codes before I use them