I've been having some trouble with constant data included in my program being cleared already before my program starts running.
So I disassembled to linked executable of my program, and found this piece of code just 5 rows into the program. It is a loop which iterates 0x30 (48) times. Each time clearing one longword.
Code:
MOVE.L #$00000030,D0
BEQ.S LAB_0002
LEA __BSSBAS,A0
LAB_0001:
CLR.L (A0)+
SUBQ.L #1,D0
BNE.S LAB_0001
LAB_0002:
Further down the source is the __BSSBAS declaration:
Code:
SECTION S_2,DATA
SECSTRT_2:
DC.L $00220063,$41000000
__BSSBAS:
DS.L 1
_SysBase:
DS.L 1
_DOSBase:
DS.L 1
_WBenchMsg:
DS.L 1
__WBenchMsg:
DS.L 1
__stdin:
DS.L 1
__stdout:
DS.L 1
__stderr:
DS.L 1
_errno:
DS.L 1
___stack_usage:
DS.L 1
___stackLower:
DS.L 1
___stackPtr:
DS.L 1
SECTION S_3,DATA
SECSTRT_3:
DS.L 1
_GfxBase:
DS.L 1
There are 12 longwords from __BSSBAS to the end of the section, ie 48 (0x30) bytes.
The clearing loop in the beginning of the program appears to be clearing 4 times the data it should. So it basically goes on to clear some constant data I have included in my program.
Very strange! Is it a bug in vbcc?
VBCC 0.9e