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 where this change was done for other platforms. git-svn-id: svn://svn.cc65.org/cc65/trunk@3951 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -80,16 +80,16 @@ L1: lda sp,x
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Call module constructors
|
||||
|
||||
jsr initlib
|
||||
|
||||
; Initialize irqcount, which means that from now own custom linked in IRQ
|
||||
; handlers (via condes) will be called.
|
||||
|
||||
lda #.lobyte(__INTERRUPTOR_COUNT__*2)
|
||||
sta irqcount
|
||||
|
||||
; Call module constructors
|
||||
|
||||
jsr initlib
|
||||
|
||||
; Push arguments and call main()
|
||||
|
||||
jsr callmain
|
||||
@@ -97,9 +97,12 @@ L1: lda sp,x
|
||||
; Back from main (this is also the _exit entry). Run module destructors.
|
||||
|
||||
_exit: pha ; Save the return code
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Disable chained IRQ handlers
|
||||
|
||||
lda #0
|
||||
sta irqcount ; Disable custom IRQ handlers
|
||||
jsr donelib ; Run module destructors
|
||||
|
||||
; Copy back the zero page stuff
|
||||
|
||||
|
||||
Reference in New Issue
Block a user