Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/part3/entry-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ We'll start this tutorial out like the previous, with our "header" section (at a
{{#include ../../galactic-armada/src/main/GalacticArmada.asm:entry-point}}
```

after our `EntryPoint` label, well do the following:
After our `EntryPoint` label, we'll do the following:

- set our default game state
- initiate [gb-sprobj-lib](https://github.com/eievui5/gb-sprobj-lib), the sprite library we're going to use
- setup our display registers
- set up our display registers
- load tile data for our font into VRAM.

The tile data we are going to load is used by all game states, which is why we'll do it here & now, for them all to use.

<img class="pixelated" src="../assets/part3/img/text-font-large.png">

This character-set is called “Area51”. It, and more 8x8 pixel fonts can ne found here: [https://damieng.com/typography/zx-origins/](https://damieng.com/typography/zx-origins/) . These 52 tiles will be placed at the beginning of our background/window VRAM region.
This character-set is called “Area51”. It, and more 8x8 pixel fonts can be found here: [https://damieng.com/typography/zx-origins/](https://damieng.com/typography/zx-origins/). These 52 tiles will be placed at the beginning of our background/window VRAM region.

![TextFontDiagram.png](../assets/part3/img/TextFontDiagram.png)

One important thing to note. Character maps for each letter must be defined. This let’s RGBDS know what byte value to give a specific letter.
One important thing to note. Character maps for each letter must be defined. This lets RGBDS know what byte value to give a specific letter.

For the Galactic Armada space mapping, we’re going off the “text-font.png” image. Our space character is the first character in VRAM. Our alphabet starts at 26. Special additions could be added if desired. For now, this is all that we’ll need. We'll define that map in "src/main/utils/macros/text-macros.inc".

```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/utils/macros/text-macros.inc:charmap}}
{{#include ../../galactic-armada/src/main/utils/macros/text-macros.inc:charmap}}
```

Getting back to our entry point. Were going to wait until a vertical blank begins to do all of this. We'll also turn the LCD off before loading our tile data into VRAM..
Getting back to our entry point. We're going to wait until a vertical blank begins to do all of this. We'll also turn the LCD off before loading our tile data into VRAM.

```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/GalacticArmada.asm:entry-point-end}}
{{#include ../../galactic-armada/src/main/GalacticArmada.asm:entry-point-end}}
Expand All @@ -50,10 +50,10 @@ Instead of `ld a, 0`, we can use `xor a` to set `a` to 0. It takes one byte less

:::

In the above snippet you saw use of a function called `WaitFOrOneVBLank`. We've setup some vblank utility functions in the "src/main/utils/vblank-utils.asm" file:
In the above snippet you saw use of a function called `WaitForOneVBlank`. We've set up some vblank utility functions in the "src/main/utils/vblank-utils.asm" file:

```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/utils/vblank-utils.asm:vblank-utils}}
{{#include ../../galactic-armada/src/main/utils/vblank-utils.asm:vblank-utils}}
```

In the next section, we'll go on next to setup our `NextGameState` label. Which is used for changing game states.
In the next section, we'll go on next to set up our `NextGameState` label. Which is used for changing game states.
2 changes: 1 addition & 1 deletion src/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ The following should prove useful along the rest of your journey!
- [RGBDS' online documentation](https://rgbds.gbdev.io/docs/) is always useful!
Notably, you'll find [an instruction reference](https://rgbds.gbdev.io/docs/gbz80.7) and [the reference on RGBASM's syntax and features](https://rgbds.gbdev.io/docs/rgbasm.5).
- [Pan Docs](https://gbdev.io/pandocs) are _the_ reference for all Game Boy hardware.
It's a good idea to consult it if you aare unsure how a register works, or if you're wondering how to do something.
It's a good idea to consult it if you are unsure how a register works, or if you're wondering how to do something.
- [gb-optables](https://gbdev.io/gb-opcodes/optables) is a more compact instruction table, it becomes more useful when you stop needing the instructions' descriptions.