implemented hexstrings, implemented MOVE, PUTCOLOR, GETCHAR, GETCOLOR, modified PUTCHAR, several fixes.
This commit is contained in:
20
vdp.cpp
20
vdp.cpp
@@ -15,6 +15,10 @@
|
||||
#define VDP_CMD_COLOR 7
|
||||
#define VDP_CMD_BORDER 8
|
||||
#define VDP_CMD_CLRSCR 9
|
||||
#define VDP_CMD_MOVE 10
|
||||
#define VDP_CMD_GETCHAR 11
|
||||
#define VDP_CMD_GETCOLOR 12
|
||||
#define VDP_CMD_PUTCOLOR 13
|
||||
|
||||
struct t_sprite {
|
||||
Uint8 x = 0;
|
||||
@@ -166,6 +170,8 @@ void vdp_cmd_out(const unsigned char& value) {
|
||||
switch (value) {
|
||||
case VDP_CMD_LOCATE:
|
||||
cursor_x = data_stack[--data_stack_pos]; cursor_y = data_stack[--data_stack_pos]; break;
|
||||
case VDP_CMD_MOVE:
|
||||
cursor_x += data_stack[--data_stack_pos]; cursor_y += data_stack[--data_stack_pos]; break;
|
||||
case VDP_CMD_PRINT:
|
||||
for (int i = data_stack_pos-1; i >= 0; i--) {
|
||||
screen_map[cursor_x + (cursor_y << 4)] = data_stack[i];
|
||||
@@ -177,7 +183,17 @@ void vdp_cmd_out(const unsigned char& value) {
|
||||
cursor_x = data_stack[data_stack_pos - 1];
|
||||
cursor_y = data_stack[data_stack_pos - 2];
|
||||
screen_map[cursor_x + (cursor_y << 4)] = data_stack[data_stack_pos-3];
|
||||
screen_color[cursor_x + (cursor_y << 4)] = data_stack[data_stack_pos - 4];
|
||||
break;
|
||||
case VDP_CMD_PUTCOLOR:
|
||||
cursor_x = data_stack[data_stack_pos - 1];
|
||||
cursor_y = data_stack[data_stack_pos - 2];
|
||||
screen_color[cursor_x + (cursor_y << 4)] = data_stack[data_stack_pos - 3];
|
||||
break;
|
||||
case VDP_CMD_GETCHAR:
|
||||
data_stack[0] = screen_map[data_stack[1] + (data_stack[0] << 4)];
|
||||
break;
|
||||
case VDP_CMD_GETCOLOR:
|
||||
data_stack[0] = screen_color[data_stack[1] + (data_stack[0] << 4)];
|
||||
break;
|
||||
case VDP_CMD_SETCHAR:
|
||||
n = data_stack[data_stack_pos - 1];
|
||||
@@ -218,7 +234,7 @@ void vdp_cmd_out(const unsigned char& value) {
|
||||
}
|
||||
|
||||
unsigned char vdp_in() {
|
||||
return 0;
|
||||
return data_stack[0];
|
||||
}
|
||||
|
||||
/*int main(int argc, char* argv[]) {
|
||||
|
||||
Reference in New Issue
Block a user