Use the condes feature

git-svn-id: svn://svn.cc65.org/cc65/trunk@470 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-11-22 22:19:09 +00:00
parent cefb4c067d
commit f3b93741ab
32 changed files with 104 additions and 129 deletions

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,8 +5,8 @@
; ;
.export _exit .export _exit
.import __hinit .import initlib, donelib
.import zerobss, push0, doatexit .import zerobss, push0
.import _main .import _main
.include "apple2.inc" .include "apple2.inc"
@@ -66,9 +66,9 @@ L1: lda sp,x
lda #>TOPMEM lda #>TOPMEM
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -87,13 +87,15 @@ L1: lda sp,x
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; fall thru to exit... ; Call module destructors. This is also the _exit entry.
_exit: lda #$ff _exit: jsr donelib
; Restore system stuff
lda #$ff ; Reset text mode
sta TEXTTYP sta TEXTTYP
jsr doatexit ; call exit functions
ldx spsave ldx spsave
txs ; Restore stack pointer txs ; Restore stack pointer

View File

@@ -8,12 +8,10 @@ ATARIDEFS = -DNUMDRVS=4
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $(ATARIDEFS) $< @$(CC) $(CFLAGS) $(ATARIDEFS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $(ATARIDEFS) $< @$(AS) -g -o $@ $(AFLAGS) $(ATARIDEFS) $<
C_OBJS = C_OBJS =

View File

@@ -16,7 +16,8 @@ RESERVE_MOUSE_MEMORY = 1 ; for P/M
.endif .endif
.export _exit .export _exit
.import getargs, argc, argv .import getargs, argc, argv
.import __hinit, initconio, zerobss, pushax, doatexit .import initlib, donelib
.import initconio, zerobss, pushax
.import _main,__filetab,getfd .import _main,__filetab,getfd
.import __CODE_LOAD__, __BSS_LOAD__ .import __CODE_LOAD__, __BSS_LOAD__
.import __graphmode_used .import __graphmode_used
@@ -117,9 +118,9 @@ L1: lda sp,x
stx old_shflok stx old_shflok
sta SHFLOK sta SHFLOK
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -154,9 +155,11 @@ L1: lda sp,x
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; fall thru to exit... ; Call module destructors. This is also the _exit entry.
_exit: jsr doatexit ; call exit functions _exit: jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave ldx spsave
txs ; Restore stack pointer txs ; Restore stack pointer

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,8 +5,9 @@
; ;
.export _exit .export _exit
.import __hinit, initconio, doneconio, zerobss .import initlib, donelib
.import push0, doatexit, _main .import initconio, doneconio, zerobss
.import push0, _main
.include "c128.inc" .include "c128.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
@@ -93,9 +94,9 @@ L1: lda sp,x
lda #>$C000 lda #>$C000
sta sp+1 sta sp+1
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -109,9 +110,9 @@ L1: lda sp,x
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; fall thru to exit... ; Call module destructors. This is also the _exit entry.
_exit: jsr doatexit ; call exit functions _exit: jsr donelib ; Run module destructors
; Reset the conio stuff ; Reset the conio stuff

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,12 +5,10 @@
; ;
.export _exit .export _exit
.import __hinit, initconio, zerobss, push0, condes .import initlib, donelib
.import initconio, zerobss, push0
.import _main .import _main
.import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__
.import __DESTRUCTOR_TABLE__, __DESTRUCTOR_COUNT__
.include "c64.inc" .include "c64.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
@@ -92,9 +90,9 @@ L1: lda sp,x
lda #>$D000 lda #>$D000
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -108,12 +106,9 @@ L1: lda sp,x
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; Call module destructors ; Call module destructors. This is also the _exit entry.
_exit: lda #<__DESTRUCTOR_TABLE__ _exit: jsr donelib ; Run module destructors
ldx #>__DESTRUCTOR_TABLE__
ldy #<(__DESTRUCTOR_COUNT__*2)
jsr condes
; Restore system stuff ; Restore system stuff

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,7 +5,8 @@
; ;
.export _exit .export _exit
.import __hinit, push0, doatexit, _main .import initlib, donelib
.import push0, _main
.import initconio .import initconio
.import __BSS_RUN__, __BSS_SIZE__ .import __BSS_RUN__, __BSS_SIZE__
.import irq, nmi .import irq, nmi
@@ -235,9 +236,13 @@ Z4:
; This code is in page 2, so we may now start calling subroutines safely, ; This code is in page 2, so we may now start calling subroutines safely,
; since the code we execute is no longer in the stack page. ; since the code we execute is no longer in the stack page.
; Call module constructors
jsr __hinit ; Initialize the heap jsr initlib
jsr initconio ; Initialize conio stuff
; Initialize conio stuff
jsr initconio
; Create the (empty) command line for the program ; Create the (empty) command line for the program
@@ -323,9 +328,9 @@ Start:
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; Fall thru to exit. ; Call module destructors. This is also the _exit entry.
_exit: jsr doatexit ; call exit functions _exit: jsr donelib ; Run module destructors
; Clear the start of the zero page, since it will be interpreted as a ; Clear the start of the zero page, since it will be interpreted as a
; (garbage) BASIC program otherwise. This is also the default entry for ; (garbage) BASIC program otherwise. This is also the default entry for

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -g -o $@ $(AFLAGS) $(*).s @$(AS) -g -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = fclose.o fgets.o fprintf.o calloc.o _fopen.o\ C_OBJS = fclose.o fgets.o fprintf.o calloc.o _fopen.o\

View File

@@ -5,7 +5,7 @@
; ;
.export __horg, __hptr, __hend, __hfirst, __hlast .export __horg, __hptr, __hend, __hfirst, __hlast
.export __hinit .constructor initheap, 24
.import __BSS_RUN__, __BSS_SIZE__, __stksize .import __BSS_RUN__, __BSS_SIZE__, __stksize
.importzp sp .importzp sp
@@ -23,13 +23,11 @@ __hlast:
.word 0 .word 0
; ; Initialization. Will be called from startup!
; Initialization. Must be called from startup!
;
.code .code
__hinit: initheap:
sec sec
lda sp lda sp
sbc __stksize sbc __stksize
@@ -39,7 +37,3 @@ __hinit:
sta __hend+1 sta __hend+1
rts rts

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -g -o $@ $(AFLAGS) $(*).s @$(AS) -g -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = dbg.o C_OBJS = dbg.o

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -8,9 +8,10 @@
; no __hinit ; no __hinit
.export _exit .export _exit
.import initlib, donelib
.import pushax .import pushax
.import _main .import _main
.import zerobss, doatexit .import zerobss
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime ; Define and export the ZP variables for the C64 runtime
@@ -54,9 +55,9 @@ regbank = $a3 ; 6 bytes hopefully not used by Kernal
lda #>$7900 lda #>$7900
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Initialize the heap ; Call module constructors
;;! jsr __hinit jsr initlib
; Pass an empty command line ; Pass an empty command line
@@ -69,9 +70,10 @@ regbank = $a3 ; 6 bytes hopefully not used by Kernal
jsr _main ; call the users code jsr _main ; call the users code
jmp $c1c3 ; jump to GEOS MainLoop jmp $c1c3 ; jump to GEOS MainLoop
; exit must be called from the code! ; Call module destructors. This is also the _exit entry which must be called
; explicitly by the code.
_exit: _exit: jsr donelib ; Run module destructors
jsr doatexit ; call exit functions
jmp $c22c ; EnterDeskTop jmp $c22c ; EnterDeskTop

View File

@@ -4,7 +4,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -4,7 +4,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,7 +5,6 @@
# #
%.o: %.s %.o: %.s
@echo $<
@$(AS) -o $@ $(AFLAGS) $< @$(AS) -o $@ $(AFLAGS) $<

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,7 +5,8 @@
; ;
.export _exit .export _exit
.import __hinit, initconio, zerobss, push0, doatexit .import initlib, donelib
.import initconio, zerobss, push0
.import _main .import _main
.include "pet.inc" .include "pet.inc"
@@ -84,9 +85,9 @@ L1: lda sp,x
lda MEMSIZE+1 lda MEMSIZE+1
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -100,9 +101,11 @@ L1: lda sp,x
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code jsr _main ; call the users code
; fall thru to exit... ; Call module destructors. This is also the _exit entry.
_exit: jsr doatexit ; call exit functions _exit: jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave ldx spsave
txs ; Restore stack pointer txs ; Restore stack pointer

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
%.o: %.c %.o: %.c
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s @$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s %.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS = C_OBJS =

View File

@@ -5,7 +5,8 @@
; ;
.export _exit .export _exit
.import __hinit, push0, doatexit, _main .import initlib, donelib
.import push0, _main
.import initconio, doneconio, zerobss .import initconio, doneconio, zerobss
.include "plus4.inc" .include "plus4.inc"
@@ -87,9 +88,9 @@ L1: lda sp,x
MemOk: stx sp MemOk: stx sp
sty sp+1 ; set argument stack ptr sty sp+1 ; set argument stack ptr
; Initialize the heap ; Call module constructors
jsr __hinit jsr initlib
; Initialize conio stuff ; Initialize conio stuff
@@ -103,9 +104,12 @@ MemOk: stx sp
ldy #4 ; Argument size ldy #4 ; Argument size
jsr _main ; call the users code 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
; Restore system stuff
_exit: jsr doatexit ; call exit functions
ldx spsave ldx spsave
txs txs

View File

@@ -5,11 +5,9 @@
.SUFFIXES: .o .s .c .SUFFIXES: .o .s .c
.c.s: .c.s:
@echo $<
@$(CC) $(CFLAGS) $< @$(CC) $(CFLAGS) $<
.s.o: .s.o:
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $< @$(AS) -g -o $@ $(AFLAGS) $<
OBJS = add.o \ OBJS = add.o \

View File

@@ -16,7 +16,7 @@
; lies in the data segment so it's address may be patched at runtime. ; lies in the data segment so it's address may be patched at runtime.
; ;
.export libinit, libdone, condes .export initlib, donelib, condes
.export jmpvec .export jmpvec
.import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__ .import __CONSTRUCTOR_TABLE__, __CONSTRUCTOR_COUNT__
@@ -29,7 +29,7 @@
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; Initialize library modules ; Initialize library modules
.proc libinit .proc initlib
lda #<__CONSTRUCTOR_TABLE__ lda #<__CONSTRUCTOR_TABLE__
ldx #>__CONSTRUCTOR_TABLE__ ldx #>__CONSTRUCTOR_TABLE__
@@ -43,7 +43,7 @@
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; Cleanup library modules ; Cleanup library modules
.proc libdone .proc donelib
lda #<__DESTRUCTOR_TABLE__ lda #<__DESTRUCTOR_TABLE__
ldx #>__DESTRUCTOR_TABLE__ ldx #>__DESTRUCTOR_TABLE__