GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
hardware.h File Reference
#include <types.h>

Go to the source code of this file.

Macros

#define __BYTES   extern UBYTE
 
#define __BYTE_REG   extern volatile UBYTE
 
#define GGSTATE_STT   0b10000000
 
#define GGSTATE_NJAP   0b01000000
 
#define GGSTATE_NNTS   0b00100000
 
#define GGEXT_NINIT   0b10000000
 
#define SIOCTL_TXFL   0b00000001
 
#define SIOCTL_RXRD   0b00000010
 
#define SIOCTL_FRER   0b00000100
 
#define SIOCTL_INT   0b00001000
 
#define SIOCTL_TON   0b00010000
 
#define SIOCTL_RON   0b00100000
 
#define SIOCTL_BS0   0b01000000
 
#define SIOCTL_BS1   0b10000000
 
#define SOUNDPAN_TN1R   0b00000001
 
#define SOUNDPAN_TN2R   0b00000010
 
#define SOUNDPAN_TN3R   0b00000100
 
#define SOUNDPAN_NOSR   0b00001000
 
#define SOUNDPAN_TN1L   0b00010000
 
#define SOUNDPAN_TN2L   0b00100000
 
#define SOUNDPAN_TN3L   0b01000000
 
#define SOUNDPAN_NOSL   0b10000000
 
#define MEMCTL_JOYON   0b00000000
 
#define MEMCTL_JOYOFF   0b00000100
 
#define MEMCTL_BASEON   0b00000000
 
#define MEMCTL_BASEOFF   0b00001000
 
#define MEMCTL_RAMON   0b00000000
 
#define MEMCTL_RAMOFF   0b00010000
 
#define MEMCTL_CROMON   0b00000000
 
#define MEMCTL_CROMOFF   0b00100000
 
#define MEMCTL_ROMON   0b00000000
 
#define MEMCTL_ROMOFF   0b01000000
 
#define MEMCTL_EXTON   0b00000000
 
#define MEMCTL_EXTOFF   0b10000000
 
#define JOY_P1_TR_DIR_IN   0b00000001
 
#define JOY_P1_TR_DIR_OUT   0b00000000
 
#define JOY_P1_TH_DIR_IN   0b00000010
 
#define GUN_P1_LATCH   JOY_P1_TH_DIR_IN
 
#define JOY_P1_TH_DIR_OUT   0b00000000
 
#define JOY_P2_TR_DIR_IN   0b00000100
 
#define JOY_P2_TR_DIR_OUT   0b00000000
 
#define JOY_P2_TH_DIR_IN   0b00001000
 
#define GUN_P2_LATCH   JOY_P2_TH_DIR_IN
 
#define JOY_P2_TH_DIR_OUT   0b00000000
 
#define JOY_P1_TR_OUT_HI   0b00010000
 
#define JOY_P1_TR_OUT_LO   0b00000000
 
#define JOY_P1_TH_OUT_HI   0b00100000
 
#define JOY_P1_TH_OUT_LO   0b00000000
 
#define JOY_P2_TR_OUT_HI   0b01000000
 
#define JOY_P2_TR_OUT_LO   0b00000000
 
#define JOY_P2_TH_OUT_HI   0b10000000
 
#define JOY_P2_TH_OUT_LO   0b00000000
 
#define JOY_TH_HI   (JOY_P1_TR_DIR_IN | JOY_P1_TH_DIR_OUT | JOY_P2_TR_DIR_IN | JOY_P2_TH_DIR_OUT | JOY_P1_TR_OUT_HI | JOY_P1_TH_OUT_HI | JOY_P2_TR_OUT_HI | JOY_P2_TH_OUT_HI)
 
#define JOY_TH_LO   (JOY_P1_TR_DIR_IN | JOY_P1_TH_DIR_OUT | JOY_P2_TR_DIR_IN | JOY_P2_TH_DIR_OUT | JOY_P1_TR_OUT_HI | JOY_P1_TH_OUT_LO | JOY_P2_TR_OUT_HI | JOY_P2_TH_OUT_LO)
 
#define PSG_LATCH   0b10000000
 
#define PSG_CH0   0b00000000
 
#define PSG_CH1   0b00100000
 
#define PSG_CH2   0b01000000
 
#define PSG_CH3   0b01100000
 
#define PSG_VOLUME   0b00010000
 
#define STATF_INT_VBL   0b10000000
 
#define STATF_9_SPR   0b01000000
 
#define STATF_SPR_COLL   0b00100000
 
#define VDP_REG_MASK   0b10000000
 
#define VDP_R0   0b10000000
 
#define R0_VSCRL   0b00000000
 
#define R0_VSCRL_INH   0b10000000
 
#define R0_HSCRL   0b00000000
 
#define R0_HSCRL_INH   0b01000000
 
#define R0_NO_LCB   0b00000000
 
#define R0_LCB   0b00100000
 
#define R0_IE1_OFF   0b00000000
 
#define R0_IE1   0b00010000
 
#define R0_SS_OFF   0b00000000
 
#define R0_SS   0b00001000
 
#define R0_DEFAULT   0b00000110
 
#define R0_ES_OFF   0b00000000
 
#define R0_ES   0b00000001
 
#define VDP_R1   0b10000001
 
#define R1_DEFAULT   0b10000000
 
#define R1_DISP_OFF   0b00000000
 
#define R1_DISP_ON   0b01000000
 
#define R1_IE_OFF   0b00000000
 
#define R1_IE   0b00100000
 
#define R1_SPR_8X8   0b00000000
 
#define R1_SPR_8X16   0b00000010
 
#define VDP_R2   0b10000010
 
#define R2_MAP_0x3800   0xFF
 
#define R2_MAP_0x3000   0xFD
 
#define R2_MAP_0x2800   0xFB
 
#define R2_MAP_0x2000   0xF9
 
#define R2_MAP_0x1800   0xF7
 
#define R2_MAP_0x1000   0xF5
 
#define R2_MAP_0x0800   0xF3
 
#define R2_MAP_0x0000   0xF1
 
#define VDP_R3   0b10000011
 
#define VDP_R4   0b10000100
 
#define VDP_R5   0b10000101
 
#define R5_SAT_0x3F00   0xFF
 
#define R5_SAT_0x1F00   0xBF
 
#define R5_SAT_MASK   0b10000001
 
#define VDP_R6   0b10000110
 
#define R6_BANK0   0xFB
 
#define R6_DATA_0x0000   0xFB
 
#define R6_BANK1   0xFF
 
#define R6_DATA_0x2000   0xFF
 
#define VDP_R7   0b10000111
 
#define VDP_RBORDER   0b10000111
 
#define R7_COLOR_MASK   0b11110000
 
#define VDP_R8   0b10001000
 
#define VDP_RSCX   0b10001000
 
#define VDP_R9   0b10001001
 
#define VDP_RSCY   0b10001001
 
#define VDP_R10   0b10001010
 
#define R10_INT_OFF   0xFF
 
#define R10_INT_EVERY   0x00
 
#define JOY_P1_UP   0b00000001
 
#define JOY_P1_MD_Z   JOY_P1_UP
 
#define JOY_P1_DOWN   0b00000010
 
#define JOY_P1_MD_Y   JOY_P1_DOWN
 
#define JOY_P1_LEFT   0b00000100
 
#define JOY_P1_MD_X   JOY_P1_LEFT
 
#define JOY_P1_RIGHT   0b00001000
 
#define JOY_P1_MD_MODE   JOY_P1_RIGHT
 
#define JOY_P1_SW1   0b00010000
 
#define JOY_P1_TRIGGER   JOY_P1_SW1
 
#define JOY_P1_MD_A   JOY_P1_SW1
 
#define JOY_P1_SW2   0b00100000
 
#define JOY_P1_MD_START   JOY_P1_SW2
 
#define JOY_P2_UP   0b01000000
 
#define JOY_P2_MD_Z   JOY_P2_UP
 
#define JOY_P2_DOWN   0b10000000
 
#define JOY_P2_MD_Y   JOY_P2_DOWN
 
#define JOY_P2_LEFT   0b00000001
 
#define JOY_P2_MD_X   JOY_P2_LEFT
 
#define JOY_P2_RIGHT   0b00000010
 
#define JOY_P2_MD_MODE   JOY_P2_RIGHT
 
#define JOY_P2_SW1   0b00000100
 
#define JOY_P2_TRIGGER   JOY_P2_SW1
 
#define JOY_P2_MD_A   JOY_P2_SW1
 
#define JOY_P2_SW2   0b00001000
 
#define JOY_P2_MD_START   JOY_P2_SW2
 
#define JOY_RESET   0b00010000
 
#define JOY_P1_LIGHT   0b01000000
 
#define JOY_P2_LIGHT   0b10000000
 
#define RAMCTL_BANK   0b00000100
 
#define RAMCTL_ROM   0b00000000
 
#define RAMCTL_RAM   0b00001000
 
#define RAMCTL_RO   0b00010000
 
#define RAMCTL_PROT   0b10000000
 
#define VBK_TILES   0
 
#define VBK_ATTRIBUTES   1
 
#define VDP_SAT_TERM   0xD0
 
#define DEVICE_SCREEN_PX_WIDTH   (DEVICE_SCREEN_WIDTH * 8)
 
#define DEVICE_SCREEN_PX_HEIGHT   (DEVICE_SCREEN_HEIGHT * 8)
 

Variables

UBYTE shadow_VDP_R0
 
UBYTE shadow_VDP_R1
 
UBYTE shadow_VDP_R2
 
UBYTE shadow_VDP_R3
 
UBYTE shadow_VDP_R4
 
UBYTE shadow_VDP_R5
 
UBYTE shadow_VDP_R6
 
UBYTE shadow_VDP_R7
 
UBYTE shadow_VDP_RBORDER
 
UBYTE shadow_VDP_R8
 
UBYTE shadow_VDP_RSCX
 
UBYTE shadow_VDP_R9
 
UBYTE shadow_VDP_RSCY
 
UBYTE shadow_VDP_R10
 
volatile UBYTE VDP_ATTR_SHIFT
 

Detailed Description

Defines that let the SMS/GG hardware registers be accessed from C.

Macro Definition Documentation

◆ __BYTES

#define __BYTES   extern UBYTE

◆ __BYTE_REG

#define __BYTE_REG   extern volatile UBYTE

◆ GGSTATE_STT

#define GGSTATE_STT   0b10000000

◆ GGSTATE_NJAP

#define GGSTATE_NJAP   0b01000000

◆ GGSTATE_NNTS

#define GGSTATE_NNTS   0b00100000

◆ GGEXT_NINIT

#define GGEXT_NINIT   0b10000000

◆ SIOCTL_TXFL

#define SIOCTL_TXFL   0b00000001

◆ SIOCTL_RXRD

#define SIOCTL_RXRD   0b00000010

◆ SIOCTL_FRER

#define SIOCTL_FRER   0b00000100

◆ SIOCTL_INT

#define SIOCTL_INT   0b00001000

◆ SIOCTL_TON

#define SIOCTL_TON   0b00010000

◆ SIOCTL_RON

#define SIOCTL_RON   0b00100000

◆ SIOCTL_BS0

#define SIOCTL_BS0   0b01000000

◆ SIOCTL_BS1

#define SIOCTL_BS1   0b10000000

◆ SOUNDPAN_TN1R

#define SOUNDPAN_TN1R   0b00000001

◆ SOUNDPAN_TN2R

#define SOUNDPAN_TN2R   0b00000010

◆ SOUNDPAN_TN3R

#define SOUNDPAN_TN3R   0b00000100

◆ SOUNDPAN_NOSR

#define SOUNDPAN_NOSR   0b00001000

◆ SOUNDPAN_TN1L

#define SOUNDPAN_TN1L   0b00010000

◆ SOUNDPAN_TN2L

#define SOUNDPAN_TN2L   0b00100000

◆ SOUNDPAN_TN3L

#define SOUNDPAN_TN3L   0b01000000

◆ SOUNDPAN_NOSL

#define SOUNDPAN_NOSL   0b10000000

◆ MEMCTL_JOYON

#define MEMCTL_JOYON   0b00000000

◆ MEMCTL_JOYOFF

#define MEMCTL_JOYOFF   0b00000100

◆ MEMCTL_BASEON

#define MEMCTL_BASEON   0b00000000

◆ MEMCTL_BASEOFF

#define MEMCTL_BASEOFF   0b00001000

◆ MEMCTL_RAMON

#define MEMCTL_RAMON   0b00000000

◆ MEMCTL_RAMOFF

#define MEMCTL_RAMOFF   0b00010000

◆ MEMCTL_CROMON

#define MEMCTL_CROMON   0b00000000

◆ MEMCTL_CROMOFF

#define MEMCTL_CROMOFF   0b00100000

◆ MEMCTL_ROMON

#define MEMCTL_ROMON   0b00000000

◆ MEMCTL_ROMOFF

#define MEMCTL_ROMOFF   0b01000000

◆ MEMCTL_EXTON

#define MEMCTL_EXTON   0b00000000

◆ MEMCTL_EXTOFF

#define MEMCTL_EXTOFF   0b10000000

◆ JOY_P1_TR_DIR_IN

#define JOY_P1_TR_DIR_IN   0b00000001

◆ JOY_P1_TR_DIR_OUT

#define JOY_P1_TR_DIR_OUT   0b00000000

◆ JOY_P1_TH_DIR_IN

#define JOY_P1_TH_DIR_IN   0b00000010

◆ GUN_P1_LATCH

#define GUN_P1_LATCH   JOY_P1_TH_DIR_IN

◆ JOY_P1_TH_DIR_OUT

#define JOY_P1_TH_DIR_OUT   0b00000000

◆ JOY_P2_TR_DIR_IN

#define JOY_P2_TR_DIR_IN   0b00000100

◆ JOY_P2_TR_DIR_OUT

#define JOY_P2_TR_DIR_OUT   0b00000000

◆ JOY_P2_TH_DIR_IN

#define JOY_P2_TH_DIR_IN   0b00001000

◆ GUN_P2_LATCH

#define GUN_P2_LATCH   JOY_P2_TH_DIR_IN

◆ JOY_P2_TH_DIR_OUT

#define JOY_P2_TH_DIR_OUT   0b00000000

◆ JOY_P1_TR_OUT_HI

#define JOY_P1_TR_OUT_HI   0b00010000

◆ JOY_P1_TR_OUT_LO

#define JOY_P1_TR_OUT_LO   0b00000000

◆ JOY_P1_TH_OUT_HI

#define JOY_P1_TH_OUT_HI   0b00100000

◆ JOY_P1_TH_OUT_LO

#define JOY_P1_TH_OUT_LO   0b00000000

◆ JOY_P2_TR_OUT_HI

#define JOY_P2_TR_OUT_HI   0b01000000

◆ JOY_P2_TR_OUT_LO

#define JOY_P2_TR_OUT_LO   0b00000000

◆ JOY_P2_TH_OUT_HI

#define JOY_P2_TH_OUT_HI   0b10000000

◆ JOY_P2_TH_OUT_LO

#define JOY_P2_TH_OUT_LO   0b00000000

◆ JOY_TH_HI

◆ JOY_TH_LO

◆ PSG_LATCH

#define PSG_LATCH   0b10000000

◆ PSG_CH0

#define PSG_CH0   0b00000000

◆ PSG_CH1

#define PSG_CH1   0b00100000

◆ PSG_CH2

#define PSG_CH2   0b01000000

◆ PSG_CH3

#define PSG_CH3   0b01100000

◆ PSG_VOLUME

#define PSG_VOLUME   0b00010000

◆ STATF_INT_VBL

#define STATF_INT_VBL   0b10000000

◆ STATF_9_SPR

#define STATF_9_SPR   0b01000000

◆ STATF_SPR_COLL

#define STATF_SPR_COLL   0b00100000

◆ VDP_REG_MASK

#define VDP_REG_MASK   0b10000000

◆ VDP_R0

#define VDP_R0   0b10000000

◆ R0_VSCRL

#define R0_VSCRL   0b00000000

◆ R0_VSCRL_INH

#define R0_VSCRL_INH   0b10000000

◆ R0_HSCRL

#define R0_HSCRL   0b00000000

◆ R0_HSCRL_INH

#define R0_HSCRL_INH   0b01000000

◆ R0_NO_LCB

#define R0_NO_LCB   0b00000000

◆ R0_LCB

#define R0_LCB   0b00100000

◆ R0_IE1_OFF

#define R0_IE1_OFF   0b00000000

◆ R0_IE1

#define R0_IE1   0b00010000

◆ R0_SS_OFF

#define R0_SS_OFF   0b00000000

◆ R0_SS

#define R0_SS   0b00001000

◆ R0_DEFAULT

#define R0_DEFAULT   0b00000110

◆ R0_ES_OFF

#define R0_ES_OFF   0b00000000

◆ R0_ES

#define R0_ES   0b00000001

◆ VDP_R1

#define VDP_R1   0b10000001

◆ R1_DEFAULT

#define R1_DEFAULT   0b10000000

◆ R1_DISP_OFF

#define R1_DISP_OFF   0b00000000

◆ R1_DISP_ON

#define R1_DISP_ON   0b01000000

◆ R1_IE_OFF

#define R1_IE_OFF   0b00000000

◆ R1_IE

#define R1_IE   0b00100000

◆ R1_SPR_8X8

#define R1_SPR_8X8   0b00000000

◆ R1_SPR_8X16

#define R1_SPR_8X16   0b00000010

◆ VDP_R2

#define VDP_R2   0b10000010

◆ R2_MAP_0x3800

#define R2_MAP_0x3800   0xFF

◆ R2_MAP_0x3000

#define R2_MAP_0x3000   0xFD

◆ R2_MAP_0x2800

#define R2_MAP_0x2800   0xFB

◆ R2_MAP_0x2000

#define R2_MAP_0x2000   0xF9

◆ R2_MAP_0x1800

#define R2_MAP_0x1800   0xF7

◆ R2_MAP_0x1000

#define R2_MAP_0x1000   0xF5

◆ R2_MAP_0x0800

#define R2_MAP_0x0800   0xF3

◆ R2_MAP_0x0000

#define R2_MAP_0x0000   0xF1

◆ VDP_R3

#define VDP_R3   0b10000011

◆ VDP_R4

#define VDP_R4   0b10000100

◆ VDP_R5

#define VDP_R5   0b10000101

◆ R5_SAT_0x3F00

#define R5_SAT_0x3F00   0xFF

◆ R5_SAT_0x1F00

#define R5_SAT_0x1F00   0xBF

◆ R5_SAT_MASK

#define R5_SAT_MASK   0b10000001

◆ VDP_R6

#define VDP_R6   0b10000110

◆ R6_BANK0

#define R6_BANK0   0xFB

◆ R6_DATA_0x0000

#define R6_DATA_0x0000   0xFB

◆ R6_BANK1

#define R6_BANK1   0xFF

◆ R6_DATA_0x2000

#define R6_DATA_0x2000   0xFF

◆ VDP_R7

#define VDP_R7   0b10000111

◆ VDP_RBORDER

#define VDP_RBORDER   0b10000111

◆ R7_COLOR_MASK

#define R7_COLOR_MASK   0b11110000

◆ VDP_R8

#define VDP_R8   0b10001000

◆ VDP_RSCX

#define VDP_RSCX   0b10001000

◆ VDP_R9

#define VDP_R9   0b10001001

◆ VDP_RSCY

#define VDP_RSCY   0b10001001

◆ VDP_R10

#define VDP_R10   0b10001010

◆ R10_INT_OFF

#define R10_INT_OFF   0xFF

◆ R10_INT_EVERY

#define R10_INT_EVERY   0x00

◆ JOY_P1_UP

#define JOY_P1_UP   0b00000001

◆ JOY_P1_MD_Z

#define JOY_P1_MD_Z   JOY_P1_UP

◆ JOY_P1_DOWN

#define JOY_P1_DOWN   0b00000010

◆ JOY_P1_MD_Y

#define JOY_P1_MD_Y   JOY_P1_DOWN

◆ JOY_P1_LEFT

#define JOY_P1_LEFT   0b00000100

◆ JOY_P1_MD_X

#define JOY_P1_MD_X   JOY_P1_LEFT

◆ JOY_P1_RIGHT

#define JOY_P1_RIGHT   0b00001000

◆ JOY_P1_MD_MODE

#define JOY_P1_MD_MODE   JOY_P1_RIGHT

◆ JOY_P1_SW1

#define JOY_P1_SW1   0b00010000

◆ JOY_P1_TRIGGER

#define JOY_P1_TRIGGER   JOY_P1_SW1

◆ JOY_P1_MD_A

#define JOY_P1_MD_A   JOY_P1_SW1

◆ JOY_P1_SW2

#define JOY_P1_SW2   0b00100000

◆ JOY_P1_MD_START

#define JOY_P1_MD_START   JOY_P1_SW2

◆ JOY_P2_UP

#define JOY_P2_UP   0b01000000

◆ JOY_P2_MD_Z

#define JOY_P2_MD_Z   JOY_P2_UP

◆ JOY_P2_DOWN

#define JOY_P2_DOWN   0b10000000

◆ JOY_P2_MD_Y

#define JOY_P2_MD_Y   JOY_P2_DOWN

◆ JOY_P2_LEFT

#define JOY_P2_LEFT   0b00000001

◆ JOY_P2_MD_X

#define JOY_P2_MD_X   JOY_P2_LEFT

◆ JOY_P2_RIGHT

#define JOY_P2_RIGHT   0b00000010

◆ JOY_P2_MD_MODE

#define JOY_P2_MD_MODE   JOY_P2_RIGHT

◆ JOY_P2_SW1

#define JOY_P2_SW1   0b00000100

◆ JOY_P2_TRIGGER

#define JOY_P2_TRIGGER   JOY_P2_SW1

◆ JOY_P2_MD_A

#define JOY_P2_MD_A   JOY_P2_SW1

◆ JOY_P2_SW2

#define JOY_P2_SW2   0b00001000

◆ JOY_P2_MD_START

#define JOY_P2_MD_START   JOY_P2_SW2

◆ JOY_RESET

#define JOY_RESET   0b00010000

◆ JOY_P1_LIGHT

#define JOY_P1_LIGHT   0b01000000

◆ JOY_P2_LIGHT

#define JOY_P2_LIGHT   0b10000000

◆ RAMCTL_BANK

#define RAMCTL_BANK   0b00000100

◆ RAMCTL_ROM

#define RAMCTL_ROM   0b00000000

◆ RAMCTL_RAM

#define RAMCTL_RAM   0b00001000

◆ RAMCTL_RO

#define RAMCTL_RO   0b00010000

◆ RAMCTL_PROT

#define RAMCTL_PROT   0b10000000

◆ VBK_TILES

#define VBK_TILES   0

◆ VBK_ATTRIBUTES

#define VBK_ATTRIBUTES   1

◆ VDP_SAT_TERM

#define VDP_SAT_TERM   0xD0

◆ 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)

Variable Documentation

◆ shadow_VDP_R0

UBYTE shadow_VDP_R0
extern

◆ shadow_VDP_R1

UBYTE shadow_VDP_R1
extern

◆ shadow_VDP_R2

UBYTE shadow_VDP_R2
extern

◆ shadow_VDP_R3

UBYTE shadow_VDP_R3
extern

◆ shadow_VDP_R4

UBYTE shadow_VDP_R4
extern

◆ shadow_VDP_R5

UBYTE shadow_VDP_R5
extern

◆ shadow_VDP_R6

UBYTE shadow_VDP_R6
extern

◆ shadow_VDP_R7

UBYTE shadow_VDP_R7
extern

◆ shadow_VDP_RBORDER

UBYTE shadow_VDP_RBORDER
extern

◆ shadow_VDP_R8

UBYTE shadow_VDP_R8
extern

◆ shadow_VDP_RSCX

UBYTE shadow_VDP_RSCX
extern

◆ shadow_VDP_R9

UBYTE shadow_VDP_R9
extern

◆ shadow_VDP_RSCY

UBYTE shadow_VDP_RSCY
extern

◆ shadow_VDP_R10

UBYTE shadow_VDP_R10
extern

◆ VDP_ATTR_SHIFT

volatile UBYTE VDP_ATTR_SHIFT
extern