sage, on Sun Jan 2, 2011 11:06 AM, said:
mednafen does not recognize *.o files, you have to convert them to an rom image and then to a handy lnx format image.
Thats why I only use Makefiles for development nowadays, it doesnt matter if i only create a .o or the complete image. everthign goes in one step.
OR you add the support to mednafen :-)
That is the main reason why I added the .lnx target generation as the default target to the cc65.org tools.
The new cc65 tools set up the IRQ's automatically. You do not need to set up any vectors anymore.
Instead you have to declare your ASM routine to be an interrupt handler like this;
.interruptor RealTimeHandler
.export _lastcounter
_lastcounter .word 0
RealTimeHandler:
lda INTSET
and #VBL_INTERRUPT
beq @1
inc _lastcounter
bne @1
inc _lastcounter+1
@1: clc
rts
The linker will take care of creating the vectors and setting up everything. This handler will then be called at every interrupt. It will then check if the interrupt was generated by VBL and if it was it increments _lastcounter.
To activate the interrupt you can initialize the tgi-driver (it is automatically setting up the VBL counter, interrupt handlers and vectors).
tgi_install(&lynxtgi);
tgi_init();
CLI();
All interruptors will always be called during every interrupt as long as carry is cleared when the interruptor exits. If you set the carry flag before exit then the interrupt has been handled. In my interruptors (tgi-graphics and ComLynx) I always leave the carry as cleared so that you can add your own hooks for some extra processing. This is why you can have many interruptors that share the same interrupt. Like tgi-processing and incrementing _lastcounter. Both handlers will be called.
Or you can even set up an interruptor of your own for the music. It should be something similar to the VBL interrupts.
From the asminc file it appears that interrupts 0, 2 and 4 are taken.
; Interrupt bits in INTRST and INTSET
TIMER0_INTERRUPT = $01
TIMER1_INTERRUPT = $02
TIMER2_INTERRUPT = $04
TIMER3_INTERRUPT = $08
TIMER4_INTERRUPT = $10
TIMER5_INTERRUPT = $20
TIMER6_INTERRUPT = $40
TIMER7_INTERRUPT = $80
HBL_INTERRUPT = TIMER0_INTERRUPT
VBL_INTERRUPT = TIMER2_INTERRUPT
SERIAL_INTERRUPT = TIMER4_INTERRUPT
lda #$80 ; Enable VBL interrupts
tsb VTIMCTLA
lda #$7e ; 75 Hz
ldx #$20
sta HTIMBKUP
stx PBKUP
--
Regards,
Karri
Edited by karri, Mon Jan 3, 2011 5:00 AM.