2 ; Ullrich von Bassewitz, 20.11.2000
4 ; CC65 runtime: Support for calling module constructors/destructors
6 ; The condes routine must be called with the table address in a/x and the
7 ; size of the table in y. The current implementation limits the table size
8 ; to 254 bytes (127 vectors) but this shouldn't be problem for now and may
11 ; libinit and libdone call condes with the predefined module constructor and
12 ; destructor tables, they must be called from the platform specific startup
16 .export initlib, donelib, condes
19 .import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__
20 .import __DESTRUCTOR_TABLE__, __DESTRUCTOR_COUNT__
26 ; --------------------------------------------------------------------------
27 ; Initialize library modules
31 lda #<__CONSTRUCTOR_TABLE__
32 ldx #>__CONSTRUCTOR_TABLE__
33 ldy #<(__CONSTRUCTOR_COUNT__*2)
40 ; --------------------------------------------------------------------------
41 ; Cleanup library modules
45 lda #<__DESTRUCTOR_TABLE__
46 ldx #>__DESTRUCTOR_TABLE__
47 ldy #<(__DESTRUCTOR_COUNT__*2)
54 ; --------------------------------------------------------------------------
55 ; Generic table call handler
83 ; --------------------------------------------------------------------------
84 ; Data. The getbyte routine is placed in the data segment cause it's patched