libmsx
C library for MSX
|
Execute, Stop, and Await VDP commands. More...
Enumerations | |
enum | vdp_cmd_logop { VDP_CMD_IMP = 0x00 , VDP_CMD_AND = 0x01 , VDP_CMD_OR = 0x02 , VDP_CMD_EOR = 0x03 , VDP_CMD_XOR = VDP_CMD_EOR , VDP_CMD_NOT = 0x04 , VDP_CMD_TIMP = 0x08 , VDP_CMD_TAND = 0x09 , VDP_CMD_TOR = 0x0a , VDP_CMD_TEOR = 0x0b , VDP_CMD_TXOR = VDP_CMD_TEOR , VDP_CMD_TNOT = 0x0c } |
Enumeration of logical operation codes for VDP commands. More... | |
enum | vdp_cmd_dir { VDP_CMD_LRTB = (0 << 2) , VDP_CMD_RLTB = (1 << 2) , VDP_CMD_LRBT = (2 << 2) , VDP_CMD_RLBT = (3 << 2) } |
Enumeration of directions of rectangular operation for VDP commands. More... | |
Functions | |
bool | vdp_cmd_is_running (void) |
MSX2 Tests if a VDP command is running. | |
void | vdp_cmd_await (void) |
MSX2 Wait for the VDP command to finish. | |
void | vdp_cmd_set_unrestricted (bool enable) |
MSX2+ Unristricts/Restricts availability of the VDP command for some screen modes. | |
void | vdp_cmd_stop (void) |
MSX2 Executes VDP command "STOP" (stop the running VDP command). | |
uint8_t | vdp_cmd_execute_POINT (uint16_t sx, uint16_t sy) |
MSX2 Executes VDP command "POINT" (Read color code at the given point). | |
void | vdp_cmd_execute_PSET (uint16_t dx, uint16_t dy, uint8_t color, enum vdp_cmd_logop logop) |
MSX2 Executes VDP command "PSET" (Write color code at the given point). | |
bool | vdp_cmd_execute_SRCH (uint16_t *ret, uint16_t sx, uint16_t sy, uint8_t color, uint8_t arg) |
MSX2 Executes VDP command "SRCH" (Search color code from the given point towards left/right). | |
void | vdp_cmd_execute_LINE (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color, enum vdp_cmd_logop logop) |
MSX2 Executes VDP command "LINE" (Draw line w/ logical operation). | |
bool | vdp_cmd_read (uint8_t *ret) |
MSX2 Reads a value from VDP. | |
void | vdp_cmd_execute_LMCM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir) |
MSX2 Executes VDP command "LMCM" (VRAM to CPU logical transfer). | |
bool | vdp_cmd_write (const uint8_t val) |
MSX2 Writes a value to VDP. | |
void | vdp_cmd_execute_LMMC (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir, enum vdp_cmd_logop logop) |
MSX2 Executes VDP command "LMMC" (CPU to VRAM logical transfer). | |
void | vdp_cmd_execute_HMMC (uint16_t x, uint16_t y, uint16_t w, uint16_t h, enum vdp_cmd_dir dir) |
MSX2 Executes VDP command "HMMC" (CPU to VRAM high speed transfer). | |
void | vdp_cmd_execute_LMMV (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t color, enum vdp_cmd_logop logop) |
MSX2 Executes VDP command "LMMV" (fills rectangular area w/ logical operation). | |
void | vdp_cmd_execute_LMMM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t x2, uint16_t y2, enum vdp_cmd_logop logop) |
MSX2 Executes VDP command "LMMM" (copy rectangular area w/ logical operation). | |
void | vdp_cmd_execute_HMMV (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t color) |
MSX2 Executes VDP command "HMMV" (fills rectangular area). | |
void | vdp_cmd_execute_HMMM (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t x2, uint16_t y2) |
MSX2 Executes VDP command "HMMM" (copy rectangular area). | |
void | vdp_cmd_execute_YMMM (uint16_t x, uint16_t y, uint16_t h, uint16_t y2, uint8_t dir) |
MSX2 Executes VDP command "YMMM" (copy rectangular area from VRAM to VRAM vertically). | |
Execute, Stop, and Await VDP commands.
enum vdp_cmd_logop |
Enumeration of logical operation codes for VDP commands.
enum vdp_cmd_dir |
|
inline |
MSX2
Tests if a VDP command is running.
true
is a VDP command is running, false
otherwise.
|
inline |
MSX2
Wait for the VDP command to finish.
void vdp_cmd_set_unrestricted | ( | bool | enable | ) |
MSX2+
Unristricts/Restricts availability of the VDP command for some screen modes.
enable | If true , enables the VDP command for all screen modes. Otherwise, enables the VDP command only for GRAPHIC 4 to 7. |
|
inline |
uint8_t vdp_cmd_execute_POINT | ( | uint16_t | sx, |
uint16_t | sy | ||
) |
MSX2
Executes VDP command "POINT" (Read color code at the given point).
sx | x-coordinate (0..511) |
sy | y-coordinate (0..1023) |
void vdp_cmd_execute_PSET | ( | uint16_t | dx, |
uint16_t | dy, | ||
uint8_t | color, | ||
enum vdp_cmd_logop | logop | ||
) |
MSX2
Executes VDP command "PSET" (Write color code at the given point).
dx | x-coordinate (0..511) |
dy | y-coordinate (0..1023) |
color | color code |
logop | logical operation code |
bool vdp_cmd_execute_SRCH | ( | uint16_t * | ret, |
uint16_t | sx, | ||
uint16_t | sy, | ||
uint8_t | color, | ||
uint8_t | arg | ||
) |
MSX2
Executes VDP command "SRCH" (Search color code from the given point towards left/right).
ret | pointer to a variable where the X coordinate of the detected point is stored. |
sx | x-coordinate (0..511) |
sy | y-coordinate (0..1023) |
color | color code |
arg | argument register value
|
true
if found, false
otherwise. void vdp_cmd_execute_LINE | ( | uint16_t | x1, |
uint16_t | y1, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
uint8_t | color, | ||
enum vdp_cmd_logop | logop | ||
) |
MSX2
Executes VDP command "LINE" (Draw line w/ logical operation).
x1 | x-coordinate of the 1st end point (0..511) |
y1 | y-coordinate of the 1st end point (0..1023) |
x2 | x-coordinate of the 2nd end point (0..511) |
y2 | y-coordinate of the 2nd end point (0..1023) |
color | color code |
logop | logical operation code |
bool vdp_cmd_read | ( | uint8_t * | ret | ) |
MSX2
Reads a value from VDP.
ret | pointer to a variable where the value read from VDP is stored. |
true
if succeeded, otherwise false
.void vdp_cmd_execute_LMCM | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
enum vdp_cmd_dir | dir | ||
) |
MSX2
Executes VDP command "LMCM" (VRAM to CPU logical transfer).
Set VDP to read out pixel values in the rectangular area of VRAM.
The pixel values (i.e. color code) can then be read by calling vdp_cmd_read().
After this function, vdp_cmd_read() should be called repeatedly, or vdp_cmd_stop() should be called if the read operation is to be canceled.
x | x-coordinate of the starting point (0..511) |
y | y-coordinate of the starting point (0..1023) |
w | width (1..512) |
h | height (1..1024) |
dir | direction
|
bool vdp_cmd_write | ( | const uint8_t | val | ) |
MSX2
Writes a value to VDP.
val | the value to be written to VDP. |
true
if succeeded, otherwise false
.void vdp_cmd_execute_LMMC | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
enum vdp_cmd_dir | dir, | ||
enum vdp_cmd_logop | logop | ||
) |
MSX2
Executes VDP command "LMMC" (CPU to VRAM logical transfer).
Set VDP to write out pixel values in the rectangular area of VRAM.
The pixel values (i.e. color code) can then be written by calling vdp_cmd_write().
After this function, vdp_cmd_write() should be called repeatedly, or vdp_cmd_stop() should be called if the write operation is to be canceled.
x | x-coordinate of the starting point (0..511) |
y | y-coordinate of the starting point (0..1023) |
w | width (1..512) |
h | height (1..1024) |
dir | direction
|
logop | logical operation code |
void vdp_cmd_execute_HMMC | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
enum vdp_cmd_dir | dir | ||
) |
MSX2
Executes VDP command "HMMC" (CPU to VRAM high speed transfer).
Set VDP to write out byte values in the rectangular area of VRAM.
The byte values can then be written by calling vdp_cmd_write().
After this function, vdp_cmd_write() should be called repeatedly, or vdp_cmd_stop() should be called if the write operation is to be canceled.
x | x-coordinate of the starting point (0..511) |
y | y-coordinate of the starting point (0..1023) |
w | width (1..512) |
h | height (1..1024) |
dir | direction
|
x
and w
must be aligned to byte address of VRAM.void vdp_cmd_execute_LMMV | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint8_t | color, | ||
enum vdp_cmd_logop | logop | ||
) |
MSX2
Executes VDP command "LMMV" (fills rectangular area w/ logical operation).
This function is equivalent to the following code:
x | x-coordinate of the top-left corner of the rectangular area. |
y | y-coordinate of the top-left corner of the rectangular area. |
w | width of the rectangular area. |
h | height of the rectangular area. |
color | color code. |
logop | logical operation code. |
void vdp_cmd_execute_LMMM | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint16_t | x2, | ||
uint16_t | y2, | ||
enum vdp_cmd_logop | logop | ||
) |
MSX2
Executes VDP command "LMMM" (copy rectangular area w/ logical operation).
This function is equivalent to the following code, as long as the intersection of the source and destination areas is not considered.
x | x-coordinate of the top-left corner of the source rectangular area. |
y | y-coordinate of the top-left corner of the source rectangular area. |
x2 | x-coordinate of the top-left corner of the destination rectangular area. |
y2 | y-coordinate of the top-left corner of the destination rectangular area. |
w | width of the rectangular area. |
h | height of the rectangular area. |
logop | logical operation code. |
void vdp_cmd_execute_HMMV | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint8_t | color | ||
) |
MSX2
Executes VDP command "HMMV" (fills rectangular area).
This function is equivalent to the following code:
x | x-coordinate of the top-left corner of the rectangular area. |
y | y-coordinate of the top-left corner of the rectangular area. |
w | width of the rectangular area. |
h | height of the rectangular area. |
color | color code. |
x
and w
must be aligned to byte address of VRAM.void vdp_cmd_execute_HMMM | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | w, | ||
uint16_t | h, | ||
uint16_t | x2, | ||
uint16_t | y2 | ||
) |
MSX2
Executes VDP command "HMMM" (copy rectangular area).
This function is equivalent to the following code, as long as the intersection of the source and destination areas is not considered.
x | x-coordinate of the top-left corner of the source rectangular area. |
y | y-coordinate of the top-left corner of the source rectangular area. |
x2 | x-coordinate of the top-left corner of the destination rectangular area. |
y2 | y-coordinate of the top-left corner of the destination rectangular area. |
w | width of the rectangular area. |
h | height of the rectangular area. |
x
, x2
, and w
must be aligned to byte address of VRAM.void vdp_cmd_execute_YMMM | ( | uint16_t | x, |
uint16_t | y, | ||
uint16_t | h, | ||
uint16_t | y2, | ||
uint8_t | dir | ||
) |
MSX2
Executes VDP command "YMMM" (copy rectangular area from VRAM to VRAM vertically).
This function is equivalent to the following code, as long as the intersection of the source and destination areas is not considered.
x | x-coordinate of the base point of the source / destination rectangular area. |
y | y-coordinate of the base point of the source rectangular area. |
y2 | y-coordinate of the base point of the destination rectangular area. |
h | height of the rectangular area. |
dir | (0) move right side area, (4) move left side area. |
x
must be aligned to byte address of VRAM.