implemented hexstrings, implemented MOVE, PUTCOLOR, GETCHAR, GETCOLOR, modified PUTCHAR, several fixes.

This commit is contained in:
2017-02-09 19:03:20 +01:00
parent be539b1591
commit 3f1f9451ca
10 changed files with 219 additions and 298 deletions

20
vdp.cpp
View File

@@ -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[]) {