Re: [cc65] C64, Interrupt and in need of an example

From: stefan <stefan-physik1gmx.net>
Date: 2008-02-28 10:03:13
Please don't forget to acknowledge pending  irq's. Do the
irq-init immediately before the cli, else an irq could be
triggered while initializing screen memory or bitmaps
or music! This applies whether you use C or pure assembler!
In the _c_irq you have to backup the whole zp-segment, so that you
don't disturb the c-code outside the irq.

.IMPORT _c_irq

sei

lda #0
tax
tay
jsr init	; $1000

lda #>_c_irq
sta $0315
lda #<_c_irq
sta $0314
lda #$7f
sta $dc0d
bit $dc0d (<-never forget!)
lda #$01
sta $d01a
lda #$32
sta $d012
lda #$1b
sta $d011 (<-never forget!)

lsr $d019 (<-never forget!)

cli
rts

irq:
inc $d020
jsr play	; $1003
dec $d020
jmp $ea31

Greetz Monte Carlos

> On Donnerstag 28 Februar 2008, Markus Stehr wrote:
>   
>> Hi!
>>
>> Could someone please provide me with an usable example for an interrupt
>> for the C64? I have been reading the manual and asked Google for 2 hours
>> now and i am as clueless as i was 2 hours ago.
>>     
>
> sei
> lda #>irq
> sta $0315
> lda #<irq
> sta $0314
> lda #$7f
> sta $dc0d
> lda #$01
> sta $d01a
> lda #$32
> sta $d012
> lda #$1b
> sta $d011
>
> lda #0
> tax
> tay
> jsr init	; $1000
>
> cli
> rts
>
> irq:
> inc $d020
> jsr play	; $1003
> dec $d020
> jmp $ea31
>
> ... something like that :)
>
>   



******* Diese Email wurde gesendet von der ********
Laser- und Medizin-Technologie GmbH, Berlin
                  (gemeinnuetzig nach 52 AO)
     Fabeckstr. 60 - 62, 14195 Berlin
     Telefon:  +49 (0)30 8449 23 - 0
     Fax:      +49 (0)30 8449 23 - 99
     Handelsregister:    Berlin 97 HRB 23 655
     Homepage: www.LMTB.de
     Vorsitzender des Aufsichtsrats: Dr. Frank Frank
     Geschaeftsfuehrung: Dr. H. Albrecht
                         Prof. Dr.-Ing. H. J. Eichler
*************************************************** 
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Feb 28 10:10:30 2008

This archive was generated by hypermail 2.1.8 : 2008-02-28 10:10:33 CET