From: uz Date: Sun, 22 Feb 2009 18:23:31 +0000 (+0000) Subject: Fixed problems with the startup code (Greg King): Interrupts must be hooked X-Git-Tag: V2.13.0rc1~301 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d352b85c87616e83b395d65d85f7d18f42d34453;p=cc65 Fixed problems with the startup code (Greg King): Interrupts must be hooked before calling initlib because initlib calls contructors and may install drivers, which enable hardware interrupts. Similar for donelib. See also R3897 and R3951 where this change was done for other platforms. git-svn-id: svn://svn.cc65.org/cc65/trunk@3954 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/cbm510/crt0.s b/libsrc/cbm510/crt0.s index d135e9618..88c9a5dfe 100644 --- a/libsrc/cbm510/crt0.s +++ b/libsrc/cbm510/crt0.s @@ -425,15 +425,15 @@ ccopy2: lda __VIDRAM_START__,y lda ExecReg sta IndReg -; Call module constructors, enable chained IRQs afterwards. +; Activate chained interrupt handlers, then enable interrupts. - jsr initlib lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount + cli -; Enable interrupts +; Call module constructors. - cli + jsr initlib ; Push arguments and call main() @@ -443,9 +443,9 @@ ccopy2: lda __VIDRAM_START__,y ; point for the break vector. _exit: pha ; Save the return code on stack + jsr donelib ; Run module destructors lda #$00 sta irqcount ; Disable custom irq handlers - jsr donelib ; Run module destructors ; Address the system bank diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index 95ba67ffe..6627a9270 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -346,15 +346,15 @@ Z4: jmp Init .segment "PAGE2" -; Call module constructors, enable chained IRQs afterwards. +; Activate chained interrupt handlers, then enable interrupts. -Init: jsr initlib - lda #.lobyte(__INTERRUPTOR_COUNT__*2) +Init: lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount + cli -; Enable interrupts +; Call module constructors. - cli + jsr initlib ; Push arguments and call main() @@ -364,9 +364,9 @@ Init: jsr initlib ; point for the break vector. _exit: pha ; Save the return code + jsr donelib ; Run module destructors lda #$00 sta irqcount ; Disable custom irq handlers - jsr donelib ; Run module destructors ; Address the system bank