Add raster IRQ handler for cartridge with ROM switching
This commit is contained in:
parent
5126ba482e
commit
62ab925e01
|
@ -29,7 +29,7 @@ __asm irq0
|
||||||
pha
|
pha
|
||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
|
kentry:
|
||||||
asl $d019
|
asl $d019
|
||||||
|
|
||||||
ldx nextIRQ
|
ldx nextIRQ
|
||||||
|
@ -57,14 +57,15 @@ ji:
|
||||||
// carry is cleared at this point
|
// carry is cleared at this point
|
||||||
|
|
||||||
tay
|
tay
|
||||||
dey
|
|
||||||
sbc #2
|
sbc #2
|
||||||
cmp $d012
|
cmp $d012
|
||||||
bcc l1
|
bcc l1
|
||||||
|
|
||||||
|
exd:
|
||||||
|
dey
|
||||||
|
ex:
|
||||||
sty $d012
|
sty $d012
|
||||||
|
|
||||||
ex:
|
|
||||||
pla
|
pla
|
||||||
tay
|
tay
|
||||||
pla
|
pla
|
||||||
|
@ -77,20 +78,16 @@ e2:
|
||||||
ldx npos
|
ldx npos
|
||||||
stx tpos
|
stx tpos
|
||||||
inc rirq_count
|
inc rirq_count
|
||||||
|
tay
|
||||||
|
|
||||||
bit $d011
|
bit $d011
|
||||||
bmi e1
|
bpl ex
|
||||||
|
|
||||||
sta $d012
|
|
||||||
jmp ex
|
|
||||||
|
|
||||||
e1:
|
e1:
|
||||||
ldx #0
|
ldx #0
|
||||||
stx nextIRQ
|
stx nextIRQ
|
||||||
ldy rasterIRQNext
|
ldy rasterIRQNext
|
||||||
dey
|
jmp exd
|
||||||
sty $d012
|
|
||||||
jmp ex
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +98,7 @@ __asm irq2
|
||||||
pha
|
pha
|
||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
|
kentry:
|
||||||
lda $01
|
lda $01
|
||||||
pha
|
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)
|
void rirq_init_io(void)
|
||||||
{
|
{
|
||||||
rirq_init_tables();
|
rirq_init_tables();
|
||||||
|
|
|
@ -132,7 +132,8 @@ inline void rirq_data(RIRQCode * ic, byte n, byte data);
|
||||||
// Add a delay of 5 * cycles to a raster IRQ
|
// Add a delay of 5 * cycles to a raster IRQ
|
||||||
inline void rirq_delay(RIRQCode * ic, byte cycles);
|
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);
|
inline void rirq_set(byte n, byte row, RIRQCode * write);
|
||||||
|
|
||||||
// Remove a raster IRQ from one of the 16 slots
|
// 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)
|
// the less resource hungry option)
|
||||||
inline void rirq_init(bool kernalIRQ);
|
inline void rirq_init(bool kernalIRQ);
|
||||||
|
|
||||||
|
// Raster IRQ through kernal, with IO range always enabled
|
||||||
|
// calls kernal continuation
|
||||||
void rirq_init_kernal(void);
|
void rirq_init_kernal(void);
|
||||||
|
|
||||||
|
// Raster IRQ through kernal, with IO range not always enabled
|
||||||
|
// calls kernal continuation
|
||||||
void rirq_init_kernal_io(void);
|
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);
|
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);
|
void rirq_init_memmap(void);
|
||||||
|
|
||||||
// Start raster IRQ
|
// Start raster IRQ
|
||||||
|
|
|
@ -2223,6 +2223,23 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
||||||
return ExValue(TheVoidPointerTypeDeclaration, ins->mDst.mTemp);
|
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:
|
case DT_CONST_POINTER:
|
||||||
{
|
{
|
||||||
vl = TranslateExpression(procType, proc, block, dec->mValue, destack, gotos, breakBlock, continueBlock, inlineMapper);
|
vl = TranslateExpression(procType, proc, block, dec->mValue, destack, gotos, breakBlock, continueBlock, inlineMapper);
|
||||||
|
|
|
@ -7064,6 +7064,23 @@ Expression* Parser::ParseQualify(Expression* exp)
|
||||||
else
|
else
|
||||||
mErrors->Error(mScanner->mLocation, EERR_SYNTAX, "Identifier expected");
|
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
|
else
|
||||||
mErrors->Error(mScanner->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Struct expected");
|
mErrors->Error(mScanner->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Struct expected");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue