Mad-Pascal icon indicating copy to clipboard operation
Mad-Pascal copied to clipboard

Phase error detection code safe to alter?

Open noyen1973 opened this issue 1 year ago • 1 comments

The block of code surrounding line #15308 in src\mp.pas appears to detect phase errors during the the assembly process. How safe is it to change the $120 to $1 so that there is no deviance between the current assembly pass and the previous pass? Is there a possibility Mads could get stuck in an endless loop flip/flopping an address calculation?

https://github.com/tebe6502/Mad-Pascal/blob/65e009feb12bb3b4b42317db9234c337515aaf66/src/mp.pas#L15308

I'm trying to output to a PGZ file format but it requires the known length of Mads' final .OBX file to be used in the file header written before the object file. I have all the extra code in place and inserted a new line after the Fastmul detection, line #15042, asm65('F256BINARYSIZE'#9'= * - CODEORIGIN');. However, with the $120 value in line #15308 the value is off by several bytes for my game. Changing the value to $1 resulted in an extra pass and the correct size calculation for a working PGZ file.

noyen1973 avatar Jan 16 '24 00:01 noyen1973

The value $120 is not random, for other values there may be an endless loop, it depends on the complexity of the example

tebe6502 avatar Jan 18 '24 22:01 tebe6502