libws libws
WSwan hardware library for the Wonderful toolchain
Loading...
Searching...
No Matches
Functions - Internal EEPROM

Macros

#define WS_IEEP_SIZE_MONO   0x80
 
#define WS_IEEP_SIZE_COLOR   0x800
 
#define IEEP_ADDR_OWNER_NAME   0x60 /* 16 bytes */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_YEAR   0x70 /* word */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_MONTH   0x72 /* byte */
 
#define IEEP_ADDR_OWNER_BIRTHDAY_DAY   0x73 /* byte */
 
#define IEEP_ADDR_OWNER_GENDER   0x74 /* byte */
 
#define IEEP_ADDR_OWNER_BLOOD_TYPE   0x75 /* byte */
 
#define IEEP_ADDR_LAST_CART_PUBLISHER   0x76 /* byte */
 
#define IEEP_ADDR_LAST_CART_PLATFORM   0x77 /* byte */
 
#define IEEP_ADDR_LAST_CART_GAME_ID   0x78 /* byte */
 
#define IEEP_ADDR_CART_CHANGE_COUNT   0x7C /* byte */
 
#define IEEP_ADDR_NAME_CHANGE_COUNT   0x7D /* byte */
 
#define IEEP_ADDR_STARTUP_COUNT   0x7E /* word */
 
#define IEEP_ADDR_C_OPTIONS1   0x83 /* byte */
 
#define IEEP_C_OPTIONS1_CUSTOM_SPLASH   0x80
 
#define IEEP_C_OPTIONS1_WSC_HIGH_CONTRAST   0x40
 
#define IEEP_C_OPTIONS1_VOLUME(x)
 
#define IEEP_C_OPTIONS1_VOLUME_MASK   0x03
 
#define IEEP_ADDR_C_NAME_COLOR   0x84 /* byte */
 
#define IEEP_C_NAME_COLOR_BLACK   0x00 /* RGB(0, 0, 0) */
 
#define IEEP_C_NAME_COLOR_RED   0x01 /* RGB(15, 0, 0) */
 
#define IEEP_C_NAME_COLOR_ORANGE   0x02 /* RGB(15, 7, 0) */
 
#define IEEP_C_NAME_COLOR_YELLOW   0x03 /* RGB(15, 15, 0) */
 
#define IEEP_C_NAME_COLOR_LIME   0x04 /* RGB(7, 15, 0) */
 
#define IEEP_C_NAME_COLOR_GREEN   0x05 /* RGB(0, 15, 0) */
 
#define IEEP_C_NAME_COLOR_TEAL   0x06 /* RGB(0, 15, 7) */
 
#define IEEP_C_NAME_COLOR_CYAN   0x07 /* RGB(0, 15, 15) */
 
#define IEEP_C_NAME_COLOR_SEABLUE   0x08 /* RGB(0, 7, 15) */
 
#define IEEP_C_NAME_COLOR_BLUE   0x09 /* RGB(0, 0, 15) */
 
#define IEEP_C_NAME_COLOR_PURPLE   0x0A /* RGB(7, 0, 15) */
 
#define IEEP_C_NAME_COLOR_PINK   0x0B /* RGB(15, 0, 15) */
 
#define IEEP_C_NAME_COLOR_FUCHSIA   0x0C /* RGB(15, 0, 7) */
 
#define IEEP_C_NAME_COLOR_WHITE   0x0D /* RGB(15, 15, 15) */
 
#define IEEP_C_NAME_COLOR_GRAY   0x0E /* RGB(7, 7, 7) */
 

Functions

void ws_ieep_read_owner_name (uint8_t *data)
 Read the owner name, as raw data.
 
void ws_ieep_read_owner_name_ascii (char *str)
 Read the owner name, as an ASCII string.
 
uint16_t ws_ieep_name_color_to_rgb (uint8_t value)
 Convert a given name color to its RGB value.
 
static void ws_ieep_protect_enable (void)
 Protect the non-cartridge area of the internal EEPROM.
 
static bool ws_ieep_protect_check (void)
 Check if the non-cartridge area of the internal EEPROM is currently protected.
 

Detailed Description

Macro Definition Documentation

◆ IEEP_ADDR_C_NAME_COLOR

#define IEEP_ADDR_C_NAME_COLOR   0x84 /* byte */

Definition at line 135 of file eeprom.h.

◆ IEEP_ADDR_C_OPTIONS1

#define IEEP_ADDR_C_OPTIONS1   0x83 /* byte */

Definition at line 129 of file eeprom.h.

◆ IEEP_ADDR_CART_CHANGE_COUNT

#define IEEP_ADDR_CART_CHANGE_COUNT   0x7C /* byte */

Definition at line 125 of file eeprom.h.

◆ IEEP_ADDR_LAST_CART_GAME_ID

#define IEEP_ADDR_LAST_CART_GAME_ID   0x78 /* byte */

Definition at line 124 of file eeprom.h.

◆ IEEP_ADDR_LAST_CART_PLATFORM

#define IEEP_ADDR_LAST_CART_PLATFORM   0x77 /* byte */

Definition at line 123 of file eeprom.h.

◆ IEEP_ADDR_LAST_CART_PUBLISHER

#define IEEP_ADDR_LAST_CART_PUBLISHER   0x76 /* byte */

Definition at line 122 of file eeprom.h.

◆ IEEP_ADDR_NAME_CHANGE_COUNT

#define IEEP_ADDR_NAME_CHANGE_COUNT   0x7D /* byte */

Definition at line 126 of file eeprom.h.

◆ IEEP_ADDR_OWNER_BIRTHDAY_DAY

#define IEEP_ADDR_OWNER_BIRTHDAY_DAY   0x73 /* byte */

Definition at line 119 of file eeprom.h.

◆ IEEP_ADDR_OWNER_BIRTHDAY_MONTH

#define IEEP_ADDR_OWNER_BIRTHDAY_MONTH   0x72 /* byte */

Definition at line 118 of file eeprom.h.

◆ IEEP_ADDR_OWNER_BIRTHDAY_YEAR

#define IEEP_ADDR_OWNER_BIRTHDAY_YEAR   0x70 /* word */

Definition at line 117 of file eeprom.h.

◆ IEEP_ADDR_OWNER_BLOOD_TYPE

#define IEEP_ADDR_OWNER_BLOOD_TYPE   0x75 /* byte */

Definition at line 121 of file eeprom.h.

◆ IEEP_ADDR_OWNER_GENDER

#define IEEP_ADDR_OWNER_GENDER   0x74 /* byte */

Definition at line 120 of file eeprom.h.

◆ IEEP_ADDR_OWNER_NAME

#define IEEP_ADDR_OWNER_NAME   0x60 /* 16 bytes */

Definition at line 116 of file eeprom.h.

◆ IEEP_ADDR_STARTUP_COUNT

#define IEEP_ADDR_STARTUP_COUNT   0x7E /* word */

Definition at line 127 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_BLACK

#define IEEP_C_NAME_COLOR_BLACK   0x00 /* RGB(0, 0, 0) */

Definition at line 136 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_BLUE

#define IEEP_C_NAME_COLOR_BLUE   0x09 /* RGB(0, 0, 15) */

Definition at line 145 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_CYAN

#define IEEP_C_NAME_COLOR_CYAN   0x07 /* RGB(0, 15, 15) */

Definition at line 143 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_FUCHSIA

#define IEEP_C_NAME_COLOR_FUCHSIA   0x0C /* RGB(15, 0, 7) */

Definition at line 148 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_GRAY

#define IEEP_C_NAME_COLOR_GRAY   0x0E /* RGB(7, 7, 7) */

Definition at line 150 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_GREEN

#define IEEP_C_NAME_COLOR_GREEN   0x05 /* RGB(0, 15, 0) */

Definition at line 141 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_LIME

#define IEEP_C_NAME_COLOR_LIME   0x04 /* RGB(7, 15, 0) */

Definition at line 140 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_ORANGE

#define IEEP_C_NAME_COLOR_ORANGE   0x02 /* RGB(15, 7, 0) */

Definition at line 138 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_PINK

#define IEEP_C_NAME_COLOR_PINK   0x0B /* RGB(15, 0, 15) */

Definition at line 147 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_PURPLE

#define IEEP_C_NAME_COLOR_PURPLE   0x0A /* RGB(7, 0, 15) */

Definition at line 146 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_RED

#define IEEP_C_NAME_COLOR_RED   0x01 /* RGB(15, 0, 0) */

Definition at line 137 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_SEABLUE

#define IEEP_C_NAME_COLOR_SEABLUE   0x08 /* RGB(0, 7, 15) */

Definition at line 144 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_TEAL

#define IEEP_C_NAME_COLOR_TEAL   0x06 /* RGB(0, 15, 7) */

Definition at line 142 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_WHITE

#define IEEP_C_NAME_COLOR_WHITE   0x0D /* RGB(15, 15, 15) */

Definition at line 149 of file eeprom.h.

◆ IEEP_C_NAME_COLOR_YELLOW

#define IEEP_C_NAME_COLOR_YELLOW   0x03 /* RGB(15, 15, 0) */

Definition at line 139 of file eeprom.h.

◆ IEEP_C_OPTIONS1_CUSTOM_SPLASH

#define IEEP_C_OPTIONS1_CUSTOM_SPLASH   0x80

Definition at line 130 of file eeprom.h.

◆ IEEP_C_OPTIONS1_VOLUME

#define IEEP_C_OPTIONS1_VOLUME ( x)
Value:
((x) & 3)

Definition at line 132 of file eeprom.h.

◆ IEEP_C_OPTIONS1_VOLUME_MASK

#define IEEP_C_OPTIONS1_VOLUME_MASK   0x03

Definition at line 133 of file eeprom.h.

◆ IEEP_C_OPTIONS1_WSC_HIGH_CONTRAST

#define IEEP_C_OPTIONS1_WSC_HIGH_CONTRAST   0x40

Definition at line 131 of file eeprom.h.

◆ WS_IEEP_SIZE_COLOR

#define WS_IEEP_SIZE_COLOR   0x800

Definition at line 114 of file eeprom.h.

◆ WS_IEEP_SIZE_MONO

#define WS_IEEP_SIZE_MONO   0x80

Definition at line 113 of file eeprom.h.

Function Documentation

◆ ws_ieep_name_color_to_rgb()

uint16_t ws_ieep_name_color_to_rgb ( uint8_t value)

Convert a given name color to its RGB value.

Parameters
valueThe given name color.
Returns
uint16_t A 12-bit RGB value.

◆ ws_ieep_protect_check()

static bool ws_ieep_protect_check ( void )
inlinestatic

Check if the non-cartridge area of the internal EEPROM is currently protected.

Definition at line 188 of file eeprom.h.

◆ ws_ieep_protect_enable()

static void ws_ieep_protect_enable ( void )
inlinestatic

Protect the non-cartridge area of the internal EEPROM.

By default, the WonderSwan boot ROM protects the non-cartridge area of the internal EEPROM - addresses 0x60 and above - on boot. By setting a bit in the cartridge's header (–unlock-ieep in swanlink), the non-cartridge area remains writable. In this case, this function can be used to make the area read-only again.

Definition at line 181 of file eeprom.h.

◆ ws_ieep_read_owner_name()

void ws_ieep_read_owner_name ( uint8_t * data)

Read the owner name, as raw data.

Parameters
dataTarget data area - must be at least 16 bytes.

◆ ws_ieep_read_owner_name_ascii()

void ws_ieep_read_owner_name_ascii ( char * str)

Read the owner name, as an ASCII string.

Parameters
strTarget string area - must be at least 17 bytes.