; libinit and libdone call condes with the predefined module constructor and
; destructor tables, they must be called from the platform specific startup
; code.
+
;
; The function does also export jmpvec as general purpose jump vector that
; lies in the data segment so it's address may be patched at runtime.
;
- .export libinit, libdone, condes
+ .export initlib, donelib, condes
.export jmpvec
.import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__
; --------------------------------------------------------------------------
; Initialize library modules
-.proc libinit
+.proc initlib
lda #<__CONSTRUCTOR_TABLE__
ldx #>__CONSTRUCTOR_TABLE__
; --------------------------------------------------------------------------
; Cleanup library modules
-.proc libdone
+.proc donelib
- lda #<__DESTRUCTOR_TABLE__
- ldx #>__DESTRUCTOR_TABLE__
- ldy #<(__DESTRUCTOR_COUNT__*2)
- bne condes
+ lda #<__DESTRUCTOR_TABLE__
+ ldx #>__DESTRUCTOR_TABLE__
+ ldy #<(__DESTRUCTOR_COUNT__*2)
+ bne condes
rts
.endproc
sta jmpvec+1
sty index
jsr jmpvec
- jmp loop
+.ifpc02
+ bra loop
+.else
+ jmp loop
+.endif
done: rts