summaryrefslogtreecommitdiff
path: root/engine/items/tms.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/items/tms.asm')
-rwxr-xr-xengine/items/tms.asm6
1 files changed, 6 insertions, 0 deletions
diff --git a/engine/items/tms.asm b/engine/items/tms.asm
index da1b5e72..84770747 100755
--- a/engine/items/tms.asm
+++ b/engine/items/tms.asm
@@ -11,6 +11,8 @@ CanLearnTM:
ld hl, TechnicalMachines
.findTMloop
ld a, [hli]
+ cp $ff ; reached terminator?
+ jr z, .done
cp b
jr z, .TMfoundLoop
inc c
@@ -19,6 +21,10 @@ CanLearnTM:
pop hl
ld b, FLAG_TEST
predef_jump FlagActionPredef
+.done
+ pop hl
+ ld c, 0
+ ret
; converts TM/HM number in wd11e into move number
; HMs start at 51