From 4be11293e5c7d6bf4a2fc374974545a21a5e3572 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sun, 25 May 2014 17:27:02 -0700 Subject: Label BCD math predefs. --- engine/menu/vending_machine.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engine/menu/vending_machine.asm') diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 1f0ed084..7a8b6985 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -71,8 +71,8 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld hl, $ffde ld de, wPlayerMoney + 2 ; $d349 ld c, $3 - ld a, $c - call Predef ; indirect jump to Func_f836 (f836 (3:7836)) + ld a, $c ; SubtractBCDPredef + call Predef ld a, $13 ld [$d125], a jp DisplayTextBoxID -- cgit v1.2.3 From 40c17c906b2b3f65b3b04b1933b90238a7ac5566 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 26 May 2014 14:04:56 -0700 Subject: Remove most static wram addresses. Use labels instead. For unknown addresses, use "w
". Label overleads are still an issue. --- engine/menu/vending_machine.asm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'engine/menu/vending_machine.asm') diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 7a8b6985..8a84c5e2 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -2,41 +2,41 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld hl, VendingMachineText1 call PrintText ld a, $13 - ld [$d125], a + ld [wd125], a call DisplayTextBoxID xor a - ld [wCurrentMenuItem], a ; $cc26 - ld [wLastMenuItem], a ; $cc2a + ld [wCurrentMenuItem], a ; wCurrentMenuItem + ld [wLastMenuItem], a ; wLastMenuItem ld a, $3 - ld [wMenuWatchedKeys], a ; $cc29 + ld [wMenuWatchedKeys], a ; wMenuWatchedKeys ld a, $3 - ld [wMaxMenuItem], a ; $cc28 + ld [wMaxMenuItem], a ; wMaxMenuItem ld a, $5 - ld [wTopMenuItemY], a ; $cc24 + ld [wTopMenuItemY], a ; wTopMenuItemY ld a, $1 - ld [wTopMenuItemX], a ; $cc25 - ld hl, $d730 + ld [wTopMenuItemX], a ; wTopMenuItemX + ld hl, wd730 set 6, [hl] - FuncCoord 0, 3 ; $c3dc + FuncCoord 0, 3 ld hl, Coord ld b, $8 ld c, $c call TextBoxBorder call UpdateSprites - FuncCoord 2, 5 ; $c406 + FuncCoord 2, 5 ld hl, Coord ld de, DrinkText call PlaceString - FuncCoord 9, 6 ; $c421 + FuncCoord 9, 6 ld hl, Coord ld de, DrinkPriceText call PlaceString - ld hl, $d730 + ld hl, wd730 res 6, [hl] call HandleMenuInput bit 1, a jr nz, .asm_74f93 - ld a, [wCurrentMenuItem] ; $cc26 + ld a, [wCurrentMenuItem] ; wCurrentMenuItem cp $3 jr z, .asm_74f93 xor a @@ -69,12 +69,12 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld hl, VendingMachineText5 call PrintText ld hl, $ffde - ld de, wPlayerMoney + 2 ; $d349 + ld de, wPlayerMoney + 2 ; wd349 ld c, $3 ld a, $c ; SubtractBCDPredef call Predef ld a, $13 - ld [$d125], a + ld [wd125], a jp DisplayTextBoxID .BagFull ld hl, VendingMachineText6 @@ -116,7 +116,7 @@ VendingMachineText7: ; 74fe2 (1d:4fe2) Func_74fe7: ; 74fe7 (1d:4fe7) ld hl, VendingPrices - ld a, [$cc26] + ld a, [wCurrentMenuItem] add a add a ld d, $0 -- cgit v1.2.3 From 35f2bb90d4a8f8e4dcac3fbab7d89cbc590285e8 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:03:05 -0700 Subject: Rename predef functions so they aren't excessive in length. This is mostly because of an rgbasm bug that prevents macro arguments from exceeding 16 characters, but the names were bad anyway. --- engine/menu/vending_machine.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engine/menu/vending_machine.asm') diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 8a84c5e2..19550899 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -71,7 +71,7 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld hl, $ffde ld de, wPlayerMoney + 2 ; wd349 ld c, $3 - ld a, $c ; SubtractBCDPredef + ld a, $c ; SubBCDPredef call Predef ld a, $13 ld [wd125], a -- cgit v1.2.3 From b36f793667924f868282ce979fabab3e95d642a5 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 16 Jun 2014 13:57:26 -0700 Subject: Use macros for predef calls/jumps instead of static ids. --- engine/menu/vending_machine.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engine/menu/vending_machine.asm') diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 19550899..73dece40 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -71,8 +71,7 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld hl, $ffde ld de, wPlayerMoney + 2 ; wd349 ld c, $3 - ld a, $c ; SubBCDPredef - call Predef + predef SubBCDPredef ld a, $13 ld [wd125], a jp DisplayTextBoxID -- cgit v1.2.3 From bd533aa79bbe1998fd2b699bd7205da2de4fe55c Mon Sep 17 00:00:00 2001 From: "U-Fish-PC\\Daniel" Date: Wed, 25 Jun 2014 16:58:27 -0400 Subject: Use *Coord instead of FuncCoord Using 'Coord =' doesn't like using wTileMap So use hlCoord, deCoord, bcCoord, aCoord, Coorda, or dwCoord to avoid static addresses --- engine/menu/vending_machine.asm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'engine/menu/vending_machine.asm') diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index 73dece40..c2968e2f 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -17,18 +17,15 @@ VendingMachineMenu: ; 74ee0 (1d:4ee0) ld [wTopMenuItemX], a ; wTopMenuItemX ld hl, wd730 set 6, [hl] - FuncCoord 0, 3 - ld hl, Coord + hlCoord 0, 3 ld b, $8 ld c, $c call TextBoxBorder call UpdateSprites - FuncCoord 2, 5 - ld hl, Coord + hlCoord 2, 5 ld de, DrinkText call PlaceString - FuncCoord 9, 6 - ld hl, Coord + hlCoord 9, 6 ld de, DrinkPriceText call PlaceString ld hl, wd730 -- cgit v1.2.3