From 8b894e4c02d43ddf2180176ee670e977b0170ccd Mon Sep 17 00:00:00 2001 From: Damian Yerrick Date: Fri, 4 Dec 2020 22:11:26 -0500 Subject: [PATCH] replace GLOBAL with EXPORT for RGBDS 0.4.2 --- src/global.inc | 13 +++++++++++++ src/init.z80 | 13 ------------- src/metasprite.z80 | 14 +++++++------- src/popslide.z80 | 1 + src/statusbar.z80 | 16 ++++++++-------- tools/extractcels.py | 2 +- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/global.inc b/src/global.inc index 9e535b1..c3fe4ca 100644 --- a/src/global.inc +++ b/src/global.inc @@ -64,6 +64,19 @@ MOVEB_JUMP equ 2 MOVEF_JUMP equ %00000100 MOVEF_DIRECTION equ %00000011 +; It is not strictly necessary to completely clear the display list, +; as lcd_clear_oam writes a "hide this sprite" value to all unused +; sprites. But when Options > Exceptions > Unitialized RAM > +; break on read (reset) is on, BGB complains about copying +; uninitialized data to OAM even if said data is provably unused. +; So put "shut BGB up" commands behind a conditional. +bgbcompat equ 1 + +; In `di halt` scenarios, VisualBoyAdvance 1.7.2 can call the +; interrupt handler anyway. When this is turned on, include a +; do-nothing STAT handler. +vbacompat equ 1 + ; 1: show dead ends when map starts ; 0: hide dead ends until entered (release) SHOW_UNENTERED_DEADENDS equ 0 diff --git a/src/init.z80 b/src/init.z80 index be36c3e..915a705 100644 --- a/src/init.z80 +++ b/src/init.z80 @@ -22,19 +22,6 @@ include "src/hardware.inc" include "src/global.inc" -; It is not strictly necessary to completely clear the display list, -; as lcd_clear_oam writes a "hide this sprite" value to all unused -; sprites. But when Options > Exceptions > Unitialized RAM > -; break on read (reset) is on, BGB complains about copying -; uninitialized data to OAM even if said data is provably unused. -; So put "shut BGB up" commands behind a conditional. -bgbcompat equ 1 - -; In `di halt` scenarios, VisualBoyAdvance 1.7.2 can call the -; interrupt handler anyway. When this is turned on, include a -; do-nothing STAT handler. -vbacompat equ 1 - ; Like the NES and Super NES, DMA on the Game Boy takes access to RAM ; and ROM away from the CPU. But unlike those two, the CPU continues ; to run. So store a tiny subroutine in HRAM (tightly coupled diff --git a/src/metasprite.z80 b/src/metasprite.z80 index 8768692..bf0f62b 100644 --- a/src/metasprite.z80 +++ b/src/metasprite.z80 @@ -22,10 +22,10 @@ include "src/hardware.inc" include "src/global.inc" -TMARGIN = 16 -LMARGIN = 8 -SPRITEHT = 8 ; or 16? -SPRITEWID = 8 +TMARGIN equ 16 +LMARGIN equ 8 +SPRITEHT equ 8 ; or 16? +SPRITEWID equ 8 ; args rsset hLocals @@ -37,8 +37,8 @@ hmsprAttr rb 1 hmsprSheetID rb 1 hmsprFrame rb 1 hmsprBaseTile rb 1 -global hmsprYLo, hmsprYHi, hmsprXLo, hmsprXHi -global hmsprAttr, hmsprSheetID, hmsprFrame, hmsprBaseTile +export hmsprYLo, hmsprYHi, hmsprXLo, hmsprXHi +export hmsprAttr, hmsprSheetID, hmsprFrame, hmsprBaseTile ; internal @@ -254,4 +254,4 @@ sheet_msprtables: dw fourbyfourCM_mspraddrs Libbet_mspraddrs: - include "obj/gb/Libbet.z80" \ No newline at end of file + include "obj/gb/Libbet.z80" diff --git a/src/popslide.z80 b/src/popslide.z80 index 733e302..2885160 100644 --- a/src/popslide.z80 +++ b/src/popslide.z80 @@ -21,6 +21,7 @@ ; include "src/hardware.inc" +include "src/global.inc" ; Each packet starts with a 4-byte header: ; dst low, dst high, count/flags, first byte diff --git a/src/statusbar.z80 b/src/statusbar.z80 index f674404..0313c92 100644 --- a/src/statusbar.z80 +++ b/src/statusbar.z80 @@ -29,8 +29,8 @@ STATUS_BLANK equ $F7 BIG_DIGIT_BASE equ $E0 SPRITE_BIG_DIGIT_BASE equ $60 STATUS_PERCENT equ $F4 -STATUSBAR_CHR_COUNT = 40 -global SPRITE_BIG_DIGIT_BASE +STATUSBAR_CHR_COUNT equ 40 +export SPRITE_BIG_DIGIT_BASE ; The status bar is and occupies the last two rows of the tilemap SCRN_STATUS equ SCRN_BG+32*16 @@ -39,12 +39,12 @@ COMBO_POS equ SCRN_STATUS+1 PCTAGE_POS equ SCRN_STATUS+9 DEBUGHEX_POS equ SCRN_STATUS+15 -EARNED_LABEL_BASE = $8C -EARNED_LABEL_NTILES = 6 -EARNED_BLANK = $91 -EARNED_NAME_BASE = $80 -EARNED_NAME_NTILES = 12 -global EARNED_NAME_BASE, EARNED_NAME_NTILES +EARNED_LABEL_BASE equ $8C +EARNED_LABEL_NTILES equ 6 +EARNED_BLANK equ $91 +EARNED_NAME_BASE equ $80 +EARNED_NAME_NTILES equ 12 +export EARNED_NAME_BASE, EARNED_NAME_NTILES COMBO_LABEL_BASE = $FC COMBO_LABEL_NTILES = 4 diff --git a/tools/extractcels.py b/tools/extractcels.py index 95e4937..aa7bf01 100755 --- a/tools/extractcels.py +++ b/tools/extractcels.py @@ -470,7 +470,7 @@ def emit_frames(framestrips, nt, framenames): ) out.extend("FRAME_%s equ %d" % (n, i) for i, n in enumerate(framenames)) - out.extend(" global FRAME_%s" % (n,) for n in framenames) + out.extend(" export FRAME_%s" % (n,) for n in framenames) return "\n".join(out) # CLI front end