mirror of
https://github.com/cc65/cc65.git
synced 2024-12-21 05:29:52 +00:00
Move initialization code into the init segment
git-svn-id: svn://svn.cc65.org/cc65/trunk@3404 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
46cb3bb2e8
commit
6ec87c5dd9
@ -27,7 +27,7 @@ __heaplast:
|
|||||||
|
|
||||||
; Initialization. Will be called from startup!
|
; Initialization. Will be called from startup!
|
||||||
|
|
||||||
.code
|
.segment "INIT"
|
||||||
|
|
||||||
initheap:
|
initheap:
|
||||||
sec
|
sec
|
||||||
@ -39,3 +39,4 @@ initheap:
|
|||||||
sta __heapend+1
|
sta __heapend+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 17.09.1998
|
; Ullrich von Bassewitz, 1998-09-17, 2005-02-26.
|
||||||
;
|
;
|
||||||
; Zero the bss segment.
|
; Zero the bss segment.
|
||||||
;
|
;
|
||||||
@ -9,7 +9,7 @@
|
|||||||
.importzp ptr1
|
.importzp ptr1
|
||||||
|
|
||||||
|
|
||||||
.code
|
.segment "INIT"
|
||||||
|
|
||||||
zerobss:
|
zerobss:
|
||||||
lda #<__BSS_RUN__
|
lda #<__BSS_RUN__
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
.macpack cpu
|
.macpack cpu
|
||||||
|
|
||||||
.code
|
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Initialize library modules
|
; Initialize library modules
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
.proc initlib
|
.proc initlib
|
||||||
|
|
||||||
ldy #<(__CONSTRUCTOR_COUNT__*2)
|
ldy #<(__CONSTRUCTOR_COUNT__*2)
|
||||||
@ -40,13 +40,16 @@ exit: rts
|
|||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Cleanup library modules
|
; Cleanup library modules
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
.proc donelib
|
.proc donelib
|
||||||
|
|
||||||
ldy #<(__DESTRUCTOR_COUNT__*2)
|
ldy #<(__DESTRUCTOR_COUNT__*2)
|
||||||
beq initlib::exit
|
beq exit
|
||||||
lda #<__DESTRUCTOR_TABLE__
|
lda #<__DESTRUCTOR_TABLE__
|
||||||
ldx #>__DESTRUCTOR_TABLE__
|
ldx #>__DESTRUCTOR_TABLE__
|
||||||
jmp condes
|
jmp condes
|
||||||
|
exit: rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@ -22,12 +22,13 @@
|
|||||||
; Use macros for better readability
|
; Use macros for better readability
|
||||||
.macpack generic
|
.macpack generic
|
||||||
|
|
||||||
.code
|
|
||||||
|
|
||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; Initialization code. This is a constructor, so it is called on startup if
|
; Initialization code. This is a constructor, so it is called on startup if
|
||||||
; the linker has detected references to this module.
|
; the linker has detected references to this module.
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
.proc initstkchk
|
.proc initstkchk
|
||||||
|
|
||||||
lda sp
|
lda sp
|
||||||
@ -47,6 +48,8 @@
|
|||||||
; 6502 stack checking routine. Does not need to save any registers.
|
; 6502 stack checking routine. Does not need to save any registers.
|
||||||
; Safety zone for the hardware stack is 12 bytes.
|
; Safety zone for the hardware stack is 12 bytes.
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
stkchk: tsx
|
stkchk: tsx
|
||||||
cpx #12
|
cpx #12
|
||||||
bcc Fail ; Jump on stack overflow
|
bcc Fail ; Jump on stack overflow
|
||||||
@ -55,6 +58,8 @@ stkchk: tsx
|
|||||||
; ----------------------------------------------------------------------------
|
; ----------------------------------------------------------------------------
|
||||||
; C stack checking routine. Does not need to save any registers.
|
; C stack checking routine. Does not need to save any registers.
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
cstkchk:
|
cstkchk:
|
||||||
|
|
||||||
; Check the high byte of the software stack
|
; Check the high byte of the software stack
|
||||||
|
Loading…
Reference in New Issue
Block a user