Jump to content

Glossary: Difference between revisions

m
Added <code> tags for label names in the disassembly.
>Sherkel
m (This should be used often. Don't know how I didn't see it till now, but great idea.)
m (Added <code> tags for label names in the disassembly.)
 
(5 intermediate revisions by 4 users not shown)
Line 17:
:A technique for writing a number in hexadecimal where, unlike in the regular conversion from decimal to hexadecimal (for example, dec[58] = hex[3A]), the decimal digits are written as-is in hexadecimal, two per byte (for example, dec[58] = hex[58]).
:In Pokémon games, BCD is often used for quantities of money and casino coins; it is also fairly commonly used in clock chips, such as the ones used in generation II and III games with said feature.
 
;{{Anchor|Breakpoint}}'''Breakpoint'''
:See [[breakpoint]].
 
;{{Anchor|Buffer overflow}}'''[[Buffer overflow]]'''
:To write more data into a buffer than its size allows. The data will end up being written into adjacent memory areas, causing [[#Memory corruption|memory corruption]].
 
;{{Anchor|Corruption}}'''Corruption'''
:See [[#Memory corruption|memory corruption]].
 
;{{Anchor|Count byte}}'''Count byte'''
Line 35 ⟶ 41:
 
;{{Anchor|Jump table}}'''Jump table'''
:A table of addresses pointing to assembly code (typically entry points of functions). A relatively well-known example of a jump table is <code>[https://github.com/pret/pokered/blob/725b86ebbec23bd1f53fd60bf0201c904fee951d/engine/items/items.asm#L18 ItemUsePtrTable]</code> in Generation I. An invalid index into a jump table will usually cause glitches, possibly [[arbitrary code execution]] exploits.
<!--
;{{Anchor|Machine code}}'''Machine code'''
Line 43 ⟶ 49:
-->
;{{Anchor|Memory bank}}'''Memory bank'''
:In the GameBoy, a segment of the ROM or the SRAM, mapped to a consecutive segment of the 16-bit GameBoy address space. With the exception of ROM bank 0 (the "home bank"), the banks are "switchable", i.e. they share the same address space ($4000~4000–$7FFF for switchable ROM banks, $A000~A000–$BFFF for SRAM banks), and are "switched" into and out of the accessible memory space with special instructions (technically, an "impossible write" to the ROM). This is to solve the problem that the space needed for those areas in a large game can be much larger than the 64KB that the 16-bit address space allows.
 
;{{Anchor|Memory corruption}}'''Memory corruption'''
:Modification of a memory location by a piece of code that is never supposed to modify it, which may cause important data be overwritten in a potentially hard-to-discern pattern. This is usually caused by [[#Buffer overflow|buffer overflow]], but may also result from other forms of pointer manipulation; the [[ZZAZZ effect]] is an example.
:This phrase should not be used when different data intentionally share the same memory location (e.g. the player's name and the grass encounter table in the [[old man trick]]), or when the code writes to the intended memory location an invalid value due to a logic error (e.g. changing the [[#Item count|item count]] to 255 with [[item underflow]]).
 
;{{Anchor|Overflow}}'''Overflow'''
:1. For a value to exceed the range of its data type. For example, the range for an unsigned [[byte]] is 0~2550–255, so trying to calculate 100+200 would result in an overflow. If the condition is not checked, then the value would usually be "wrapped around" to an in-range value: The above example would give 300-256 = 44. Depending on the exact definition, may or may not include [[#Underflow|underflow]].
:2. See [[#Buffer overflow|buffer overflow]].
 
;{{Anchor|Party count}}'''Party count'''
:The value of the [[#Count byte|count byte]] for a party Pokémon list. Normally, it is just the number of Pokémon in the party.
 
;{{Anchor|Pointer}}'''Pointer'''
:A pointer is a term used in programming used to describe a value that contains the address of data or code. It is often space-efficient to store pointers in a table where the pointer is fetched from the table before using it to jump to the relevant code as opposed to programming a series of branches that each then jump to their own subroutines.
:Early Pokemon games use pointer tables to reference the location of things such as Pokemon graphics (which cause the game to read data from the address pointed to instead of execute code there), move and item effects, and text.
 
;{{Anchor|Species byte 1}}'''Species byte 1'''
Line 65 ⟶ 79:
 
;{{Anchor|Stack corruption}}'''Stack corruption'''
:[[#Memory corruption|Memory corruption]] in the [[#Stack|stack]] area. This kind of corruption is usually highly disruptive to the execution flow because it may easily change return addresses on the stack, causing <code>ret</code> instructions to jump to unintended addresses. As a result, it is likely to crash the game, but when controlled it can also be used for many exploits, including [[arbitrary code execution]].
 
;{{Anchor|Stack pointer}}'''Stack pointer'''
:A special-purpose register that points to the topmost entry of the [[#Stack|stack]]. In the GB CPU, the stack pointer is named <code>sp</code>, and it is decreased by 2 (since the stack entries are 2-byte numbers) for each <code>push</code> or <code>call</code>, and increased by 2 for each <code>pop</code> or <code>ret</code>.
 
;{{Anchor|Terminator}}'''Terminator'''
Line 74 ⟶ 88:
 
;{{Anchor|Underflow}}'''Underflow'''
:For a value to be lower than the minimum representable value in its data type. For example, the range for an unsigned [[byte]] is 0~2550–255, so trying to calculate 0-1 would result in an underflow. If the condition is not checked, then the value would usually be "wrapped around" to an in-range value: The above example would give (-1)+256 = 255. May or may not be considered a type of [[#Overflow|overflow]] depending on the exact definition of the latter.
:A notable example of underflow in Pokémon games is [[item underflow]], which refers to underflowing the [[#Item count|item count]] to 255, allowing the player to access an [[expanded item pack]].
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.