summaryrefslogtreecommitdiff
path: root/src/home/damage.asm
diff options
context:
space:
mode:
authorDaniel Harding <33dannye@gmail.com>2021-09-19 00:21:14 -0500
committerGitHub <noreply@github.com>2021-09-19 00:21:14 -0500
commitdf67aac83b466dadf5f74c881bf84dd9ef19bdfc (patch)
tree47501aced2d256052b8f78bc97328d5af5703add /src/home/damage.asm
parente4bce9b7ee5e89f8edfd921de2379f0fa06af206 (diff)
parent8dee6b7a11e85d6d4b9f8ec9fb9d53a499fd37dc (diff)
Merge pull request #110 from ElectroDeoxys/master
Split Home bank
Diffstat (limited to 'src/home/damage.asm')
-rw-r--r--src/home/damage.asm27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/home/damage.asm b/src/home/damage.asm
new file mode 100644
index 0000000..996ea5e
--- /dev/null
+++ b/src/home/damage.asm
@@ -0,0 +1,27 @@
+; [wDamage] += a
+AddToDamage:
+ push hl
+ ld hl, wDamage
+ add [hl]
+ ld [hli], a
+ ld a, 0
+ adc [hl]
+ ld [hl], a
+ pop hl
+ ret
+
+; [wDamage] -= a
+SubtractFromDamage:
+ push de
+ push hl
+ ld e, a
+ ld hl, wDamage
+ ld a, [hl]
+ sub e
+ ld [hli], a
+ ld a, [hl]
+ sbc 0
+ ld [hl], a
+ pop hl
+ pop de
+ ret