Skip to content

Commit

Permalink
Update to 1.8g
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWolf3000 authored and mbitsnbites committed Nov 2, 2019
1 parent b2b4569 commit 46610fd
Show file tree
Hide file tree
Showing 21 changed files with 287 additions and 121 deletions.
2 changes: 1 addition & 1 deletion Makefile.OS4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \

CC = vc +aosppc
CCOUT = -o
COPTS = -c -DAMIGA -O1 $(OUTFMTS)
COPTS = -c -DAMIGA -D__USE_INLINE__ -O1 $(OUTFMTS)

LD = $(CC)
LDOUT = $(CCOUT)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.PUp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPTS = -c -c99 -DAMIGA -O1 $(OUTFMTS)

LD = $(CC)
LDOUT = $(CCOUT)
LDFLAGS = -lm
LDFLAGS = -lm -lamiga

RM = delete force quiet

Expand Down
2 changes: 1 addition & 1 deletion Makefile.WOS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPTS = -c -c99 -DAMIGA -O1 $(OUTFMTS)

LD = $(CC)
LDOUT = $(CCOUT)
LDFLAGS = -lm
LDFLAGS = -lm -lamiga

RM = delete force quiet

Expand Down
2 changes: 1 addition & 1 deletion cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void cond_check(void)
}


/* establish a new level of condititional assembly */
/* establish a new level of conditional assembly */
void cond_if(char flag)
{
if (++clev >= MAXCONDLEV)
Expand Down
2 changes: 1 addition & 1 deletion doc/cpu_jagrisc.texi
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ compatibility with various syntax modules.
@item Encoding of @code{MOVEI} instruction in little-endian mode is unkown.
@item The developer has to provide the necessary @code{NOP} instructions
after jumps, or @code{OR} instructions to work around hardware bugs,
himself.
her/himself.

@end itemize

Expand Down
2 changes: 1 addition & 1 deletion doc/output_hunk.texi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ selected with the @option{-Fhunk} option to generate objects and with the

@section Additional options for this module
@table @option
@iten -hunkpad=<code>
@item -hunkpad=<code>
Sets a two-byte code used for aligning a code hunk to the
next 32-bit border. Defaults to 0x4e71 on M68k to allow linking
of functions which extend over two object files.
Expand Down
33 changes: 26 additions & 7 deletions doc/syntax_mot.texi
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ This syntax module provides the following additional options:

@item -localu
Local symbols are prefixed by @code{'_'} instead of @code{'.'}. For
Devpac compatbility, which offers a similar option.
Devpac compatibility, which offers a similar option.

@item -phxass
PhxAss-compatibilty mode. Only directives known to PhxAss are recognized.
PhxAss-compatibility mode. Only directives known to PhxAss are recognized.
Enables the following features:
@itemize @minus
@item @code{section <name>} starts a code section named @code{<name>}
Expand Down Expand Up @@ -480,6 +480,25 @@ CPU- and output-module support them):
@item ifmacrond <macro>
Conditionally assemble the following line if <macro> is undefined.

@item iif <expression> <statement>
Conditionally assemble the <statement> following <expression>.
IIF stands for Immediate IF.
If the value of <expression> is non-zero then <statement> is assembled.
No @code{ENDC} should be used in conjunction with this directive.
The <statement> can not include a label, but a label may precede the
@code{IIF} directive. For example:
@code{foo IIF bar equ 42}
The @code{foo} label will be assigned with @code{42} if @code{bar}
evaluates to true, otherwise @code{foo} will be assigned with the
current program counter.
The case when assigning a value in the @code{IIF <statement>} using
the equal (@code{=}) operator and the option @option{-spaces}
is used can't work as the equal operator
will be evaluated as part of the expression.
I.e. @code{foo IIF 1+1 = 42} will work, but @code{foo IIF 1 + 1 = 42}
when the option @option{-spaces} is specified won't work as
@code{= 42} will be evaluated as part of the expression.

@item incbin <file>[,<offset>[,<length>]]
Inserts the binary contents of <file> into the object code at
this position. When <offset> is specified, then the given number
Expand All @@ -488,7 +507,7 @@ CPU- and output-module support them):
from that file.
The file will be searched first in the current
directory, then in all paths defined by @option{-I} or @code{incdir}
in the order of occurence.
in the order of occurrence.

@item incdir <path>
Add another path to search for include files to the list of
Expand All @@ -499,7 +518,7 @@ CPU- and output-module support them):
Include source text of <file> at this position. The include file
will be searched first in the current directory, then in all
paths defined by @option{-I} or @code{incdir} in the order of
occurence.
occurrence.

@item inline
Local labels in the following block are isolated from previous
Expand Down Expand Up @@ -678,11 +697,11 @@ CPU- and output-module support them):
contain a new value from now on.

@item setfo <expression>
Sets the stack-frame offset counter to <expresion>.
Sets the stack-frame offset counter to <expression>.
See @code{fo} directive.

@item setso <expression>
Sets the structure offset counter to <expresion>.
Sets the structure offset counter to <expression>.
See @code{so} directive.

@item <label> so.<size> <expression>
Expand Down Expand Up @@ -742,7 +761,7 @@ This module has the following error messages:
@itemize @minus
@item 1001: mnemonic expected
@item 1002: invalid extension
@item 1003: no space before oprands
@item 1003: no space before operands
@item 1004: too many closing parentheses
@item 1005: missing closing parentheses
@item 1006: missing operand
Expand Down
8 changes: 7 additions & 1 deletion doc/vasm_main.texi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ or additional options.
Prints dependencies in the same way as @option{-depend}, but
will also print all include files with absolute paths.

@item -depfile <filename>
Used together with @option{-depend} or @option{-dependall} and
instructs vasm to output all dependencies to a new file, instead
of stdout. Code will be generated in parallel to the dependencies
output.

@item -dwarf[=<version>]
Automatically generate DWARF debugging sections, suitable for
source level debugging. When the version specification is missing
Expand Down Expand Up @@ -410,7 +416,7 @@ The frontend has the following error messages:
@item 26: missing end directive for macro "%s"
@item 27: macro definition inside macro "%s"
@item 28: maximum number of %d macro arguments exceeded
@item 29: option -%c was specified twice
@item 29: option %s was specified twice
@item 30: read error on <%s>
@item 31: expression must be constant
@item 32: initialized data in bss
Expand Down
10 changes: 5 additions & 5 deletions dwarf.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static struct DWinclude *new_dwinc(char *name)

/* DWARF needs source file lists with the file name part only, but without
any path in it. Include paths are put into another list. */
static void make_file_lists(char *compdir,struct source_file *first_source)
static void make_file_lists(struct source_file *first_source)
{
struct source_file *srcnode;
struct include_path *incnode;
Expand All @@ -84,8 +84,8 @@ static void make_file_lists(char *compdir,struct source_file *first_source)

if ((incnode = srcnode->incpath) != NULL) {
if (incnode->compdir_based) {
if (compdir != NULL)
strcpy(pathbuf,compdir);
if (compile_dir != NULL)
strcpy(pathbuf,compile_dir);
else
ierror(0);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ static void make_file_lists(char *compdir,struct source_file *first_source)
}


void dwarf_init(struct dwarf_info *dinfo,char *compile_dir,
void dwarf_init(struct dwarf_info *dinfo,
struct include_path *first_incpath,
struct source_file *first_source)
{
Expand Down Expand Up @@ -279,7 +279,7 @@ void dwarf_init(struct dwarf_info *dinfo,char *compile_dir,
add_data_atom(dsec,1,1,stdopclengths[i]);

/* make lists of DWARF directories and files */
make_file_lists(compile_dir,first_source);
make_file_lists(first_source);

/* list of include directories, CWD-entry (index 0) is not written */
for (dwinc=first_dwinc; dwinc; dwinc=dwinc->next)
Expand Down
2 changes: 1 addition & 1 deletion dwarf.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct dwarf_info {


/* functions */
void dwarf_init(struct dwarf_info *,char *,struct include_path *,struct source_file *);
void dwarf_init(struct dwarf_info *,struct include_path *,struct source_file *);
void dwarf_finish(struct dwarf_info *);
void dwarf_end_sequence(struct dwarf_info *,section *);
void dwarf_line(struct dwarf_info *,section *,int,int);
28 changes: 21 additions & 7 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ static void print_source_line(FILE *f)
}


static void print_source_file(FILE *f, source *src)
{
if (src->srcfile)
fprintf(f,"\"%s%s%s\"",
src->srcfile->incpath->compdir_based
? compile_dir : "",
src->srcfile->incpath->path,
src->srcfile->name);
else
fprintf(f,"\"%s\"",src->name);
}


static void error(int n,va_list vl,struct err_out *errlist,int offset)
{
static source *last_err_source = NULL;
Expand All @@ -81,6 +94,8 @@ static void error(int n,va_list vl,struct err_out *errlist,int offset)
return;

if ((flags&MESSAGE) && !(flags&(WARNING|ERROR|FATAL))) {
if (nostdout)
return;
f = stdout; /* print messages to stdout */
}
else {
Expand Down Expand Up @@ -119,10 +134,10 @@ static void error(int n,va_list vl,struct err_out *errlist,int offset)
else if (flags & MESSAGE)
fprintf(f,"message");
fprintf(f," %d",n+offset);
if (!(flags & NOLINE) && cur_src!=NULL)
fprintf(f," in line %d of \"%s%s\"",cur_src->line,
cur_src->srcfile?cur_src->srcfile->incpath->path:"",
cur_src->name);
if (!(flags & NOLINE) && cur_src!=NULL) {
fprintf(f," in line %d of ",cur_src->line);
print_source_file(f,cur_src);
}
fprintf(f,": ");
vfprintf(f,errlist[n].text,vl);
fprintf(f,"\n");
Expand All @@ -138,9 +153,8 @@ static void error(int n,va_list vl,struct err_out *errlist,int offset)
fprintf(f,"\tcalled"); /* macro called from */
else
fprintf(f,"\tincluded"); /* included from */
fprintf(f," from line %d of \"%s%s\"",child->parent_line,
parent->srcfile?parent->srcfile->incpath->path:"",
parent->name);
fprintf(f," from line %d of ",child->parent_line);
print_source_file(f,parent);

recurs = 1;
while (parent->parent!=NULL &&
Expand Down
2 changes: 1 addition & 1 deletion error.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* (c) in 2002-2009,2015,2018 by Volker Barthelmann and Frank Wille */

#ifndef ERROR_H
#define ERROR_H
#define ERROR_H

#define FIRST_GENERAL_ERROR 1
#define FIRST_SYNTAX_ERROR 1001
Expand Down
12 changes: 7 additions & 5 deletions expr.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* expr.c expression handling for vasm */
/* (c) in 2002-2018 by Volker Barthelmann and Frank Wille */
/* (c) in 2002-2019 by Volker Barthelmann and Frank Wille */

#include "vasm.h"

Expand Down Expand Up @@ -950,12 +950,12 @@ int eval_expr(expr *tree,taddr *result,section *sec,taddr pc)
case SUB:
find_base(tree->left,&lsym,sec,pc);
find_base(tree->right,&rsym,sec,pc);
if(cnst==0&&lsym!=NULL&&rsym!=NULL&&LOCREF(rsym)){
if(LOCREF(lsym)&&lsym->sec==rsym->sec){
if(cnst==0&&rsym!=NULL&&LOCREF(rsym)){
if(lsym!=NULL&&LOCREF(lsym)&&lsym->sec==rsym->sec){
/* l2-l1 is constant when both have a valid symbol-base, and both
symbols are LABSYMs from the same section, e.g. (sym1+x)-(sym2-y) */
cnst=1;
}else if(rsym->sec==sec&&(EXTREF(lsym)||LOCREF(lsym))){
}else if(lsym!=NULL&&(rsym->sec==sec&&(EXTREF(lsym)||LOCREF(lsym)))){
/* Difference between symbols from different section or between an
external symbol and a symbol from the current section can be
represented by a REL_PC, so we calculate the addend. */
Expand All @@ -966,7 +966,9 @@ int eval_expr(expr *tree,taddr *result,section *sec,taddr pc)
val=(pc-rval+lval-(lsym->sec?lsym->sec->org:0));
break;
}
}
}else if(lsym==NULL&&(rsym->flags&ABSLABEL))
/* const-label is valid and yields a const in absolute ORG sections */
cnst=1;
}
val=(lval-rval);
break;
Expand Down
2 changes: 1 addition & 1 deletion general_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"missing end directive for macro \"%s\"",ERROR|FATAL, /* 25 */
"macro definition inside macro \"%s\"",ERROR|FATAL,
"maximum number of %d macro arguments exceeded",ERROR,
"option -%c was specified twice",NOLINE|WARNING,
"option %s was specified twice",NOLINE|WARNING,
"read error on <%s>",NOLINE|ERROR|FATAL,
"expression must be constant",ERROR, /* 30 */
"initialized data in bss",WARNING,
Expand Down
13 changes: 12 additions & 1 deletion history
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
vasm history
=============

- 1.8g (NO-RELEASE)
- 1.8g (04.10.19)
o Do not print informational messages when generating dependencies.
o New option -depfile to specify a file name for the dependency output.
Code generation may happen in parallel in this case.
o Include the compile directory in the path, when printing error messages.
o Treat a subtraction of a label from a constant as constant, when the
label is from an absolute ORG section.
o m68k: -opt-allbra makes sure that branch-optimization is enabled.
o z80: "ld (BC/DE/HL),abs" is an illegal addressing mode.
o mot-syntax: SECTION directive with a single argument is interpreted as
section-type when the output format is "tos". Otherwise the type
defaults to CODE.
o mot-syntax: In devpac-compatibility mode allow '@' in the middle of labels.
o mot-syntax: -phxass compatibility mode allows dots ('.') in labels (-ldots).
o mot-syntax: Added support for Devpac IIF directive.
o output-hunk: Fixed LINE debug hunk output (-linedebug). Now it can
deal with code from multiple sources and the line numbers for
executing macros and repetitions are correct.
o output-hunk: New option -hunkpad=<code> selects the padding code for
code sections to achieve 32-bit alignment. Default to 0x4e71 (NOP)
for M68k.
Expand Down
7 changes: 5 additions & 2 deletions osdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,13 @@ char *get_workdir(void)
{
static char buf[MAX_WORKDIR_LEN];

#ifndef __amigaos4__
if (DOSBase->dl_lib.lib_Version < 36)
buf[0] = '\0';
else if (!GetCurrentDirName(buf,MAX_WORKDIR_LEN))
buf[0] = '\0';
else
#endif
if (!GetCurrentDirName(buf,MAX_WORKDIR_LEN))
buf[0] = '\0';
return buf;
}

Expand Down
Loading

0 comments on commit 46610fd

Please sign in to comment.