]> git.sur5r.net Git - cc65/commitdiff
Changes by Karri Kaksonen to implement interruptor support.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 11 Sep 2009 13:56:20 +0000 (13:56 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 11 Sep 2009 13:56:20 +0000 (13:56 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@4144 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/lynx/crt0.s

index db107fd94d7f4f7d23984e4d9e2121b621dc63a1..4f210df7b797d923bce97a01b375ad02ccd7e40e 100644 (file)
        .export         _exit
         .export         __STARTUP__ : absolute = 1      ; Mark as startup
 
-       .import         initlib, donelib
+       .import         callirq, initlib, donelib
        .import         zerobss
        .import         callmain
        .import         _main
        .import         __BSS_LOAD__
+       .import         __INTERRUPTOR_COUNT__
        .import         __RAM_START__, __RAM_SIZE__
 
        .include        "zeropage.inc"
@@ -132,9 +133,21 @@ sloop:  ldy     SuzyInitReg,x
 
        jsr     zerobss
 
+; If we have IRQ functions, set the IRQ vector
+; as Lynx is a console there is not much point in releasing the IRQ
+
+        lda     #<__INTERRUPTOR_COUNT__
+       beq     NoIRQ1
+       lda     #<IRQStub
+       ldx     #>IRQStub
+       sei
+       sta     INTVECTL
+       stx     INTVECTH
+       cli
+
 ; Call module constructors
 
-       jsr     initlib
+NoIRQ1: jsr     initlib
 
 ; Push arguments and call main
 
@@ -149,3 +162,14 @@ _exit:  jsr     donelib         ; Run module destructors
 noret:  bra     noret
 
 
+IRQStub:
+       phy
+       phx
+       pha
+       cld
+               jsr     callirq
+       pla
+       plx
+       ply
+       rti
+