KarolS/millfork

Structs can't have volitile members

oziphantom opened this issue · 1 comments

For example

struct sWater {
        volatile byte CurrentMapTileIndex
	byte Direction
	word Screen
	word Screen2
	word StackPointer
	word StackPointer2
	byte ORValue
	byte TileCounter
	byte ORValue2
	array EnabledNF[2]
	word StartPosition
	byte StartDirection
	byte StartIndex
}

So if you have a function that modifies the global struct, then it will get optimized out as it won't see CurrentMapTileIndex gets changed. You can't make it volatile so you have to make it, its own global.
Also making a struct to handle say a VIC or CIA would also want volatile.

That's a great suggestion, thanks. I'll implement it.