]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/condes.s
no TGI_ERR_NO_MEM or TGI_ERR_NO_IOCB anymore: replaced by TGI_ERR_NO_RES
[cc65] / libsrc / runtime / condes.s
index 99c4a6b85d312b5c7e1424e70c538a39061b8a8d..c94e41252285292f8aac50e6d28e80ba0f05e6d3 100644 (file)
 
         .macpack        cpu
 
-.code
-
 ; --------------------------------------------------------------------------
 ; Initialize library modules
 
+.segment        "INIT"
+
 .proc  initlib
 
-       ldy     #<(__CONSTRUCTOR_COUNT__*2)
+       ldy     #<(__CONSTRUCTOR_COUNT__*2)
                beq     exit
-       lda     #<__CONSTRUCTOR_TABLE__
-       ldx     #>__CONSTRUCTOR_TABLE__
+       lda     #<__CONSTRUCTOR_TABLE__
+       ldx     #>__CONSTRUCTOR_TABLE__
         jmp     condes
 exit:   rts
 
@@ -40,21 +40,23 @@ exit:   rts
 ; --------------------------------------------------------------------------
 ; Cleanup library modules
 
+.code
+
 .proc  donelib
 
        ldy     #<(__DESTRUCTOR_COUNT__*2)
-       beq     initlib::exit
+       beq     exit
        lda     #<__DESTRUCTOR_TABLE__
        ldx     #>__DESTRUCTOR_TABLE__
        jmp     condes
+exit:   rts
 
 .endproc
 
 
 ; --------------------------------------------------------------------------
-; Generic table call handler. Since the routine is also used to call a table
-; of interrupt handlers, it uses heavily self modifying code for performance
-; reasons. It will go into the data segment for this reason ...
+; Generic table call handler. The code uses self modifying code and goes
+; into the data segment for this reason.
 ; NOTE: The routine must not be called if the table is empty!
 
 .data