struct stat st;
char *next;
int backup_line_num,backup_file_num;
+ size_t rsize;
buff[i].mem_end = buff[i].mem_start+st.st_size;
- read(fd, buff[i].mem_start, st.st_size);
+ rsize = read(fd, buff[i].mem_start, st.st_size);
close(fd);
+ if (rsize != st.st_size)
+ as_exit("short read from input file\n");
#ifdef DEBUG
printf("File %s opened:\n",name);
val = __cpu_to_le32(tram_sym->data.value);
fwrite(&val,sizeof(u32),1,fp);
if(listing){
- if(type==TYPE_TRAM_ADDR_READ)
+ if(type==TYPE_TRAM_ADDR_READ) {
fprintf(listfile,"\tRead");
- else
+ } else {
fprintf(listfile,"\tWrite");
+ }
- fprintf(listfile,": 0x3%02x/0x2%02x (%s), offset 0x%07x\n",tram_sym->data.address,tram_sym->data.address,
- (prev_sym((&tram_sym->list)))->data.name,tram_sym->data.value);
+ fprintf(listfile,": 0x3%02x/0x2%02x (%s), offset 0x%07x\n",tram_sym->data.address,tram_sym->data.address,
+ (prev_sym((&tram_sym->list)))->data.name,tram_sym->data.value);
}
}
#include"types.h"
#include"proto.h"
+#include"parse.h"
extern int dbg_opt;
extern FILE *listfile;
int w0, w1;
extern int dsp_code[DSP_CODE_SIZE];
extern int ip;
- extern char op_codes[35][9];
extern char listtemp[60];
if (ip >= 0x200)
as_exit("to many instructions");
extern int gpr_input_count,gpr_output_count,gpr_static_count,gpr_dynamic_count,gpr_control_count,gpr_constant_count;
struct sym *sym;
- struct tram *tmp_ptr;
extern struct list_head sym_head;
extern struct delay tram_delay[MAX_TANK_ADDR];
extern struct lookup tram_lookup[MAX_TANK_ADDR];
else
tram_delay[tmp].write++;
}else{
- tmp_ptr=(struct tram *)sym;
list_add_tail(&(((struct tram *)sym)->tram) , &(tram_lookup[tmp].tram) );
- tmp_ptr=(struct tram *)sym;
- if(type== TYPE_TRAM_ADDR_READ)
+ if(type== TYPE_TRAM_ADDR_READ)
tram_lookup[tmp].read++;
else
tram_lookup[tmp].write++;
void macro_expand(int macnum,char *operand )
{
char *line,*next;
- int done=0,i,old;
+ int done=0,old;
extern unsigned int macro_depth;
extern int macro_line_num;
char string[MAX_LINE_LENGTH];
- //initialize macro use:
- i=0;
-
if(macro_depth+1> MAX_MAC_DEPTH)
as_exit("Error exceeded maximum number of recursive macro calls");
#include<string.h>
#include<stdio.h>
#include"types.h"
+#define DECLARE_OP_CODES
#include"parse.h"
#include"proto.h"
if((tmp=ismacro(op_name_ptr)) != -1 ){
if(defmacro==0)
macro_expand(tmp,strtok(NULL,""));
- return(0);
+ return(0);
}
if( (op_num=op_decode(op_name_ptr))==-1) {
};
-
+#ifndef DECLARE_OP_CODES
+extern char op_codes[NUM_OPS+1][9];
+#else
char op_codes[NUM_OPS+1][9]=
{
"MACS",
"con",
"NotAnOp"
};
+#endif
//extern int file_num,source_line_num