tebe6502/Mad-Assembler

Inconsistency in EOLs in generated files

Closed this issue · 5 comments

Example test.asm:

        org $2000
main    nop
@       nop

assemble mads test.asm -hc

The result is:

#ifndef _TEST_ASM_H_
#define _TEST_ASM_H_^M

#define TEST_MAIN 0x2000
#define TEST_0@ 0x2001
^M
#endif

where ^M is 0xD additional ascii code (some are 0xa and some 0xd0xa)

laoo commented

@jhusak It seems to be a duplicate of #41
Please try newest version from sources

Have you checked? Not a duplicate, but I have used the same example. There are many places in code with use #13#10 sequences. They are to be converted to LineEnding and the message printing system has to be simplified. I can do this, but it is rather major change, also in load_mes, so I wanted to discuss it with @tebe6502.

The proposition is to throw away mess array and do an array of string constants. Then put LineEnding everywhere instead #13#10 strings. Then files and messages generated (their format) will be system-dependent. On Unices it will be #10, On Windows #13#10, as expected.

BTW. I always use newest sources before raising issues.

laoo commented

@jhusak Indeed it's a different problem. But you forgot to mention the OS on which you have the result. I've checked it and on the Windows in every line there is 0xd0xa. So I assume the first and last empty line are added as arbitrary new-line and other lines are printed in a loop in a system dependent manner. This should bring @tebe6502 closer to a solution.

BTW. You could not check it on the then newest sources as #41 has been fixed on the spot on party place (where were you? ;) )

For me newest sources are on the master branch in github. Everything newer is in tests :) I did not mentioned the system, because it is obvious: not CRLF system (so not windows nor DOS).

As I said (wrote), the solution is to change the messages from byte array to array of strings. Then the compiler (well, the programmer, but compiler will allow to do this) can add LineEnding constant, which is dependent on the system. Then fix the hardcoded values in the code elsewhere. It is one-hour work, but I have to be blessed by @tebe6502 :)
I do not want to lose one hour of work of my life if he says "no" :)

fixed, #13#10 replaced by LineEnding