mark interrupt variable and function as "export"

This commit is contained in:
nino-porcino 2021-12-05 11:36:33 +01:00
parent 45d11c2bbe
commit a08515c702
2 changed files with 10 additions and 5 deletions

View File

@ -6,9 +6,12 @@ inline void acknowledge_interrupt() {
asm { lda VDP_REG };
}
volatile word tick_counts;
export __address(0) byte IRQ_JUMP_OPCODE;
export __address(1) word IRQ_JUMP_ADDRESS;
__interrupt(hardware_all) void interrupt_handler() {
export volatile word tick_counts;
export __interrupt(hardware_all) void interrupt_handler() {
tick_counts++;
if(tick_counts == 60) {
@ -22,8 +25,8 @@ __interrupt(hardware_all) void interrupt_handler() {
void install_interrupt() {
asm { sei }; // disable 6502 interrupts
*((byte *)0x0000) = 0x4C; // $4C = JUMP opcode
*((word *)0x0001) = (word) &interrupt_handler; // JUMP interrupt_handler
IRQ_JUMP_OPCODE = 0x4C; // $4C = JUMP opcode
IRQ_JUMP_ADDRESS = (word) &interrupt_handler; // JUMP interrupt_handler
asm { cli }; // re-enable 6502 interrupts
write_reg(1, 0xc0 | 32); // turn on IE bit (interrupt enable) on the TMS9918
}

4
test.c
View File

@ -615,13 +615,15 @@ void vti_ellipse_rect(byte _x0, byte _y0, byte _x1, byte _y1)
void prova_interrupt() {
// la seguente linea è un workaround temporaneo a causa di un bug di KickC
// fa uso della variabile tick_counts in modo che non venga ottimizzata
*((word *)0xFFFE) = tick_counts;
//*((word *)0xFFFE) = tick_counts;
install_interrupt();
}
void main() {
//word pippo = mul8(3,2);
byte key = '1';
for(;;) {
if(key == '1') prova_screen1();