summaryrefslogtreecommitdiff
path: root/engine/items/tms.asm
diff options
context:
space:
mode:
authorU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
committerU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
commit15427f532085846ab6b51719be687951a094cb6c (patch)
treeedea9b189e91641a12dd521756894df84aeeace7 /engine/items/tms.asm
parentea3ba4cde3706b7c77efb705555ec0c86321cbe2 (diff)
Pull a lot of engine out of main.asm
Diffstat (limited to 'engine/items/tms.asm')
-rwxr-xr-xengine/items/tms.asm37
1 files changed, 37 insertions, 0 deletions
diff --git a/engine/items/tms.asm b/engine/items/tms.asm
new file mode 100755
index 00000000..b0cfd29c
--- /dev/null
+++ b/engine/items/tms.asm
@@ -0,0 +1,37 @@
+; tests if mon [$cf91] can learn move [$d0e0]
+TestMonMoveCompatibility: ; 1373e (4:773e)
+ ld a, [$cf91]
+ ld [$d0b5], a
+ call GetMonHeader
+ ld hl, W_MONHLEARNSET
+ push hl
+ ld a, [$d0e0]
+ ld b, a
+ ld c, $0
+ ld hl, TechnicalMachines
+.findTMloop
+ ld a, [hli]
+ cp b
+ jr z, .TMfoundLoop
+ inc c
+ jr .findTMloop
+.TMfoundLoop
+ pop hl
+ ld b, $2 ; read corresponding bit from TM compatibility array
+ ld a, $10
+ jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))
+
+; converts TM/HM number in $d11e into move number
+; HMs start at 51
+TMToMove: ; 13763 (4:7763)
+ ld a, [$d11e]
+ dec a
+ ld hl, TechnicalMachines
+ ld b, $0
+ ld c, a
+ add hl, bc
+ ld a, [hl]
+ ld [$d11e], a
+ ret
+
+INCLUDE "data/tms.asm"