Issues with -bin output
I've been testing with the -bin option (hoping to simplify the build process by removing the link step since this is a single file project), and noticing some odd results. First, using a SEGMENT AT if you do a SEG on a label within, MASM and WLINK/JWLINK will produce the 30H, however -bin does not. Using a SEG (segment name) does work. For example:
jwasm -Fl -Zm -bin produces:
0000 _SEG_AT SEGMENT AT 30H
DB 80H DUP(?)
0000 TOP LABEL WORD
0000 _SEG_AT ENDS
0000 START:
0000 B8 0000s MOV AX, SEG _SEG_AT ; should be 30H
0003 90 NOP
0004 90 NOP
;ORG 10H ; add this later
0005 B8 0000s MOV AX, SEG TOP ; also should be 30H but assembles/links to 80H
0008 90 NOP
0009 90 NOP
000A 90 NOP
000B 90 NOP
000C C3 RET
Binary output:
00000000: b830 0090 90b8 0000 3000 9090 c3 .0......0....
Disassembled:
However, if you put an ORG in there (uncomment the statement from the lst example), things go a little off and you seemingly get garbage linked within the file and the second statement "eats" the first two NOPs.
00000000: b830 0090 902e 1a00 3434 1a00 0000 0000 .0......44......
00000010: b880 0030 0090 90c3 ...0....
Once again, I'm sure this is a more rarely used feature and an uncommon combination of syntax. And also the more tests I did to try to understand the pattern to the behavior, the more different the results were so I'm not clear what to report other than these combination of things seem to produce indeterminate results.
Edit:
The SEG issue and the ORG issue may be unrelated. If you replace those with MOV AX, imm you still get the "garbage" between the last instruction and the ORG.
00000000: b801 0090 9000 3038 2020 2020 7034 1a00 ......08 p4..
00000010: b802 0090 9090 90c3 ........
640KB