From 0d682e076acd6e742bd711a43ab1c6c7c3492b3c Mon Sep 17 00:00:00 2001 From: yenatch Date: Tue, 10 Jun 2014 23:03:21 -0700 Subject: [PATCH] Fix argument handling in *coord macros. Add a "percent" shortcut. Random returns a value from 0 to 0xff. Instead of doing extra work, most probabilities are out of 0xff. Convert these from percentages at build time for readability. --- macros.asm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macros.asm b/macros.asm index aa8876055..efd43318a 100644 --- a/macros.asm +++ b/macros.asm @@ -13,6 +13,8 @@ page EQUS "db $50," ; Start a new Pokedex page. dex EQUS "db $e8, $50" ; End a Pokedex entry. +percent EQUS "* $ff / 100" + ; macros require rst vectors to be defined FarCall EQU $08 Bankswitch EQU $10 @@ -118,15 +120,15 @@ B_ EQU 12 bccoord: MACRO - ld bc, TileMap + SCREEN_WIDTH * \2 + \1 + ld bc, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM decoord: MACRO - ld de, TileMap + SCREEN_WIDTH * \2 + \1 + ld de, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM hlcoord: MACRO - ld hl, TileMap + SCREEN_WIDTH * \2 + \1 + ld hl, TileMap + SCREEN_WIDTH * (\2) + (\1) ENDM