BASCOM initializes the processor depending on the used statements.

When you want to handle this by yourself you can specify this by the meta command $NOINIT.

The only initialization that is always done is the setting of the stack pointer and the initialization of the LCD display (if LCD related statements are used).

You can use the $NOSP statement when you don't want the stack pointer to be set.

All data used for variables like the internal RAM or external RAM, is in an unknown condition at startup. This means that you can not assume that a variables is 0.

For example:

Dim a as byte

Print a


When you run the code, a can contain any value. When you want to be sure the variable is 0. Assign it with 0. During a reset, the memory content might be the same as before the reset, but again, there is no guarantee.