summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTauwasser <Tauwasser@tauwasser.eu>2018-06-03 04:44:18 +0200
committerTauwasser <Tauwasser@tauwasser.eu>2018-06-03 04:44:18 +0200
commitc9874e1a7b67b539ed448f57147e139397f7b324 (patch)
tree25cff1734e314ee5ccc450e0f50b2eff6bbb7dc5
parent069b002346f14d48125f7c913b58064bb1d43ca7 (diff)
home: move PrintLetterDelay to menu
That's where most of the textbox code will live some day, ... probably Signed-off-by: Tauwasser <Tauwasser@tauwasser.eu>
-rw-r--r--home/menu.asm47
-rw-r--r--home/print_bcd.asm46
2 files changed, 47 insertions, 46 deletions
diff --git a/home/menu.asm b/home/menu.asm
new file mode 100644
index 0000000..e673b2d
--- /dev/null
+++ b/home/menu.asm
@@ -0,0 +1,47 @@
+
+
+SECTION "Print Letter Delay", ROM0[$33a3]
+
+PrintLetterDelay:: ; 33a3 (0:33a3)
+ ld a, [wce5f]
+ bit 4, a
+ ret nz
+ ld a, [wTextBoxFlags]
+ bit 1, a
+ ret z
+ push hl
+ push de
+ push bc
+ ld a, [wTextBoxFlags]
+ bit 0, a
+ jr z, .waitOneFrame
+ ld a, [wce5f]
+ and $07
+ jr .initFrameCnt
+.waitOneFrame
+ ld a, $01
+.initFrameCnt
+ ld [wVBlankJoyFrameCounter], a
+.checkButtons
+ call GetJoypad
+ ldh a, [hJoyState]
+.checkAButton
+ bit 0, a ; is the A button pressed?
+ jr z, .checkBButton
+ jr .endWait
+.checkBButton
+ bit 1, a ; is the B button pressed?
+ jr z, .buttonsNotPressed
+.endWait
+ call DelayFrame
+ jr .done
+.buttonsNotPressed ; if neither A nor B is pressed
+ ld a, [wVBlankJoyFrameCounter]
+ and a
+ jr nz, .checkButtons
+.done
+ pop bc
+ pop de
+ pop hl
+ ret
+; 0x33e3 \ No newline at end of file
diff --git a/home/print_bcd.asm b/home/print_bcd.asm
index fa8d825..eefb9f0 100644
--- a/home/print_bcd.asm
+++ b/home/print_bcd.asm
@@ -1,51 +1,5 @@
INCLUDE "constants.asm"
-SECTION "BCD Finalize", ROM0[$33a3]
-
-PrintLetterDelay:: ; 33a3 (0:33a3)
- ld a, [wce5f]
- bit 4, a
- ret nz
- ld a, [wTextBoxFlags]
- bit 1, a
- ret z
- push hl
- push de
- push bc
- ld a, [wTextBoxFlags]
- bit 0, a
- jr z, .waitOneFrame
- ld a, [wce5f]
- and $07
- jr .initFrameCnt
-.waitOneFrame
- ld a, $01
-.initFrameCnt
- ld [wVBlankJoyFrameCounter], a
-.checkButtons
- call GetJoypad
- ldh a, [hJoyState]
-.checkAButton
- bit 0, a ; is the A button pressed?
- jr z, .checkBButton
- jr .endWait
-.checkBButton
- bit 1, a ; is the B button pressed?
- jr z, .buttonsNotPressed
-.endWait
- call DelayFrame
- jr .done
-.buttonsNotPressed ; if neither A nor B is pressed
- ld a, [wVBlankJoyFrameCounter]
- and a
- jr nz, .checkButtons
-.done
- pop bc
- pop de
- pop hl
- ret
-; 0x33e3
-
SECTION "BCD Functions", ROM0[$3ab2]
; function to print a BCD (Binary-coded decimal) number