libc8
CHIP-8 utility library
Loading...
Searching...
No Matches
common.h File Reference

Go to the source code of this file.

Macros

#define C8_STATIC   static
 
#define C8_INLINE   inline
 
#define C8_VERSION   "unknown"
 Version of libc8.
 
#define C8_X(i)   ((i & 0x0F00) >> 8)
 Get "x" value of the given opcode.
 
#define C8_Y(i)   ((i & 0x00F0) >> 4)
 Get "y" value of the given opcode.
 
#define C8_NNN(i)   (i & 0x0FFF)
 Get "nnn" value of the given opcode.
 
#define C8_A(i)   ((i & 0xF000) >> 12)
 Get "a" value of the given opcode.
 
#define C8_B(i)   (i & 0x000F)
 Get "b" value of the given opcode.
 
#define C8_KK(i)   (i & 0x00FF)
 Get "kk" value of the given opcode.
 
#define C8_EXPAND(i)
 Define variables for conventional sections of opcode (x, y, nnn, a, b, and kk).
 
#define C8_PROG_START   0x200
 Program start address.
 
#define C8_MEMSIZE   0x1000
 Total memory size.
 

Detailed Description

Base CHIP-8 definitions/macros

Macro Definition Documentation

◆ C8_A

#define C8_A (   i)    ((i & 0xF000) >> 12)

Get "a" value of the given opcode.

◆ C8_B

#define C8_B (   i)    (i & 0x000F)

Get "b" value of the given opcode.

◆ C8_EXPAND

#define C8_EXPAND (   i)
Value:
uint8_t x = C8_X(i); \
uint8_t y = C8_Y(i); \
uint16_t nnn = C8_NNN(i); \
uint8_t a = C8_A(i); \
uint8_t b = C8_B(i); \
uint8_t kk = C8_KK(i);
#define C8_X(i)
Get "x" value of the given opcode.
Definition: common.h:28
#define C8_A(i)
Get "a" value of the given opcode.
Definition: common.h:43
#define C8_Y(i)
Get "y" value of the given opcode.
Definition: common.h:33
#define C8_B(i)
Get "b" value of the given opcode.
Definition: common.h:48
#define C8_KK(i)
Get "kk" value of the given opcode.
Definition: common.h:53
#define C8_NNN(i)
Get "nnn" value of the given opcode.
Definition: common.h:38

Define variables for conventional sections of opcode (x, y, nnn, a, b, and kk).

◆ C8_INLINE

#define C8_INLINE   inline

◆ C8_KK

#define C8_KK (   i)    (i & 0x00FF)

Get "kk" value of the given opcode.

◆ C8_MEMSIZE

#define C8_MEMSIZE   0x1000

Total memory size.

◆ C8_NNN

#define C8_NNN (   i)    (i & 0x0FFF)

Get "nnn" value of the given opcode.

◆ C8_PROG_START

#define C8_PROG_START   0x200

Program start address.

◆ C8_STATIC

#define C8_STATIC   static

◆ C8_VERSION

#define C8_VERSION   "unknown"

Version of libc8.

◆ C8_X

#define C8_X (   i)    ((i & 0x0F00) >> 8)

Get "x" value of the given opcode.

◆ C8_Y

#define C8_Y (   i)    ((i & 0x00F0) >> 4)

Get "y" value of the given opcode.