From da57ae00c59ef37fd892254ed48a9a17fa908568 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 11 Oct 2021 22:14:19 +0200 Subject: [PATCH] Add vic include file --- include/c64/types.h | 8 +++++ include/c64/vic.h | 78 +++++++++++++++++++++++++++++++++++++++++++++ oscar64/Parser.cpp | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 include/c64/types.h create mode 100644 include/c64/vic.h diff --git a/include/c64/types.h b/include/c64/types.h new file mode 100644 index 0000000..860e764 --- /dev/null +++ b/include/c64/types.h @@ -0,0 +1,8 @@ +#ifndef C64_TYPES_H +#define C64_TYPES_H + +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long dword; + +#endif diff --git a/include/c64/vic.h b/include/c64/vic.h new file mode 100644 index 0000000..6d45650 --- /dev/null +++ b/include/c64/vic.h @@ -0,0 +1,78 @@ +#ifndef C64_VIC_H +#define C64_VIC_H + +#include "types.h" + +#define VIC_CTRL1_RSEL 0x08 +#define VIC_CTRL1_DEN 0x10 +#define VIC_CTRL1_BMM 0x20 +#define VIC_CTRL1_ECM 0x40 +#define VIC_CTRL1_RST8 0x80 + +#define VIC_CTRL2_CSEL 0x10 +#define VIC_CTRL2_MCM 0x20 +#define VIC_CTRL2_RES 0x40 + +#define VIC_INTR_RST 0x01 +#define VIC_INTR_MBC 0x02 +#define VIC_INTR_MMC 0x04 +#define VIC_INTR_ILP 0x08 +#define VIC_INTR_IRQ 0x80 + +enum VICColors +{ + VCOL_BLACK, + VCOL_WHITE, + BCOL_RED, + BCOL_CYAN, + BCOL_PURPLE, + BCOL_GREEN, + BCOL_BLUE, + BCOL_YELLOW, + + BCOL_ORANGE, + BCOL_BROWN, + BCOL_LT_RED, + BCOL_DARK_GREY, + BCOL_MED_GREY, + BCOL_LT_GREEN, + BCOL_LT_BLUE, + BCOL_LT_GREY +}; + +struct VIC +{ + struct XY + { + byte x, y; + } spritexy[8]; + byte spr_msbx; + + byte ctrl1; + byte raster; + byte lpx, lpy; + byte spr_enable; + byte ctrl2; + byte spr_expand_y; + byte memptr; + byte intr_ctrl; + byte intr_enable; + byte spr_priority; + byte spr_multi; + byte spr_expand_x; + byte spr_sprcol; + byte spr_backcol; + byte color_border; + byte color_back; + byte color_back1; + byte color_back2; + byte color_back3; + byte spr_mcolor0; + byte spr_mcolor1; + byte spr_color[8]; + +}; + +#define vic (*((VIC *)0xd000)) + +#endif diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 13dfb94..836319e 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -1318,7 +1318,7 @@ Expression* Parser::ParsePrefixExpression(void) // no pointer to function dereferencing if (nexp->mLeft->mDecType->mBase->mType == DT_TYPE_FUNCTION) return nexp->mLeft; - nexp->mDecType = nexp->mLeft->mDecType; + nexp->mDecType = nexp->mLeft->mDecType->mBase; } else mErrors->Error(nexp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Pointer or array type expected");