Jump to content

ItemDex/RB:093: Difference between revisions

→‎Bootstrapping: Aligned comments; changed "jp (hl)" to "jp hl".
>Sherkel
mNo edit summary
>Bbbbbbbbba
(→‎Bootstrapping: Aligned comments; changed "jp (hl)" to "jp hl".)
Line 39:
 
The bootstrap code translates to the following ASM:
 
<code>
; Initial hl = D163<br/>
$D163 <- 05 || dec b<br/>
$D164 <- 24 || inc h ; h = D2<br/>
$D165 <- 2E ||<br/>
$D166 <- 22 || ld l, 22 ; hl = D222 <br/>
$D167 <- 18 || <br/>
$D168 <- 02 || jr 2 02 ; pc = D16B<br/>
$D169 <- FF ||<br/>
$D16A <- FF ||<br/>
$D16B <- 24 || inc h ; h = D3<br/>
$D16C <- 00 || nop<br/>
$D16D <- e9E9 || jp (hl) ; pc = D322<br/>
</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).
Line 69 ⟶ 68:
 
ASM translation:
 
<code><br/>
$D163 <- 06 ||<br/>
$D164 <- ?? || ld b, ??<br/>
$D165 <- 24 || inc h ; h = D2<br/>
$D166 <- 2E ||<br />
$D167 <- 22 || ld l, 22 ; hl = D222<br/>
$D168 <- 18 ||<br/>
$D169 <- 2D || jr 2D ; pc = D197<br/>
(...)<br/>
$D197 <- 24 || inc h ; h = D3<br/>
$D198 <- 00 || nop<br/>
$D199 <- E9 || jp (hl) ; pc = D322
</code>
 
===3 Pokémon super-compressed setup===
Line 91 ⟶ 89:
 
ASM translation:
 
<code><br/>
$D163 <- 03/04/05 || inc bc / inc b / dec b<br/>
$D164 <- C3 || <br/>
$D165 <- 22 || <br/>
$D166 <- D3 || jp $D322 <br />
</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:
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.