shithub: pokecrystal

Download patch

ref: 0ee9d7a48baed7e9388e7e377b5eab5b4f795688
parent: a325db0f14ca3c48bd9057627f7306b207544700
author: Rangi <[email protected]>
date: Sat Apr 4 10:42:31 EDT 2020

Upgrade to rgbds 0.4.0

- fail for rgbds < 0.4.0
- `rst <Label>`
- `ds <count>, <byte>`
- `shift <N>`
- ASCII "\r"
- Sorted .sym file

--- a/FAQ.md
+++ b/FAQ.md
@@ -38,11 +38,11 @@
 
 ### "ERROR: `UNION` already defined"
 
-Download [**rgbds 0.3.9**][rgbds] or newer. Older versions will not work.
+Download [**rgbds 0.4.0**][rgbds] or newer. Older versions will not work.
 
 ### "Expression must be 8-bit"
 
-Download [**rgbds 0.3.9**][rgbds] or newer. Older versions will not work.
+Download [**rgbds 0.4.0**][rgbds] or newer. Older versions will not work.
 
 ### "Segmentation fault" from `rgbgfx`
 
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -38,7 +38,7 @@
 
 Then download [**rgbds**](https://github.com/rednex/rgbds/releases/): the latest **win64.zip** or **win32.zip** release. Extract it and put all the `exe` and `dll` files individually in **C:\cygwin64\usr\local\bin**.
 
-**Note: If you already have an older rgbds, you will need to update to 0.3.9.** Ignore this if you have never installed rgbds before. If a version newer than 0.3.9 does not work, try downloading 0.3.9.
+**Note: If you already have an older rgbds, you will need to update to 0.4.0.** Ignore this if you have never installed rgbds before. If a version newer than 0.4.0 does not work, try downloading 0.4.0.
 
 Now open the **Cygwin terminal** and enter the following commands.
 
@@ -86,7 +86,7 @@
 
 ```bash
 sudo apt-get install pkg-config flex bison libpng-dev
-git clone -b v0.3.9 --depth=1 https://github.com/rednex/rgbds
+git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
 sudo make -C rgbds CFLAGS=-O2 install
 ```
 
@@ -102,7 +102,7 @@
 
 ```bash
 sudo zypper install pkg-config flex bison libpng16-devel
-git clone -b v0.3.9 --depth=1 https://github.com/rednex/rgbds
+git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
 sudo make -C rgbds CFLAGS=-O2 install
 ```
 
@@ -120,7 +120,7 @@
 
 ```bash
 sudo pacman -S pkg-config flex bison libpng
-git clone -b v0.3.9 --depth=1 https://github.com/rednex/rgbds
+git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
 sudo make -C rgbds CFLAGS=-O2 install
 ```
 
@@ -157,7 +157,7 @@
 To install **rgbds**:
 
 ```bash
-git clone -b v0.3.9 --depth=1 https://github.com/rednex/rgbds
+git clone -b v0.4.0 --depth=1 https://github.com/rednex/rgbds
 sudo make -C rgbds CFLAGS=-O2 install
 ```
 
--- a/Makefile
+++ b/Makefile
@@ -94,17 +94,14 @@
 pokecrystal.gbc: $(crystal_obj) pokecrystal.link
 	$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -o $@ $(crystal_obj)
 	$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
-	tools/sort_symfile.sh pokecrystal.sym
 
 pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link
 	$(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj)
 	$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@
-	tools/sort_symfile.sh pokecrystal11.sym
 
 pokecrystal-au.gbc: $(crystal_au_obj) pokecrystal.link
 	$(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l pokecrystal.link -o $@ $(crystal_au_obj)
 	$(RGBFIX) -Cjv -i BYTU -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
-	tools/sort_symfile.sh pokecrystal-au.sym
 
 
 # For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file.
--- a/constants.asm
+++ b/constants.asm
@@ -1,3 +1,7 @@
+if __RGBDS_MINOR__ < 4
+	fail "pokecrystal requires rgbds 0.4.0 or newer."
+endc
+
 INCLUDE "charmap.asm"
 
 INCLUDE "macros.asm"
--- a/engine/games/unown_puzzle.asm
+++ b/engine/games/unown_puzzle.asm
@@ -115,8 +115,7 @@
 initpuzcoord: MACRO
 rept _NARG / 2
 	db \1 puzcoord \2
-	shift
-	shift
+	shift 2
 endr
 ENDM
 	initpuzcoord 0,0, 0,1, 0,2, 0,3, 0,4, 0,5
--- a/gfx/pokegear/town_map_palette_map.asm
+++ b/gfx/pokegear/town_map_palette_map.asm
@@ -9,8 +9,7 @@
 townmappals: MACRO
 rept _NARG / 2
 	dn PAL_TOWNMAP_\2, PAL_TOWNMAP_\1
-	shift
-	shift
+	shift 2
 endr
 ENDM
 
--- a/gfx/tileset_palette_maps.asm
+++ b/gfx/tileset_palette_maps.asm
@@ -4,8 +4,7 @@
 x = \1 << OAM_TILE_BANK
 rept (_NARG - 1) / 2
 	dn (x | PAL_BG_\3), (x | PAL_BG_\2)
-	shift
-	shift
+	shift 2
 endr
 ENDM
 
@@ -109,7 +108,4 @@
 TilesetBattleTowerOutsidePalMap:
 INCLUDE "gfx/tilesets/battle_tower_outside_palette_map.asm"
 
-; unused
-rept 26
-	db $06
-endr
+	ds 26, $06 ; unused
--- a/home/header.asm
+++ b/home/header.asm
@@ -4,10 +4,12 @@
 	di
 	jp Start
 
-SECTION "rst8", ROM0[$0008] ; rst FarCall
+SECTION "rst8", ROM0[$0008]
+FarCall::
 	jp FarCall_hl
 
-SECTION "rst10", ROM0[$0010] ; rst Bankswitch
+SECTION "rst10", ROM0[$0010]
+Bankswitch::
 	ldh [hROMBank], a
 	ld [MBC3RomBank], a
 	ret
@@ -18,7 +20,8 @@
 SECTION "rst20", ROM0[$0020]
 	rst $38
 
-SECTION "rst28", ROM0[$0028] ; rst JumpTable
+SECTION "rst28", ROM0[$0028]
+JumpTable::
 	push de
 	ld e, a
 	ld d, 0
@@ -63,4 +66,4 @@
 
 ; The cartridge header data is filled in by rgbfix.
 ; This makes sure it doesn't get used.
-	ds $0150 - $0104
+	ds $0150 - @
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -4,8 +4,6 @@
 INCLUDE "constants/hardware_constants.asm"
 INCLUDE "constants/mobile_constants.asm"
 
-charmap "<CR>", $d
-
 ; Mobile Adapter protocol commands
 MOBILE_COMMAND_BEGIN_SESSION            EQU $10
 MOBILE_COMMAND_END_SESSION              EQU $11
@@ -4943,31 +4941,31 @@
 Unknown_1120b0:
 	db "RCPT TO:<", 0
 Unknown_1120ba:
-	db "DATA<CR>\n", 0
+	db "DATA\r\n", 0
 Unknown_1120c1:
-	db "QUIT<CR>\n", 0
+	db "QUIT\r\n", 0
 Unknown_1120c8:
 	db "USER ", 0
 Unknown_1120ce:
 	db "PASS ", 0
 Unknown_1120d4:
-	db "STAT<CR>\n", 0
+	db "STAT\r\n", 0
 Unknown_1120db:
-	db "LIST 00000<CR>\n", 0
+	db "LIST 00000\r\n", 0
 Unknown_1120e8:
-	db "RETR 00000<CR>\n", 0
+	db "RETR 00000\r\n", 0
 Unknown_1120f5:
-	db "DELE 00000<CR>\n", 0
+	db "DELE 00000\r\n", 0
 Unknown_112102:
-	db "TOP 00000 0<CR>\n", 0
+	db "TOP 00000 0\r\n", 0
 Unknown_112110:
 	db "GET ", 0
 Unknown_112115:
-	db " HTTP/1.0<CR>\n", 0
+	db " HTTP/1.0\r\n", 0
 Unknown_112121:
 	db "User-Agent: CGB-", 0
 Unknown_112132:
-	db "<CR>\n<CR>\n", 0
+	db "\r\n\r\n", 0
 Unknown_112137:
 	db "POST ", 0
 Unknown_11213d:
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -28,8 +28,7 @@
 ; x, y
 rept _NARG / 2
 	dw (\2) * SCREEN_WIDTH + (\1) + wTilemap
-	shift
-	shift
+	shift 2
 endr
 ENDM
 
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -32,8 +32,7 @@
 dn: MACRO ; nybbles
 rept _NARG / 2
 	db ((\1) << 4) | (\2)
-	shift
-	shift
+	shift 2
 endr
 ENDM
 
@@ -40,10 +39,7 @@
 dc: MACRO ; "crumbs"
 rept _NARG / 4
 	db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4)
-	shift
-	shift
-	shift
-	shift
+	shift 4
 endr
 ENDM
 
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -1,9 +1,7 @@
 RGB: MACRO
 rept _NARG / 3
 	dw palred (\1) + palgreen (\2) + palblue (\3)
-	shift
-	shift
-	shift
+	shift 3
 endr
 ENDM
 
--- a/macros/rst.asm
+++ b/macros/rst.asm
@@ -1,7 +1,3 @@
-FarCall    EQU $08
-Bankswitch EQU $10
-JumpTable  EQU $28
-
 farcall: MACRO ; bank, address
 	ld a, BANK(\1)
 	ld hl, \1
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -491,17 +491,17 @@
 	jp z, .asm_1144c2
 	inc e
 	call z, Function1144c8
-	cp $d ; CR
+	cp "\r"
 	jr nz, .asm_11442b
 	ld a, [de]
 	inc e
 	call z, Function1144c8
-	cp $a ; NL
+	cp "\n"
 	jr nz, .asm_11442b
 	ld a, [de]
-	cp $2e ; .
+	cp "."
 	jr z, .asm_1144ae
-	cp $d  ; CR
+	cp "\r"
 	jr z, .asm_1144b8
 
 .asm_11444a
@@ -557,7 +557,7 @@
 	inc bc
 	inc e
 	call z, Function1144c8
-	cp $d ; "\r"
+	cp "\r"
 	jr nz, .asm_114486
 	ld a, [de]
 	inc bc
@@ -581,7 +581,7 @@
 	inc e
 	call z, Function1144c8
 	ld a, [de]
-	cp $d ; CR
+	cp "\r"
 	jp nz, .asm_11442b
 
 .asm_1144b8
@@ -588,7 +588,7 @@
 	inc e
 	call z, Function1144c8
 	ld a, [de]
-	cp $a ; NL
+	cp "\n"
 	jp nz, .asm_11442b
 
 .asm_1144c2
--- a/tools/sort_symfile.sh
+++ /dev/null
@@ -1,14 +1,0 @@
-#!/bin/sh
-TEMP_FILE=$(mktemp)
-sed \
-    -e "s/^..:[0-3]/0_ROM0@&/g" \
-    -e "s/^..:[4-7]/1_ROMX@&/g" \
-    -e "s/^..:[8-9]/2_VRAM@&/g" \
-    -e "s/^..:[A-Ba-b]/3_SRAM@&/g" \
-    -e "s/^00:[C-Dc-d]/4_WRAM0@&/g" \
-    -e "s/^..:[D-Dd-d]/5_WRAMX@&/g" \
-    -e "s/^..:[F-Ff-f]/6_HRAM@&/g" \
-    $1 \
-| sort \
-| sed -e "s/^.*@//g" > $TEMP_FILE
-mv $TEMP_FILE $1