ItemDex/RB:093: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
>Sherkel
mNo edit summary
>Bbbbbbbbba
(→‎Bootstrapping: Aligned comments; changed "jp (hl)" to "jp hl".)
Line 39: Line 39:


The bootstrap code translates to the following ASM:
The bootstrap code translates to the following ASM:

<code>
; Initial hl = D163<br/>
; Initial hl = D163
$D163 <- 05 || dec b<br/>
$D163 <- 05 || dec b
$D164 <- 24 || inc h ; h = D2<br/>
$D164 <- 24 || inc h ; h = D2
$D165 <- 2E ||<br/>
$D165 <- 2E ||
$D166 <- 22 || ld l, 22 ; hl = D222 <br/>
$D166 <- 22 || ld l, 22 ; hl = D222
$D167 <- 18 || <br/>
$D167 <- 18 ||
$D168 <- 02 || jr 2 ; pc = D16B<br/>
$D168 <- 02 || jr 02 ; pc = D16B
$D169 <- FF ||<br/>
$D169 <- FF ||
$D16A <- FF ||<br/>
$D16A <- FF ||
$D16B <- 24 || inc h ; h = D3<br/>
$D16B <- 24 || inc h ; h = D3
$D16C <- 00 || nop<br/>
$D16C <- 00 || nop
$D16D <- e9 || jp (hl) ; pc = D322<br/>
$D16D <- E9 || jp hl ; pc = D322
</code>


Understanding the ASM will allow modifying the setup to suit different needs. For example, to make 8F run code starting from item 1 ($D31E), replace the Onix (0x22) with a Tangela (0x1E).
Understanding the ASM will allow modifying the setup to suit different needs. For example, to make 8F run code starting from item 1 ($D31E), replace the Onix (0x22) with a Tangela (0x1E).
Line 69: Line 68:


ASM translation:
ASM translation:

<code><br/>
$D163 <- 06 ||<br/>
$D163 <- 06 ||
$D164 <- ?? || ld b, ??<br/>
$D164 <- ?? || ld b, ??
$D165 <- 24 || inc h ; h = D2<br/>
$D165 <- 24 || inc h ; h = D2
$D166 <- 2E ||<br />
$D166 <- 2E ||
$D167 <- 22 || ld l, 22 ; hl = D222<br/>
$D167 <- 22 || ld l, 22 ; hl = D222
$D168 <- 18 ||<br/>
$D168 <- 18 ||
$D169 <- 2D || jr 2D ; pc = D197<br/>
$D169 <- 2D || jr 2D ; pc = D197
(...)<br/>
(...)
$D197 <- 24 || inc h ; h = D3<br/>
$D197 <- 24 || inc h ; h = D3
$D198 <- 00 || nop<br/>
$D198 <- 00 || nop
$D199 <- E9 || jp (hl) ; pc = D322
$D199 <- E9 || jp hl ; pc = D322
</code>


===3 Pokémon super-compressed setup===
===3 Pokémon super-compressed setup===
Line 91: Line 89:


ASM translation:
ASM translation:

<code><br/>
$D163 <- 03/04/05 || inc bc / inc b / dec b<br/>
$D163 <- 03/04/05 || inc bc / inc b / dec b
$D164 <- C3 || <br/>
$D164 <- C3 ||
$D165 <- 22 || <br/>
$D165 <- 22 ||
$D166 <- D3 || jp $D322 <br />
$D166 <- D3 || jp $D322
</code>


Notice that this setup doesn't set hl to $D322, which some common item setups assume. For those item setups, inserting two items will fix this problem:
Notice that this setup doesn't set hl to $D322, which some common item setups assume. For those item setups, inserting two items will fix this problem: