aboutsummaryrefslogtreecommitdiffstats
path: root/engine/flag_action_predef.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-05-20 19:40:33 -0500
committerdannye <33dannye@gmail.com>2020-05-20 20:02:53 -0500
commit10f9559eab8c93b94abb8ae8d1083704ad4e169a (patch)
tree7dbe7b152dde8a6e9b56664b5b8cdfc0d6be1253 /engine/flag_action_predef.asm
parentMerge pull request #39 from TiKevin83/master (diff)
downloadpokeyellow-10f9559eab8c93b94abb8ae8d1083704ad4e169a.tar.gz
pokeyellow-10f9559eab8c93b94abb8ae8d1083704ad4e169a.tar.xz
pokeyellow-10f9559eab8c93b94abb8ae8d1083704ad4e169a.zip
Sync with pokered
Diffstat (limited to 'engine/flag_action_predef.asm')
-rw-r--r--engine/flag_action_predef.asm73
1 files changed, 0 insertions, 73 deletions
diff --git a/engine/flag_action_predef.asm b/engine/flag_action_predef.asm
deleted file mode 100644
index dc516887..00000000
--- a/engine/flag_action_predef.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-FlagActionPredef:
- call GetPredefRegisters
-
-FlagAction:
-; Perform action b on bit c
-; in the bitfield at hl.
-; 0: reset
-; 1: set
-; 2: read
-; Return the result in c.
-
- push hl
- push de
- push bc
-
- ; bit
- ld a, c
- ld d, a
- and 7
- ld e, a
-
- ; byte
- ld a, d
- srl a
- srl a
- srl a
- add l
- ld l, a
- jr nc, .ok
- inc h
-.ok
-
- ; d = 1 << e (bitmask)
- inc e
- ld d, 1
-.shift
- dec e
- jr z, .shifted
- sla d
- jr .shift
-.shifted
-
- ld a, b
- and a
- jr z, .reset
- cp 2
- jr z, .read
-
-.set
- ld b, [hl]
- ld a, d
- or b
- ld [hl], a
- jr .done
-
-.reset
- ld b, [hl]
- ld a, d
- xor $ff
- and b
- ld [hl], a
- jr .done
-
-.read
- ld b, [hl]
- ld a, d
- and b
-.done
- pop bc
- pop de
- pop hl
- ld c, a
- ret