Skip to content

Commit a18b29b

Browse files
authored
Merge pull request #50 from BrianPugh/0x080200000-entrypoint
0x080200000 entrypoint
2 parents 541a1b7 + fae6864 commit a18b29b

File tree

4 files changed

+53
-15
lines changed

4 files changed

+53
-15
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ repos:
44
hooks:
55
- id: black
66

7-
- repo: https://gitlab.com/pycqa/flake8
7+
- repo: https://github.com/pycqa/flake8
88
rev: 3.9.2
99
hooks:
1010
- id: flake8
1111

1212
- repo: https://github.com/PyCQA/isort
13-
rev: 5.10.1
13+
rev: 5.12.0
1414
hooks:
1515
- id: isort
1616
args: ["--profile", "black"]

Core/Src/main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#define MSP_ADDRESS 0x08000000
1313

14+
#define BANK_1_STACK_2_ADDRESS 0x08020000
1415
#define BANK_2_ADDRESS 0x08100000
1516
#define BOOTLOADER_MAGIC 0x544F4F42 // "BOOT"
1617
#define BOOTLOADER_MAGIC_ADDRESS ((uint32_t *)0x2001FFF8)
@@ -46,11 +47,6 @@ void bootloader(){
4647
while(1);
4748
}
4849

49-
static inline void start_bank_2() {
50-
set_bootloader(BANK_2_ADDRESS);
51-
NVIC_SystemReset();
52-
}
53-
5450

5551
#if ENABLE_SMB1_GRAPHIC_MODS
5652
#define SMB1_GRAPHIC_MODS_MAX 8
@@ -97,12 +93,17 @@ gamepad_t read_buttons() {
9793
gamepad = stock_read_buttons();
9894

9995

96+
if((gamepad & GAMEPAD_RIGHT) && (gamepad & GAMEPAD_GAME)){
97+
set_bootloader(BANK_1_STACK_2_ADDRESS);
98+
NVIC_SystemReset();
99+
}
100100
#if CLOCK_ONLY
101101
if(gamepad & GAMEPAD_GAME){
102102
#else
103103
if((gamepad & GAMEPAD_LEFT) && (gamepad & GAMEPAD_GAME)){
104104
#endif
105-
start_bank_2();
105+
set_bootloader(BANK_2_ADDRESS);
106+
NVIC_SystemReset();
106107
}
107108

108109
#if ENABLE_SMB1_GRAPHIC_MODS

docs/zelda.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,53 @@ Run the following in this repo:
1919

2020
```bash
2121
make clean
22-
make PATCH_PARAMS="--device=zelda --extended --no-la --no-sleep-images --extended" flash
22+
make PATCH_PARAMS="--device=zelda --no-la --no-sleep-images" flash
2323
```
2424

25+
### Retro-Go Command
2526

2627

27-
### Retro-Go Command
28+
```bash
29+
make clean
30+
make -j8 INTFLASH_BANK=2 EXTFLASH_SIZE=1794336 EXTFLASH_OFFSET=860160 ADAPTER=stlink GNW_TARGET=zelda flash
31+
```
32+
33+
34+
# Bank Stacking
35+
If you want to run additional homebrew, such as [Zelda3 (LttP)](https://github.com/marian-m12l/game-and-watch-zelda3), in Bank 2, it's possible to have *both* retro-go and the stock firmware in Bank 1.
36+
37+
### Patch Command
38+
39+
Run the following in this repo:
40+
41+
```bash
42+
make clean
43+
make PATCH_PARAMS="--device=zelda --no-la --no-sleep-images" flash
44+
```
2845

29-
Run the following in the retro-go repo:
46+
This will setup storage in the following way:
47+
1. INTFLASH BANK 1 - First 128KB - Stock Firmware
48+
2. INTFLASH Bank 1 - Second 128KB - Free (put Retro-Go intflash here)
49+
3. INTFLASH BANK 2 - Full 256KB - Free (put Zelda3 intflash here)
50+
4. EXTFLASH OFFSET 3301376; 794624 Free (put retro-go extflash here)
51+
5. EXTFLASH OFFSET 860160; 1794336 Free (put Zelda3 extflash here)
52+
53+
### Retro-go Command
54+
Run the following in the [sylverb/game-and-watch-retro-go](https://github.com/sylverb/game-and-watch-retro-go) repo:
3055

3156
```bash
3257
make clean
33-
make -j8 INTFLASH_BANK=2 EXTFLASH_SIZE=1802240 EXTFLASH_OFFSET=851968 GNW_TARGET=zelda EXTENDED=1 flash
58+
make -j8 INTFLASH_ADDRESS=0x08020000 EXTFLASH_SIZE=794624 EXTFLASH_OFFSET=3301376 GNW_TARGET=zelda BIG_BANK=0 flash
59+
```
60+
61+
### Zelda3 Command
62+
In the Zelda3 repo, after copying `zelda3.sfc` to `zelda3/tables/zelda3.sfc`, run the following commands:
63+
64+
```bash
65+
cd zelda3
66+
make tables/zelda3_assets.dat
67+
cd ..
68+
python3 ./scripts/bundle_all_assets.py
69+
python3 ./scripts/update_all_assets.py
70+
make -j8 INTFLASH_BANK=2 EXTFLASH_SIZE=1703936 EXTFLASH_OFFSET=868352 ADAPTER=stlink GNW_TARGET=zelda flash
3471
```

patches/zelda.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
3838
0xD0000 0xD2000 LoZ2 Timer stuff?
3939
40-
0xD2000 0x1F4C00 LA ROMs
40+
0xD2000 0x1F4C00 LA ROMs (1,190,912 bytes)
4141
42-
0x1f4c00 0x288120 The 11 Backdrop Images
42+
0x1f4c00 0x288120 The 11 Backdrop Images (603,424 bytes)
4343
4444
0x288120 0x325490 ???
4545
46-
0x325490 0x3e8000 Empty
46+
0x325490 0x3e8000 Empty (797,552 bytes)
4747
4848
0x3e8000 0x3F0000 Launched LA, didn't save. Generic GB stuff?
4949
0x3F0000 0x400000 Empty

0 commit comments

Comments
 (0)