Skip to content

Commit 9131b27

Browse files
author
starprograms
committed
Merge branch 'master' of github.com:OnStarPrograms/gb-asm-tutorial
2 parents 879e375 + 13ce665 commit 9131b27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+15390
-1354
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install mdbook
2424
uses: peaceiris/actions-mdbook@v1
2525
with:
26-
mdbook-version: latest
26+
mdbook-version: 0.4.52
2727

2828
- name: Install static-sitemap-cli
2929
run: npm install static-sitemap-cli
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build Unbricked example code
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Download and extract RGBDS v1.0.0
14+
shell: bash
15+
run: |
16+
set -euo pipefail
17+
18+
RGBDS_URL="https://github.com/gbdev/rgbds/releases/download/v1.0.0/rgbds-linux-x86_64.tar.xz"
19+
DEST_DIR="$RUNNER_TEMP/rgbds"
20+
21+
mkdir -p "$DEST_DIR"
22+
curl -L --fail --retry 3 -o "$RUNNER_TEMP/rgbds.tar.xz" "$RGBDS_URL"
23+
tar -xJf "$RUNNER_TEMP/rgbds.tar.xz" -C "$DEST_DIR"
24+
25+
# Add extracted folder to PATH for later steps
26+
echo "$DEST_DIR" >> "$GITHUB_PATH"
27+
28+
- name: Run build script
29+
shell: bash
30+
run: |
31+
set -euo pipefail
32+
cd unbricked
33+
chmod +x ./build_all.sh
34+
./build_all.sh

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
/galactic-armada/src/generated
66
/galactic-armada/dist/
77
/galactic-armada/obj/
8-
.idea
8+
.idea
9+
*.gb
10+
*.o

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
1-
# GB ASM tutorial (v2)
1+
# GB ASM tutorial
22

3-
Re-doing [GB ASM Tutorial](https://github.com/ISSOtm/gb-asm-tutorial-old), and this time, until the end.
3+
A book that teaches how to develop games for the Game Boy and Game Boy Color using assembly language and the RGBDS toolchain.
44

5-
## Translating
6-
7-
To help translate the tutorial, join the [project on Crowdin](https://crowdin.com/project/gb-asm-tutorial).
5+
You can read it at https://gbdev.io/gb-asm-tutorial/.
86

97
## Contributing
108

119
Contributing is really easy, fork this repo and edit the files in the **src** directory. Then, you can send your PR.
1210

1311
To deploy gb-asm-tutorial locally:
1412

15-
1. Install [Rust](https://www.rust-lang.org/tools/install) and [mdBook](https://github.com/rust-lang/mdBook#readme).
13+
1. Install [Rust](https://www.rust-lang.org/tools/install) and [mdBook](https://github.com/rust-lang/mdBook#readme) (v0.4.x).
1614
mdBook powers the book itself, Rust is used for some custom plugins.
15+
```bash
16+
$ cargo install mdbook@0.4.52
1717
```
18-
$ cargo install mdbook
19-
```
20-
2. Within a terminal pointed at the directory `book.toml` is in, run mdBook (`mdbook build` / `mdbook watch` / `mdbook serve`).
21-
3. The HTML files are in `book/custom/`.
18+
2. Within a terminal pointed at the directory `book.toml` is in, run mdBook commands:
19+
20+
```bash
21+
# Watches the book's src directory for changes, rebuild the book, serve it on localhost:3000
22+
# and refresh clients for each change.
23+
mdbook serve
2224

25+
# Produce a build in `book/custom/`
26+
mdbook build
27+
# Watch your files and trigger a build automatically whenever you modify a file.
28+
mdbook watch
29+
```
30+
31+
## Translating
32+
33+
To help translate the tutorial, join the [project on Crowdin](https://crowdin.com/project/gb-asm-tutorial).
2334

2435
## License
2536

galactic-armada/src/main/states/gameplay/objects/player.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ MoveUp:
234234
sub PLAYER_MOVE_SPEED
235235
ld [wPlayerPositionY], a
236236

237-
ld a, [wPlayerPositionY]
237+
ld a, [wPlayerPositionY+1]
238238
sbc 0
239-
ld [wPlayerPositionY], a
239+
ld [wPlayerPositionY+1], a
240240

241241
ret
242242

src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
- [Input](part2/input.md)
3030
- [Collision](part2/collision.md)
3131
- [Bricks](part2/bricks.md)
32+
- [Title Screen](part2/title-screen.md)
3233
- [Decimal Numbers](part2/bcd.md)
34+
- [Serial Link](part2/serial-link.md)
3335
- [Work in progress](part2/wip.md)
3436

3537
# Part III — Our second game

src/assets/hello-world.asm

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ EntryPoint:
1919
WaitVBlank:
2020
ld a, [rLY]
2121
cp 144
22-
jp c, WaitVBlank
22+
jr c, WaitVBlank
2323

2424
; Turn the LCD off
2525
ld a, 0
@@ -29,7 +29,7 @@ WaitVBlank:
2929
; Copy the tile data
3030
ld de, Tiles
3131
ld hl, $9000
32-
ld bc, TilesEnd - Tiles
32+
ld bc, Tiles.End - Tiles
3333
CopyTiles:
3434
; ANCHOR: memcpy_first_two
3535
ld a, [de]
@@ -39,24 +39,24 @@ CopyTiles:
3939
dec bc
4040
ld a, b
4141
or a, c
42-
jp nz, CopyTiles
42+
jr nz, CopyTiles
4343
; ANCHOR_END: memcpy
4444

4545
; Copy the tilemap
4646
ld de, Tilemap
4747
ld hl, $9800
48-
ld bc, TilemapEnd - Tilemap
48+
ld bc, Tilemap.End - Tilemap
4949
CopyTilemap:
5050
ld a, [de]
5151
ld [hli], a
5252
inc de
5353
dec bc
5454
ld a, b
5555
or a, c
56-
jp nz, CopyTilemap
56+
jr nz, CopyTilemap
5757

5858
; Turn the LCD on
59-
ld a, LCDCF_ON | LCDCF_BGON
59+
ld a, LCDC_ON | LCDC_BG_ON
6060
ld [rLCDC], a
6161

6262
; During the first (blank) frame, initialize display registers
@@ -66,11 +66,12 @@ CopyTilemap:
6666
; ANCHOR_END: bgp_write
6767

6868
Done:
69-
jp Done
69+
jr Done
7070

7171

7272
SECTION "Tile data", ROM0
7373

74+
; ANCHOR: tiles
7475
Tiles:
7576
db $00,$ff, $00,$ff, $00,$ff, $00,$ff, $00,$ff, $00,$ff, $00,$ff, $00,$ff
7677
db $00,$ff, $00,$80, $00,$80, $00,$80, $00,$80, $00,$80, $00,$80, $00,$80
@@ -142,10 +143,12 @@ Tiles:
142143
db $54,$ff, $aa,$ff, $54,$ff, $aa,$ff, $54,$ff, $aa,$ff, $54,$ff, $00,$ff
143144
db $15,$ff, $2a,$ff, $15,$ff, $0a,$ff, $15,$ff, $0a,$ff, $01,$ff, $00,$ff
144145
db $01,$ff, $80,$ff, $01,$ff, $80,$ff, $01,$ff, $80,$ff, $01,$ff, $00,$ff
145-
TilesEnd:
146+
.End:
147+
; ANCHOR_END: tiles
146148

147149
SECTION "Tilemap", ROM0
148150

151+
; ANCHOR: tilemap
149152
Tilemap:
150153
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, 0,0,0,0,0,0,0,0,0,0,0,0
151154
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, 0,0,0,0,0,0,0,0,0,0,0,0
@@ -165,4 +168,5 @@ Tilemap:
165168
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, 0,0,0,0,0,0,0,0,0,0,0,0
166169
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, 0,0,0,0,0,0,0,0,0,0,0,0
167170
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, 0,0,0,0,0,0,0,0,0,0,0,0
168-
TilemapEnd:
171+
.End:
172+
; ANCHOR_END: tilemap
12.6 KB
Loading

0 commit comments

Comments
 (0)