]> git.sur5r.net Git - cc65/blobdiff - libsrc/pet/crt0.s
interrupt flag is cleared/restored rather than cleared/set
[cc65] / libsrc / pet / crt0.s
index 21bdf0107034f900d15cd2e07896e9081372afe8..5d4ac73329e2aafc86ac84a4719b859ddabbb9c0 100644 (file)
@@ -5,7 +5,8 @@
 ;
 
        .export         _exit
-               .import         __hinit, initconio, zerobss, push0, doatexit
+       .import         initlib, donelib
+               .import         zerobss, push0
        .import         _main
 
        .include        "pet.inc"
@@ -84,13 +85,9 @@ L1:  lda     sp,x
        lda     MEMSIZE+1
                sta     sp+1            ; Set argument stack ptr
 
-; Initialize the heap
+; Call module constructors
 
-       jsr     __hinit
-
-; Initialize conio stuff
-
-       jsr     initconio
+       jsr     initlib
 
 ; Pass an empty command line
 
@@ -100,9 +97,11 @@ L1: lda     sp,x
        ldy     #4              ; Argument size
                jsr     _main           ; call the users code
 
-; fall thru to exit...
+; Call module destructors. This is also the _exit entry.
+
+_exit: jsr     donelib         ; Run module destructors
 
-_exit: jsr     doatexit        ; call exit functions
+; Restore system stuff
 
        ldx     spsave
        txs                     ; Restore stack pointer