Skip to content

Commit

Permalink
adding more pandocs links
Browse files Browse the repository at this point in the history
removing wait until vblank over
  • Loading branch information
LaroldsJubilantJunkyard committed Nov 21, 2023
1 parent b04499d commit 45fa558
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,10 @@ To check for the vertical blank phase, use the `rLY` register. Compare that regi
WaitUntilVerticalBlankStart:
ld a, [rLY]
cp 144
jp nc, WaitUntilVerticalBlankStart
```

To wait until the vertical blank phase is finished, you can use a similar code snippet:

```rgbasm,linenos
WaitUntilVerticalBlankEnd:
ld a, [rLY]
cp 144
jp c, WaitUntilVerticalBlankEnd
jp c, WaitUntilVerticalBlankStart
```

The only difference being the condition for the jump command.

> **Note:** To wait until the vertical blank phase is finished, you would use a code-snippet like the one above. Except you would continue looping until `rLY` is **less than** 144 (when `cp 144` has no carry-over)
### How to turn on/off the LCD Display

You can turn the LCD on and off by altering the most significant bit controls the state of the `rLCDC` register. Hardware.inc also has constants for altering that bit: `LCDCF_ON` and `LCDCF_OFF`.
Expand Down Expand Up @@ -255,7 +245,7 @@ ld [rSCX], a
ld a,64
ld [rSCY], a
```

Check out the Pan Docs for more info on the [Background viewport Y position, X position](https://gbdev.io/pandocs/Scrolling.html#ff42ff43--scy-scx-background-viewport-y-position-x-position)
### How to move the window

Moving the window is the same as moving the background, except using the `$FF4B` and `$FF4A` registers. Hardware.inc defines two constants for that: `rWX` and `rWY`.
Expand All @@ -275,11 +265,10 @@ ld a,64
ld [rWY], a
```


Check out the Pan Docs for more info on the [WY, WX: Window Y position, X position plus 7](https://gbdev.io/pandocs/Scrolling.html#ff4aff4b--wy-wx-window-y-position-x-position-plus-7)
## Joypad Input

Reading joypad input is not a trivial task. For more info see [Tutorial #2](https://gbdev.io/gb-asm-tutorial/part2/input.html). Paste this code somewhere in your project:

Reading joypad input is not a trivial task. For more info see [Tutorial #2](https://gbdev.io/gb-asm-tutorial/part2/input.html), or the [Joypad Input Page](https://gbdev.io/pandocs/Joypad_Input.html) in the Pan Docs. Paste this code somewhere in your project:

```rgbasm,linenos,start={{#line_no_of "" ../unbricked/input/main.asm:input-routine}}
{{#include ../unbricked/input/main.asm:input-routine}}
Expand Down Expand Up @@ -501,6 +490,8 @@ Each harware sprite has 4 bytes: (in this order)
- Tile ID
- Flags/Props (priority, y flip, x flip, palette 0 [DMG], palette 1 [DMG], bank 0 [GBC], bank 1 [GBC])

Check out the Pan Docs page on [Object Attribute Memory (OAM)](https://gbdev.io/pandocs/OAM.html) for more info.

The bytes controlling hardware OAM sprites start at `$FE00`, for which hardware.inc has defined a constant as `_OAMRAM`.

**Moving (the first) OAM sprite, one pixel downwards:**
Expand Down

0 comments on commit 45fa558

Please sign in to comment.