Skip to content

Commit

Permalink
chapter about listing differences added to manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Baron-von-Riedesel committed Dec 1, 2024
1 parent c831ef6 commit b2a6f2b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 21 deletions.
54 changes: 43 additions & 11 deletions Html/Manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ <H1 ID="CHAPCONTENTS"> 0. Contents </H1>
<DD> 6.4 <A HREF="#OUTPUTFORMATBIN">Binary Output Format</A></DD>
<DD> 6.5 <A HREF="#OUTPUTFORMATPE">PE Output Format</A></DD>
</DL>
<DD> 7. <A HREF="#CHAPMASMBUGS">Masm Bugs fixed in JWasm</A></DD>
<DD> 8. <A HREF="#CHAPOPTFEAT">Optional Features</A></DD>
<DD> 9. <A HREF="#CHAPKNOWNBUGS">Known Bugs and missing Features</A></DD>
<DD> 10. <A HREF="#CHAPLICENSE">License</A></DD>
<DD> 7. <A HREF="#CHAPLISTINGDIFF">Listing Differences</A></DD>
<DD> 8. <A HREF="#CHAPMASMBUGS">Masm Bugs fixed in JWasm</A></DD>
<DD> 9. <A HREF="#CHAPOPTFEAT">Optional Features</A></DD>
<DD> 10. <A HREF="#CHAPKNOWNBUGS">Known Bugs and missing Features</A></DD>
<DD> 11. <A HREF="#CHAPLICENSE">License</A></DD>
<DD> Appendix A. <A HREF="#AA">Reserved Words</A></DD>
<DD> Appendix B. <A HREF="#AB">Source Samples</A></DD>
<DD> Appendix C. <A HREF="#AC">Errors and Warnings</A></DD>
Expand Down Expand Up @@ -1708,7 +1709,39 @@ <H2 ID="OUTPUTFORMATPE"> 6.5 PE Output Format </H2>
</pre>


<H1 ID="CHAPMASMBUGS"> 7. Masm bugs fixed in JWasm </H1>
<H1 ID="CHAPLISTINGDIFF"> 7. Listing Differences </H1>

The listing file is divided into 2 parts: the source lines and the symbol table.
A source line consist of a 32-column header, followed by the original line of the source file itself.
JWasm's listing generation also follows this approach; the differences are:
<UL>
<LI>Masm divides the source file into pages. The size and format of those pages may be controlled by
directives PAGE, TITLE, SUBTITLE, SUBTTL. JWasm doesn't support this; hence you won't find a form feed
character ( 0x0C ) in the listing file ( unless the source file does contain such characters ).
</LI>
<LI>Jwasm doesn't use TABs in the header part of listing source lines.
</LI>
<LI>In Lines for EQUates and assembly-time variables, JWasm will only emit the current PC at line start
if the equate or assembly-time variable defines a (relocatable) label.
</LI>
<LI>For lines of a macro definition, the stored lines are marked with a &gt; in the header part.
</LI>
</LI>
<LI>Structure definition: the struct's current offset is always rendered as a 8-digit hexadecimal number.
Also, the struct's size is not displayed at the line of the STRUCT directive, but at the corresponding
ENDS directive.
</LI>
<LI>In data lines ( lines with directives DB, DW, ... ) the header is restricted to one line only. If the data
defined in the source needs more than one line to be displayed, it won't be shown in the header part.
This is considered a known bug, planned to be removed in a future release.
</LI>
<LI>In code lines, data with associated fixups are marked with a small letter suffix: 'r' for PC-relative
offsets, 'o' for absolute offsets, 'i' for image-relative offsets ( COFF/ELF only ), 's' for either segment fixups ( OMF )
or for section-relative offsets ( COFF/ELF ).
</LI>
</UL>

<H1 ID="CHAPMASMBUGS"> 8. Masm bugs fixed in JWasm </H1>

<TABLE CELLPADDING="4" CELLSPACING="2">

Expand Down Expand Up @@ -1794,7 +1827,7 @@ <H1 ID="CHAPMASMBUGS"> 7. Masm bugs fixed in JWasm </H1>
compatibility.
<P>
<P>
<H1 ID="CHAPOPTFEAT"> 8. Optional Features </H1>
<H1 ID="CHAPOPTFEAT"> 9. Optional Features </H1>

There exist some features that are not activated in the
precompiled binaries. To enable these options, the JWasm source must be
Expand All @@ -1807,7 +1840,7 @@ <H2> Support for Assembly Source generated by Intel C++ compiler</H2>
Masm syntax.
<P>
<P>
<H1 ID="CHAPKNOWNBUGS"> 9. Known Bugs and missing Features </H1>
<H1 ID="CHAPKNOWNBUGS"> 10. Known Bugs and missing Features </H1>

<H2> a) Bugs which are known but not fixed yet: </H2>

Expand Down Expand Up @@ -1850,7 +1883,7 @@ <H2> c) Missing features which most likely won't be implemented: </H2>
<DD> - commandline option -errorReport (Report internal assembler errors to Microsoft).
</DL>

<H1 ID="CHAPLICENSE"> 10. License </H1>
<H1 ID="CHAPLICENSE"> 11. License </H1>

<P> This manual was written by Andreas Grech ( aka Japheth ).
<P> It may be redistributed as long as it is free of charge.
Expand Down Expand Up @@ -5072,13 +5105,12 @@ <H1 ID="AC"> Appendix C. Errors and Warnings </H1>
<TR BGCOLOR="#F0F0F0">
<TD><b>x186</b></TD>
<TD>No 4k Page-aligned segments in MS386 OMF</TD>
<TD>A 4K page-aligned segment isn't compatible with MS OMF format, it's a Phar Lab extension.
This warning won't appear in the standard version.</TD>
<TD>A 4K page-aligned segment isn't compatible with MS OMF format, it's a PharLap extension.</TD>
</TR>

<TR BGCOLOR="#F0F0F0">
<TD><b>x187</b></TD>
<TD></TD>
<TD>Line number information for segment without class 'CODE': %s</TD>
<TD></TD>
</TR>

Expand Down
Binary file modified Regression/Regression.zip
Binary file not shown.
28 changes: 18 additions & 10 deletions src/listing.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ void LstWrite( enum lsttype type, uint_32 oldofs, void *value )
break;
}

p2 += sprintf( p2, (ModuleInfo.Ofssize > USE16 ? "%08" I32_SPEC "X " : "%04" I32_SPEC "X " ), oldofs );
/* v2.19: use '*' qualifier */
//p2 += sprintf( p2, (ModuleInfo.Ofssize > USE16 ? "%08" I32_SPEC "X " : "%04" I32_SPEC "X " ), oldofs );
p2 += sprintf( p2, "%0*" I32_SPEC "X ", ModuleInfo.Ofssize > USE16 ? 8 : 4, oldofs );

if ( Options.first_pass_listing ) {
break;
Expand Down Expand Up @@ -370,9 +372,12 @@ void LstWrite( enum lsttype type, uint_32 oldofs, void *value )
/* v2.10: display current offset if equate is an alias for a label in this segment
* v2.17: todo: explain why this might be useful - the current offset where an equate
* is defined should be pretty irrelevant.
* v2.19: Masm does this as well - actually it ALWAYS displays the current offset.
*/
if ( sym->segment && sym->segment == &CurrSeg->sym ) {
p2 += sprintf( ll.buffer, "%08" I32_SPEC "X", GetCurrOffset() );
/* v2.19: display 4-digit offset in 16-bit */
//p2 += sprintf( ll.buffer, "%08" I32_SPEC "X", GetCurrOffset() );
p2 += sprintf( ll.buffer, "%0*" I32_SPEC "X", ModuleInfo.Ofssize > USE16 ? 8 : 4, GetCurrOffset() );
}
*p2++ = ' ';
*p2++ = '=';
Expand Down Expand Up @@ -411,7 +416,9 @@ void LstWrite( enum lsttype type, uint_32 oldofs, void *value )
pSrcline = value;
break;
case LSTTYPE_LABEL:
p2 += sprintf( ll.buffer, (ModuleInfo.Ofssize > USE16 ? "%08" I32_SPEC "X " : "%04" I32_SPEC "X " ), GetCurrOffset() );
/* v2.19: use '*' qualifier */
//p2 += sprintf( ll.buffer, (ModuleInfo.Ofssize > USE16 ? "%08" I32_SPEC "X " : "%04" I32_SPEC "X " ), GetCurrOffset() );
p2 += sprintf( ll.buffer, "%0*" I32_SPEC "X ", ModuleInfo.Ofssize > USE16 ? 8 : 4, GetCurrOffset() );
break;
case LSTTYPE_STRUCT:
p2 += sprintf( ll.buffer, "%08" I32_SPEC "X ", oldofs );
Expand All @@ -425,10 +432,10 @@ void LstWrite( enum lsttype type, uint_32 oldofs, void *value )
break;
default: /* LSTTYPE_MACRO */
/* line without token or comment? */
if ( Token_Count == 0 && ModuleInfo.CurrComment == NULL && srcfile == ModuleInfo.srcfile ) {
ll.buffer[0] = NULLC;
p2++;
}
if ( Token_Count == 0 && ModuleInfo.CurrComment == NULL && srcfile == ModuleInfo.srcfile ) {
ll.buffer[0] = NULLC;
p2++;
}
break;
}

Expand Down Expand Up @@ -1325,13 +1332,14 @@ ret_code ListingDirective( int i, struct asm_tok tokenarray[] )
ModuleInfo.listif = !ModuleInfo.listif;
break;
case T_PAGE:
/* v2.19: expect one or 2 numeric arguments;
* they aren't used, though.
/* v2.19: optional 1 or 2 numeric arguments; they aren't used currently.
* first must be >= 14, <= 255 ( not checked yet )
* second must be >= 60, <= 255 ( not checked yet )
*/
j = i;
if ( ( ERROR == EvalOperand( &i, tokenarray, Token_Count, &opndx, 0 ) ) )
return( ERROR );
if ( opndx.kind != EXPR_CONST )
if ( opndx.kind != EXPR_CONST && opndx.kind != EXPR_EMPTY ) /* first arg may be omitted */
return( EmitErr( SYNTAX_ERROR_EX, tokenarray[j].tokpos ) );
if ( tokenarray[i].token == T_COMMA ) {
i++;
Expand Down

0 comments on commit b2a6f2b

Please sign in to comment.