1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-22 12:30:41 +00:00

New condes module

git-svn-id: svn://svn.cc65.org/cc65/trunk@458 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-11-20 22:17:14 +00:00
parent ce76aba929
commit 5b1b4ea00d
2 changed files with 47 additions and 0 deletions

View File

@ -33,6 +33,7 @@ OBJS = add.o \
bpushbsp.o \
call.o \
compl.o \
condes.o \
decax1.o \
decax2.o \
decaxy.o \

46
libsrc/runtime/condes.s Normal file
View File

@ -0,0 +1,46 @@
;
; Ullrich von Bassewitz, 20.11.2000
;
; CC65 runtime: Support for calling module constructors/destructors
;
; The condes routine must be called with the table address in a/x and the
; number of vectors in the table in y. The current implementation limits
; the table size to 128 bytes (64 vectors) but this shouldn't be problem
; for now and may be changed later.
;
.export condes
.import jmpvec
.code
condes: sta getbyt+1
stx getbyt+2
sty index
loop: ldy index
beq done
dey
jsr getbyt
sta jmpvec+2
dey
jsr getbyt
sta jmpvec+1
jsr jmpvec
jmp loop
done: rts
; --------------------------------------------------------------------------
; Data. The getbyte routine is placed in the data segment cause it's patched
; at runtime.
.bss
index: .byte 0
.data
getbyt: lda $FFFF,y
rts