Changed run location of INIT segment.

So far the INIT segment was run from the later heap+stack. Now the INIT segment is run from the later BSS. The background is that so far the INIT segment was pretty small (from $80 to $180 bytes). But upcoming changes will increase the INIT segment in certain scenarios up to ~ $1000 bytes. So programs with very limited heap+stack might just not been able to move the INIT segment to its run location. But moving the INIT segment to the later BSS allows it to occupy the later BSS+heap+stack.

In order to allow that the constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the new INITBSS segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
This commit is contained in:
Oliver Schmidt
2015-10-14 22:52:09 +02:00
parent 023b461bb8
commit 0ee9b2e446
35 changed files with 234 additions and 260 deletions

View File

@@ -31,9 +31,9 @@
;---------------------------------------------------------------------------
; Data
.bss
__argc: .res 2
__argv: .res 2
.data
__argc: .word 0
__argv: .addr 0

View File

@@ -101,14 +101,14 @@ Fail: lda #4
; ----------------------------------------------------------------------------
; Data
.bss
.segment "INITBSS"
; Initial stack pointer value. Stack is reset to this in case of overflows to
; allow program exit processing.
initialsp: .word 0
initialsp: .res 2
; Stack low water mark.
lowwater: .word 0
lowwater: .res 2