diff options
author | Daniel Harding <33dannye@gmail.com> | 2021-09-19 00:21:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 00:21:14 -0500 |
commit | df67aac83b466dadf5f74c881bf84dd9ef19bdfc (patch) | |
tree | 47501aced2d256052b8f78bc97328d5af5703add /src/home/load_deck.asm | |
parent | e4bce9b7ee5e89f8edfd921de2379f0fa06af206 (diff) | |
parent | 8dee6b7a11e85d6d4b9f8ec9fb9d53a499fd37dc (diff) |
Merge pull request #110 from ElectroDeoxys/master
Split Home bank
Diffstat (limited to 'src/home/load_deck.asm')
-rw-r--r-- | src/home/load_deck.asm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/home/load_deck.asm b/src/home/load_deck.asm new file mode 100644 index 0000000..b1c7f74 --- /dev/null +++ b/src/home/load_deck.asm @@ -0,0 +1,32 @@ +; loads the deck id in a from DeckPointers and copies it to wPlayerDeck or to +; wOpponentDeck, depending on whose turn it is. +; sets carry flag if an invalid deck id is used. +LoadDeck: + push hl + ld l, a + ld h, $0 + ldh a, [hBankROM] + push af + ld a, BANK(DeckPointers) + call BankswitchROM + add hl, hl + ld de, DeckPointers + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld a, d + or e + jr z, .null_pointer + call CopyDeckData + pop af + call BankswitchROM + pop hl + or a + ret +.null_pointer + pop af + call BankswitchROM + pop hl + scf + ret |