View Single Post
Old 14th March 2014, 10:07 PM   #2
Luna
Johto Region Champion
AdministratorPHO VIP
 
Luna's Avatar
 
Join Date: Jul 2013
Location: Johto
Age: 29
Posts: 779
Luna Luna Luna Luna Luna
Default

And it seems that Miksy91 has come up with an "optimized" version of the ASM routine in question.

Code:
ld hl, d173 // Load HL with the address of the VAR 
ld a, (hl)  // Load A with the VAR
ld d,a      // Put A into D so the old routine can use it
push hl     // Push HL so we can get the address of the VAR back later
call 4787   // Call the checking routine
pop hl      // Get the address of the VAR back
ld a, 01    // Load A with "true"
jr nc, 01   // If the Pokemon had the move, skip ahead
dec a       // Decrease A (making it 00 or "false") if they didn't have the move
ld (hl), a  // Put True or False back into the VAR
ret         // Return
You can use that version if you like, it takes slightly fewer bytes than the one I made, but it is not a radical difference and the end result is the same. So that is purely up to you.
__________________
mateo.





"I'm gonna, uh, demonstrate the hot moves..." - Flannery
Luna is offline   Reply With Quote