Mail Archives: djgpp-workers/1997/09/16/17:51:53
--Message-Boundary-25008
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
These are relative to my previous set of patches for djasm.
- fix some bugs with structures inside unions
- enhanced structure members
- mov[sz]x[bw] from memory to a register (16 or 32 bit)
As a total aside, can anyone tell me why I'm doing this? I could
just as easily use NASM (and have) so why do I use djasm? The only
thing I can think of is that in using djasm, I get to enhance it and
make a contribution to djgpp.
Bill
--
Leave others their otherness.
--Message-Boundary-25008
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'djasm.patch2'
*** djasm.y~ Fri Sep 12 22:18:24 1997
--- djasm.y Wed Sep 17 01:30:56 1997
***************
*** 121,127 ****
void destroy_symbol(Symbol *sym, int undef_error);
void destroy_locals(void);
void add_struct_element(Symbol *s);
- int set_structor_symbols(Symbol *ele, Symbol *struc, int base, int type);
void emit_struct(Symbol *ele, int tp, Symbol *struc);
void build_struct(Symbol *ele, int tp, Symbol *struc);
int undefs = 0;
--- 121,126 ----
***************
*** 199,205 ****
%token <i> NUMBER REG8 REG16 REG32 SREG STRING PC CRREG DRREG TRREG
%token <i> ARITH2 ARITH2B ARITH2D ARITH2W
! %token <i> LXS MOVSZX
%token <i> JCC JCCL JCXZ LOOP SETCC
%token <i> SHIFT SHLRD
%token <i> ONEBYTE TWOBYTE ASCADJ
--- 198,204 ----
%token <i> NUMBER REG8 REG16 REG32 SREG STRING PC CRREG DRREG TRREG
%token <i> ARITH2 ARITH2B ARITH2D ARITH2W
! %token <i> LXS MOVSZX MOVSZXB MOVSZXW
%token <i> JCC JCCL JCXZ LOOP SETCC
%token <i> SHIFT SHLRD
%token <i> ONEBYTE TWOBYTE ASCADJ
***************
*** 465,471 ****
--- 464,474 ----
{"movd", MOVD, NO_ATTR},
{"movw", MOVW, NO_ATTR},
{"movsx", MOVSZX, 0xbe},
+ {"movsxb", MOVSZXB, 0xbe},
+ {"movsxw", MOVSZXW, 0xbe},
{"movzx", MOVSZX, 0xb6},
+ {"movzxb", MOVSZXB, 0xb6},
+ {"movzxw", MOVSZXW, 0xb6},
{"mul", GROUP3, 4},
{"mulb", GROUP3B, 4},
{"muld", GROUP3D, 4},
***************
*** 896,901 ****
--- 899,908 ----
| MOVSZX REG32 ',' REG8 { emitb(0x66); emitb(0x0f); emitb($1); modrm(3, $2, $4); }
| MOVSZX REG32 ',' REG16 { emitb(0x66); emitb(0x0f); emitb($1+1); modrm(3, $2, $4); }
+ | MOVSZXB REG16 ',' regmem { emitb(0x0f); emitb($1); reg($2); }
+ | MOVSZXB REG32 ',' regmem { emitb(0x66); emitb(0x0f); emitb($1); reg($2); }
+ | MOVSZXW REG32 ',' regmem { emitb(0x66); emitb(0x0f); emitb($1+1); reg($2); }
+
| ORG const { if (pc > $2) yyerror ("Backwards org directive"); else while (pc < $2) emitb(0x90); }
| ORG const ',' const { if (pc > $2) yyerror ("Backwards org directive"); else while (pc < $2) emitb($4); }
***************
*** 998,1003 ****
--- 1005,1011 ----
:
| ID ':' { add_struct_element($1); }
| ID STRUCT ID { build_struct($1,$2,$3); }
+ | STRUCT ID { build_struct(0,$1,$2); }
| struct_db
| ID { add_struct_element($1); }
struct_db
***************
*** 1583,1604 ****
void build_struct(Symbol *ele, int tp, Symbol *struc)
{
! if (islocal(ele->name) || istemp(ele->name,0)) {
yyerror("Cannot have local or temporary labels within a structure");
} else {
! char *id=alloca(strlen(ele->name)+strlen(struct_sym)+2);
strcpy(id,struct_sym);
! strcat(id,".");
! strcat(id,ele->name);
! if (!ele->defined && !ele->patches) {
! /* only delete fresh symbols */
! destroy_symbol(ele,0);
}
- set_structure_symbols(get_symbol(id,1),struc,tp,struct_pc,0);
if (struct_tp=='s')
struct_pc+=struc->value;
else
! struct_pc+=MAX(struct_pc,struc->value);
}
}
--- 1591,1623 ----
void build_struct(Symbol *ele, int tp, Symbol *struc)
{
! if (ele && (islocal(ele->name) || istemp(ele->name,0))) {
yyerror("Cannot have local or temporary labels within a structure");
} else {
! char *id=alloca((ele?strlen(ele->name):0)+strlen(struct_sym)+2);
! Symbol *sym;
strcpy(id,struct_sym);
! if (ele) {
! strcat(id,".");
! strcat(id,ele->name);
! if (!ele->defined && !ele->patches) {
! /* only delete fresh symbols */
! destroy_symbol(ele,0);
! }
! }
! sym=get_symbol(id,1);
! if (!ele) {
! symtab=symtab->next;
! sym->next=0;
! }
! set_structure_symbols(sym,struc,tp,(struct_tp=='s')?struct_pc:0,0);
! if (!ele) {
! destroy_symbol(sym,0);
}
if (struct_tp=='s')
struct_pc+=struc->value;
else
! struct_pc=MAX(struct_pc,struc->value);
}
}
--Message-Boundary-25008--
- Raw text -