1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-07 15:25:31 +00:00

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
%.o: %.c
@echo $<
@$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $<
C_OBJS =

View File

@@ -5,8 +5,8 @@
;
.export _exit
.import __hinit
.import zerobss, push0, doatexit
.import initlib, donelib
.import zerobss, push0
.import _main
.include "apple2.inc"
@@ -66,9 +66,9 @@ L1: lda sp,x
lda #>TOPMEM
sta sp+1 ; Set argument stack ptr
; Initialize the heap
; Call module constructors
jsr __hinit
jsr initlib
; Initialize conio stuff
@@ -87,13 +87,15 @@ L1: lda sp,x
ldy #4 ; Argument size
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
jsr doatexit ; call exit functions
ldx spsave
txs ; Restore stack pointer

View File

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

View File

@@ -16,7 +16,8 @@ RESERVE_MOUSE_MEMORY = 1 ; for P/M
.endif
.export _exit
.import getargs, argc, argv
.import __hinit, initconio, zerobss, pushax, doatexit
.import initlib, donelib
.import initconio, zerobss, pushax
.import _main,__filetab,getfd
.import __CODE_LOAD__, __BSS_LOAD__
.import __graphmode_used
@@ -117,9 +118,9 @@ L1: lda sp,x
stx old_shflok
sta SHFLOK
; Initialize the heap
; Call module constructors
jsr __hinit
jsr initlib
; Initialize conio stuff
@@ -154,9 +155,11 @@ L1: lda sp,x
ldy #4 ; Argument size
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
txs ; Restore stack pointer

View File

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

View File

@@ -5,8 +5,9 @@
;
.export _exit
.import __hinit, initconio, doneconio, zerobss
.import push0, doatexit, _main
.import initlib, donelib
.import initconio, doneconio, zerobss
.import push0, _main
.include "c128.inc"
.include "../cbm/cbm.inc"
@@ -93,9 +94,9 @@ L1: lda sp,x
lda #>$C000
sta sp+1
; Initialize the heap
; Call module constructors
jsr __hinit
jsr initlib
; Initialize conio stuff
@@ -109,9 +110,9 @@ L1: lda sp,x
ldy #4 ; Argument size
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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,8 @@
;
.export _exit
.import __hinit, push0, doatexit, _main
.import initlib, donelib
.import push0, _main
.import initconio
.import __BSS_RUN__, __BSS_SIZE__
.import irq, nmi
@@ -235,9 +236,13 @@ Z4:
; 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.
; Call module constructors
jsr __hinit ; Initialize the heap
jsr initconio ; Initialize conio stuff
jsr initlib
; Initialize conio stuff
jsr initconio
; Create the (empty) command line for the program
@@ -323,9 +328,9 @@ Start:
ldy #4 ; Argument size
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
; (garbage) BASIC program otherwise. This is also the default entry for

View File

@@ -5,12 +5,10 @@
.SUFFIXES: .o .s .c
%.o: %.c
@echo $<
@$(CC) $(CFLAGS) $<
@$(AS) -g -o $@ $(AFLAGS) $(*).s
%.o: %.s
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $<
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 __hinit
.constructor initheap, 24
.import __BSS_RUN__, __BSS_SIZE__, __stksize
.importzp sp
@@ -23,13 +23,11 @@ __hlast:
.word 0
;
; Initialization. Must be called from startup!
;
; Initialization. Will be called from startup!
.code
__hinit:
initheap:
sec
lda sp
sbc __stksize
@@ -39,7 +37,3 @@ __hinit:
sta __hend+1
rts

View File

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

View File

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

View File

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

View File

@@ -8,9 +8,10 @@
; no __hinit
.export _exit
.import initlib, donelib
.import pushax
.import _main
.import zerobss, doatexit
.import zerobss
; ------------------------------------------------------------------------
; 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
sta sp+1 ; Set argument stack ptr
; Initialize the heap
; Call module constructors
;;! jsr __hinit
jsr initlib
; Pass an empty command line
@@ -69,9 +70,10 @@ regbank = $a3 ; 6 bytes hopefully not used by Kernal
jsr _main ; call the users code
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:
jsr doatexit ; call exit functions
_exit: jsr donelib ; Run module destructors
jmp $c22c ; EnterDeskTop

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,8 @@
;
.export _exit
.import __hinit, initconio, zerobss, push0, doatexit
.import initlib, donelib
.import initconio, zerobss, push0
.import _main
.include "pet.inc"
@@ -84,9 +85,9 @@ L1: lda sp,x
lda MEMSIZE+1
sta sp+1 ; Set argument stack ptr
; Initialize the heap
; Call module constructors
jsr __hinit
jsr initlib
; Initialize conio stuff
@@ -100,9 +101,11 @@ L1: lda sp,x
ldy #4 ; Argument size
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
txs ; Restore stack pointer

View File

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

View File

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

View File

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

View File

@@ -16,7 +16,7 @@
; 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__
@@ -29,7 +29,7 @@
; --------------------------------------------------------------------------
; Initialize library modules
.proc libinit
.proc initlib
lda #<__CONSTRUCTOR_TABLE__
ldx #>__CONSTRUCTOR_TABLE__
@@ -43,7 +43,7 @@
; --------------------------------------------------------------------------
; Cleanup library modules
.proc libdone
.proc donelib
lda #<__DESTRUCTOR_TABLE__
ldx #>__DESTRUCTOR_TABLE__