diff --git a/include/c64/rasterirq.c b/include/c64/rasterirq.c index 55ab464..481938d 100644 --- a/include/c64/rasterirq.c +++ b/include/c64/rasterirq.c @@ -29,7 +29,7 @@ __asm irq0 pha tya pha - +kentry: asl $d019 ldx nextIRQ @@ -57,14 +57,15 @@ ji: // carry is cleared at this point tay - dey sbc #2 cmp $d012 bcc l1 +exd: + dey +ex: sty $d012 -ex: pla tay pla @@ -77,20 +78,16 @@ e2: ldx npos stx tpos inc rirq_count + tay bit $d011 - bmi e1 - - sta $d012 - jmp ex + bpl ex e1: ldx #0 stx nextIRQ ldy rasterIRQNext - dey - sty $d012 - jmp ex + jmp exd } @@ -101,7 +98,7 @@ __asm irq2 pha tya pha - +kentry: lda $01 pha @@ -509,6 +506,42 @@ void rirq_init_kernal_io(void) } +void rirq_init_crt(void) +{ + rirq_init_tables(); + + __asm + { + sei + } + + *(void **)0x0314 = irq0.kentry; + *(void **)0xfffe = irq0; + + vic.intr_enable = 1; + vic.ctrl1 &= 0x7f; + vic.raster = 255; + +} + +void rirq_init_crt_io(void) +{ + rirq_init_tables(); + + __asm + { + sei + } + + *(void **)0x0314 = irq2.kentry; + *(void **)0xfffe = irq2; + + vic.intr_enable = 1; + vic.ctrl1 &= 0x7f; + vic.raster = 255; + +} + void rirq_init_io(void) { rirq_init_tables(); diff --git a/include/c64/rasterirq.h b/include/c64/rasterirq.h index 1c05d59..cc78bdc 100644 --- a/include/c64/rasterirq.h +++ b/include/c64/rasterirq.h @@ -132,7 +132,8 @@ inline void rirq_data(RIRQCode * ic, byte n, byte data); // Add a delay of 5 * cycles to a raster IRQ inline void rirq_delay(RIRQCode * ic, byte cycles); -// Place a raster IRQ into one of the 16 slots +// Place a raster IRQ into one of the 16 slots, the interrupt will fire +// one line below the given row inline void rirq_set(byte n, byte row, RIRQCode * write); // Remove a raster IRQ from one of the 16 slots @@ -147,12 +148,28 @@ inline void rirq_move(byte n, byte row); // the less resource hungry option) inline void rirq_init(bool kernalIRQ); +// Raster IRQ through kernal, with IO range always enabled +// calls kernal continuation void rirq_init_kernal(void); +// Raster IRQ through kernal, with IO range not always enabled +// calls kernal continuation void rirq_init_kernal_io(void); +// Raster IRQ through RAM and ROM vector, with ROM disabled or not and IO range always enabled +// does not call kernal continuation +void rirq_init_crt(void); + +// Raster IRQ through RAM and ROM vector, with ROM disabled or not and IO range not always enabled +// does not call kernal continuation +void rirq_init_crt_io(void); + +// Raster IRQ through RAM vector, with ROM disabled and IO range always enabled +// does not call kernal continuation void rirq_init_io(void); +// Raster IRQ through RAM vector, with ROM disabled and IO range not always enabled +// does not call kernal continuation void rirq_init_memmap(void); // Start raster IRQ diff --git a/oscar64/InterCodeGenerator.cpp b/oscar64/InterCodeGenerator.cpp index e36b67b..9beb982 100644 --- a/oscar64/InterCodeGenerator.cpp +++ b/oscar64/InterCodeGenerator.cpp @@ -2223,6 +2223,23 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration* return ExValue(TheVoidPointerTypeDeclaration, ins->mDst.mTemp); } + case DT_LABEL: + { + if (!dec->mBase->mLinkerObject) + TranslateAssembler(proc->mModule, dec->mBase->mValue, nullptr); + + InterInstruction* ins = new InterInstruction(MapLocation(exp, inlineMapper), IC_CONSTANT); + ins->mDst.mType = IT_POINTER; + ins->mDst.mTemp = proc->AddTemporary(ins->mDst.mType); + ins->mConst.mType = IT_POINTER; + ins->mConst.mVarIndex = dec->mBase->mVarIndex; + ins->mConst.mLinkerObject = dec->mBase->mLinkerObject; + ins->mConst.mMemory = IM_PROCEDURE; + ins->mConst.mIntConst = dec->mInteger; + block->Append(ins); + return ExValue(TheVoidPointerTypeDeclaration, ins->mDst.mTemp); + } + case DT_CONST_POINTER: { vl = TranslateExpression(procType, proc, block, dec->mValue, destack, gotos, breakBlock, continueBlock, inlineMapper); diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 71c13a6..0ee63d1 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -7064,6 +7064,23 @@ Expression* Parser::ParseQualify(Expression* exp) else mErrors->Error(mScanner->mLocation, EERR_SYNTAX, "Identifier expected"); } + else if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_ASSEMBLER) + { + if (mScanner->mToken == TK_IDENT) + { + Declaration* ldec = exp->mDecValue->mBase->mScope->Lookup(mScanner->mTokenIdent); + if (ldec) + { + exp->mDecValue = ldec; + exp->mDecType = TheUnsignedIntTypeDeclaration; + } + else + mErrors->Error(mScanner->mLocation, EERR_OBJECT_NOT_FOUND, "Assembler label not found", mScanner->mTokenIdent); + mScanner->NextToken(); + } + else + mErrors->Error(mScanner->mLocation, EERR_SYNTAX, "Identifier expected"); + } else mErrors->Error(mScanner->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Struct expected");