Re: [cc65] interruptor from C?

From: Karri Kaksonen <karri1sipo.fi>
Date: 2004-10-12 11:22:33
I also read the FAQ and found out why the interrupt should be in asm.

But my C-code produces exactly the same thing I would write by hand
so I would prefer to have a way to write the routine in C for readability
reasons.

--- snip ----
char drawPending;
int metronome;
extern void swap_buffers(void);
void vbl(void)
{
    if (drawPending) {
        swap_buffers();
        drawPending = 0;
    }
    ++metronome;
}

--- produces ---

.proc   _vbl: near

.segment        "CODE"

        lda     _drawPending
        jeq     L0003
        jsr     _swap_buffers
        ldx     #$00
        lda     #$00
        sta     _drawPending
L0003:  inc     _metronome
        bne     L0009
        inc     _metronome+1
L0009:  lda     _metronome
        ldx     _metronome+1
        rts

The swap_buffers is also a trivial function written in asm.

-- snap ---

--
Regards,

Karri
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Oct 12 11:15:22 2004

This archive was generated by hypermail 2.1.8 : 2004-10-12 11:15:32 CEST