diff options
author | IIMarckus <iimarckus@gmail.com> | 2012-03-20 22:54:28 -0600 |
---|---|---|
committer | IIMarckus <iimarckus@gmail.com> | 2012-03-20 22:54:28 -0600 |
commit | 0173ab3c7ff476ea99f08bb5d5c58e8b7ca5129c (patch) | |
tree | 1479067ea291642742a235e6e313bfc064e02edc | |
parent | 93902a38bd9b9a1a6dd1cbd4b34650549cbc5f35 (diff) |
Add shiny check function.
-rw-r--r-- | main.asm | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -38,7 +38,36 @@ INCBIN "baserom.gbc",$3105,$4000-$3105 SECTION "bank1",DATA,BANK[$1] INCBIN "baserom.gbc",$4000,$4000 SECTION "bank2",DATA,BANK[$2] -INCBIN "baserom.gbc",$8000,$4000 +INCBIN "baserom.gbc",$8000,$a68 + +CheckShininess: ; 0x8a68 +; given a pointer to Attack/Defense DV in bc, determine if monster is shiny. +; if shiny, set carry. + ld l,c + ld h,b + ld a,[hl] + and a,%00100000 ; is attack DV xx1x? + jr z,.NotShiny + ld a,[hli] + and a,%1111 + cp $A ; is defense DV 1010? + jr nz,.NotShiny + ld a,[hl] + and a,%11110000 + cp $A0 ; is speed DV 1010? + jr nz,.NotShiny + ld a,[hl] + and a,%1111 + cp $A ; is special DV 1010? + jr nz,.NotShiny + scf + ret +.NotShiny + and a ; clear carry flag + ret + +INCBIN "baserom.gbc",$8a88,$c000-$8a88 + SECTION "bank3",DATA,BANK[$3] INCBIN "baserom.gbc",$c000,$29 |