GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

Macros | Functions | Variables
hardware.h File Reference
`#include <types.h>`

Go to the source code of this file.

## Macros
#define | __SHADOW_REG extern volatile uint8_t
#define | __REG(addr) volatile __at (addr) uint8_t
#define | PPUCTRL_NMI 0b10000000
#define | PPUCTRL_SPR_8X8 0b00000000
#define | PPUCTRL_SPR_8X16 0b00100000
#define | PPUCTRL_BG_CHR 0b00010000
#define | PPUCTRL_SPR_CHR 0b00001000
#define | PPUCTRL_INC32 0b00000100
#define | PPUMASK_BLUE 0b10000000
#define | PPUMASK_RED 0b01000000
#define | PPUMASK_GREEN 0b00100000
#define | PPUMASK_SHOW_SPR 0b00010000
#define | PPUMASK_SHOW_BG 0b00001000
#define | PPUMASK_SHOW_SPR_LC 0b00000100
#define | PPUMASK_SHOW_BG_LC 0b00000010
#define | PPUMASK_MONOCHROME 0b00000001
#define | DEVICE_SCREEN_X_OFFSET 0
#define | DEVICE_SCREEN_Y_OFFSET 0
#define | DEVICE_SCREEN_WIDTH 32
#define | DEVICE_SCREEN_HEIGHT 30
#define | DEVICE_SCREEN_BUFFER_WIDTH 32
#define | DEVICE_SCREEN_BUFFER_HEIGHT 30
#define | DEVICE_SCREEN_MAP_ENTRY_SIZE 1
#define | DEVICE_SPRITE_PX_OFFSET_X 0
#define | DEVICE_SPRITE_PX_OFFSET_Y -1
#define | DEVICE_WINDOW_PX_OFFSET_X 0
#define | DEVICE_WINDOW_PX_OFFSET_Y 0
#define | DEVICE_SCREEN_PX_WIDTH (DEVICE_SCREEN_WIDTH * 8)
#define | DEVICE_SCREEN_PX_HEIGHT (DEVICE_SCREEN_HEIGHT * 8)
#define | SCY_REG bkg_scroll_y
#define | rSCY SCY_REG
#define | SCX_REG bkg_scroll_x
#define | rSCX SCX_REG
#define | LY_REG _lcd_scanline
#define | rLY LY_REG
#define | LYC_REG _lcd_scanline
#define | rLYC LYC_REG

## Functions
| __REG (0x2000) PPUCTRL
| __REG (0x2001) PPUMASK
| __REG (0x2002) PPUSTATUS
| __REG (0x2003) OAMADDR
| __REG (0x2004) OAMDATA
| __REG (0x2005) PPUSCROLL
| __REG (0x2006) PPUADDR
| __REG (0x2007) PPUDATA
| __REG (0x4014) OAMDMA

## Variables
__SHADOW_REG | shadow_PPUCTRL
__SHADOW_REG | shadow_PPUMASK
__SHADOW_REG | bkg_scroll_x
__SHADOW_REG | bkg_scroll_y
__SHADOW_REG | _lcd_scanline
volatile UBYTE | TIMA_REG
volatile UBYTE | TMA_REG
volatile UBYTE | TAC_REG

## Detailed Description

Defines that let the NES hardware registers be accessed from C.

## Macro Definition Documentation

## ◆ __SHADOW_REG

#define __SHADOW_REG extern volatile uint8_t

## ◆ __REG

#define __REG | ( |  | addr | ) | volatile __at (addr) uint8_t

## ◆ PPUCTRL_NMI

#define PPUCTRL_NMI 0b10000000

## ◆ PPUCTRL_SPR_8X8

#define PPUCTRL_SPR_8X8 0b00000000

## ◆ PPUCTRL_SPR_8X16

#define PPUCTRL_SPR_8X16 0b00100000

## ◆ PPUCTRL_BG_CHR

#define PPUCTRL_BG_CHR 0b00010000

## ◆ PPUCTRL_SPR_CHR

#define PPUCTRL_SPR_CHR 0b00001000

## ◆ PPUCTRL_INC32

#define PPUCTRL_INC32 0b00000100

## ◆ PPUMASK_BLUE

#define PPUMASK_BLUE 0b10000000

## ◆ PPUMASK_RED

#define PPUMASK_RED 0b01000000

## ◆ PPUMASK_GREEN

#define PPUMASK_GREEN 0b00100000

## ◆ PPUMASK_SHOW_SPR

#define PPUMASK_SHOW_SPR 0b00010000

## ◆ PPUMASK_SHOW_BG

#define PPUMASK_SHOW_BG 0b00001000

## ◆ PPUMASK_SHOW_SPR_LC

#define PPUMASK_SHOW_SPR_LC 0b00000100

## ◆ PPUMASK_SHOW_BG_LC

#define PPUMASK_SHOW_BG_LC 0b00000010

## ◆ PPUMASK_MONOCHROME

#define PPUMASK_MONOCHROME 0b00000001

## ◆ DEVICE_SCREEN_X_OFFSET

#define DEVICE_SCREEN_X_OFFSET 0

## ◆ DEVICE_SCREEN_Y_OFFSET

#define DEVICE_SCREEN_Y_OFFSET 0

## ◆ DEVICE_SCREEN_WIDTH

#define DEVICE_SCREEN_WIDTH 32

## ◆ DEVICE_SCREEN_HEIGHT

#define DEVICE_SCREEN_HEIGHT 30

## ◆ DEVICE_SCREEN_BUFFER_WIDTH

#define DEVICE_SCREEN_BUFFER_WIDTH 32

## ◆ DEVICE_SCREEN_BUFFER_HEIGHT

#define DEVICE_SCREEN_BUFFER_HEIGHT 30

## ◆ DEVICE_SCREEN_MAP_ENTRY_SIZE

#define DEVICE_SCREEN_MAP_ENTRY_SIZE 1

## ◆ DEVICE_SPRITE_PX_OFFSET_X

#define DEVICE_SPRITE_PX_OFFSET_X 0

## ◆ DEVICE_SPRITE_PX_OFFSET_Y

#define DEVICE_SPRITE_PX_OFFSET_Y -1

## ◆ DEVICE_WINDOW_PX_OFFSET_X

#define DEVICE_WINDOW_PX_OFFSET_X 0

## ◆ DEVICE_WINDOW_PX_OFFSET_Y

#define DEVICE_WINDOW_PX_OFFSET_Y 0

## ◆ DEVICE_SCREEN_PX_WIDTH

#define DEVICE_SCREEN_PX_WIDTH (DEVICE_SCREEN_WIDTH * 8)

## ◆ DEVICE_SCREEN_PX_HEIGHT

#define DEVICE_SCREEN_PX_HEIGHT (DEVICE_SCREEN_HEIGHT * 8)

## ◆ SCY_REG

#define SCY_REG bkg_scroll_y

Scroll Y

## ◆ rSCY

#define rSCY SCY_REG

## ◆ SCX_REG

#define SCX_REG bkg_scroll_x

Scroll X

## ◆ rSCX

#define rSCX SCX_REG

## ◆ LY_REG

#define LY_REG _lcd_scanline

LCDC Y-coordinate

## ◆ rLY

#define rLY LY_REG

## ◆ LYC_REG

#define LYC_REG _lcd_scanline

LY compare

## ◆ rLYC

#define rLYC LYC_REG

## Function Documentation

## ◆ __REG() [1/9]

__REG | ( | 0x2000 |  | ) |

## ◆ __REG() [2/9]

__REG | ( | 0x2001 |  | ) |

## ◆ __REG() [3/9]

__REG | ( | 0x2002 |  | ) |

## ◆ __REG() [4/9]

__REG | ( | 0x2003 |  | ) |

## ◆ __REG() [5/9]

__REG | ( | 0x2004 |  | ) |

## ◆ __REG() [6/9]

__REG | ( | 0x2005 |  | ) |

## ◆ __REG() [7/9]

__REG | ( | 0x2006 |  | ) |

## ◆ __REG() [8/9]

__REG | ( | 0x2007 |  | ) |

## ◆ __REG() [9/9]

__REG | ( | 0x4014 |  | ) |

## Variable Documentation

## ◆ shadow_PPUCTRL

__SHADOW_REG shadow_PPUCTRL

## ◆ shadow_PPUMASK

__SHADOW_REG shadow_PPUMASK

## ◆ bkg_scroll_x

__SHADOW_REG bkg_scroll_x

## ◆ bkg_scroll_y

__SHADOW_REG bkg_scroll_y

## ◆ _lcd_scanline

__SHADOW_REG _lcd_scanline

## ◆ TIMA_REG

volatile UBYTE TIMA_REG
| extern

Timer counter

## ◆ TMA_REG

volatile UBYTE TMA_REG
| extern

Timer modulo

## ◆ TAC_REG

volatile UBYTE TAC_REG
| extern

Timer control