diff --git a/include/c64/sprites.c b/include/c64/sprites.c index e2902be..664648c 100644 --- a/include/c64/sprites.c +++ b/include/c64/sprites.c @@ -108,6 +108,22 @@ void spr_color(char sp, char color) vic.spr_color[sp] = color; } +void spr_expand(char sp, bool xexpand, bool yexpand) +{ + __assume (sp < 8); + + char m = 1 << sp; + + if (xexpand) + vic.spr_expand_x |= m; + else + vic.spr_expand_x &= ~m; + + if (yexpand) + vic.spr_expand_y |= m; + else + vic.spr_expand_y &= ~m; +} static char vspriteYLow[VSPRITES_MAX], vspriteXLow[VSPRITES_MAX], vspriteXHigh[VSPRITES_MAX]; static char vspriteImage[VSPRITES_MAX], vspriteColor[VSPRITES_MAX]; diff --git a/include/c64/sprites.h b/include/c64/sprites.h index 69f7cee..a676614 100644 --- a/include/c64/sprites.h +++ b/include/c64/sprites.h @@ -39,6 +39,10 @@ inline void spr_image(char sp, char image); inline void spr_color(char sp, char color); +// change the image of a sprite + +inline void spr_expand(char sp, bool xexpand, bool yexpand); + // The virtual sprite system works with the rasterirq library to multiplex // 16 virtual sprites onto the actual eight hardware sprites. It uses the slots // 0 to 8 of the rasterirq library to switch the sprites mid screen. The diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index c1b1f35..6336f1e 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -967,6 +967,14 @@ Declaration* Declaration::BuildArrayPointer(void) return this; } +Declaration* Declaration::BuildAddressOfPointer(void) +{ + if (mType == DT_TYPE_ARRAY) + return BuildArrayPointer(); + else + return BuildPointer(mLocation); +} + bool Declaration::IsNullConst(void) const { if (mType == DT_CONST_INTEGER || mType == DT_CONST_ADDRESS) diff --git a/oscar64/Declaration.h b/oscar64/Declaration.h index b390d2c..c4da608 100644 --- a/oscar64/Declaration.h +++ b/oscar64/Declaration.h @@ -323,6 +323,7 @@ public: Declaration* BuildConstRValueRef(const Location& loc); Declaration* NonRefBase(void); Declaration* BuildArrayPointer(void); + Declaration* BuildAddressOfPointer(void); Declaration* DeduceAuto(Declaration* dec); Declaration* ConstCast(Declaration* ntype); bool IsNullConst(void) const; diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 44d06d6..9a6643a 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -7010,11 +7010,7 @@ Expression* Parser::ParsePrefixExpression(bool lhs) } else if (nexp->mToken == TK_BINARY_AND) { - Declaration* pdec = new Declaration(nexp->mLocation, DT_TYPE_POINTER); - pdec->mBase = nexp->mLeft->mDecType; - pdec->mSize = 2; - pdec->mFlags |= DTF_DEFINED; - nexp->mDecType = pdec; + nexp->mDecType = nexp->mLeft->mDecType->BuildAddressOfPointer(); } else if (nexp->mToken == TK_BANKOF) {