GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
hardware.h
Go to the documentation of this file.
1 
5 #ifndef _HARDWARE_H
6 #define _HARDWARE_H
7 
8 #include <types.h>
9 
10 #define __SHADOW_REG extern volatile uint8_t
11 #define __REG(addr) volatile __at (addr) uint8_t
12 
13 __REG(0x2000) PPUCTRL;
14 #define PPUCTRL_NMI 0b10000000
15 #define PPUCTRL_SPR_8X8 0b00000000
16 #define PPUCTRL_SPR_8X16 0b00100000
17 #define PPUCTRL_BG_CHR 0b00010000
18 #define PPUCTRL_SPR_CHR 0b00001000
19 #define PPUCTRL_INC32 0b00000100
21 
22 __REG(0x2001) PPUMASK;
23 #define PPUMASK_BLUE 0b10000000
24 #define PPUMASK_RED 0b01000000
25 #define PPUMASK_GREEN 0b00100000
26 #define PPUMASK_SHOW_SPR 0b00010000
27 #define PPUMASK_SHOW_BG 0b00001000
28 #define PPUMASK_SHOW_SPR_LC 0b00000100
29 #define PPUMASK_SHOW_BG_LC 0b00000010
30 #define PPUMASK_MONOCHROME 0b00000001
32 
33 __REG(0x2002) PPUSTATUS;
34 __REG(0x2003) OAMADDR;
35 __REG(0x2004) OAMDATA;
36 __REG(0x2005) PPUSCROLL;
37 __REG(0x2006) PPUADDR;
38 __REG(0x2007) PPUDATA;
39 __REG(0x4014) OAMDMA;
40 
41 #define DEVICE_SCREEN_X_OFFSET 0
42 #define DEVICE_SCREEN_Y_OFFSET 0
43 #define DEVICE_SCREEN_WIDTH 32
44 #define DEVICE_SCREEN_HEIGHT 30
45 #define DEVICE_SCREEN_BUFFER_WIDTH 32
46 #define DEVICE_SCREEN_BUFFER_HEIGHT 30
47 #define DEVICE_SCREEN_MAP_ENTRY_SIZE 1
48 #define DEVICE_SPRITE_PX_OFFSET_X 0
49 #define DEVICE_SPRITE_PX_OFFSET_Y -1
50 #define DEVICE_WINDOW_PX_OFFSET_X 0
51 #define DEVICE_WINDOW_PX_OFFSET_Y 0
52 #define DEVICE_SCREEN_PX_WIDTH (DEVICE_SCREEN_WIDTH * 8)
53 #define DEVICE_SCREEN_PX_HEIGHT (DEVICE_SCREEN_HEIGHT * 8)
54 
55 // Scrolling coordinates (will be written to PPUSCROLL at end-of-vblank by NMI handler)
58 
59 #endif
#define __REG(addr)
Definition: hardware.h:11
__SHADOW_REG shadow_PPUMASK
Definition: hardware.h:31
__SHADOW_REG bkg_scroll_x
Definition: hardware.h:56
__SHADOW_REG bkg_scroll_y
Definition: hardware.h:57
#define __SHADOW_REG
Definition: hardware.h:10
__SHADOW_REG shadow_PPUCTRL
Definition: hardware.h:20