delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/11/24/02:12:06

Sender: bill AT taniwha DOT tssc DOT co DOT nz
Message-ID: <365A5C4C.8CA2FCC1@taniwha.tssc.co.nz>
Date: Tue, 24 Nov 1998 20:12:12 +1300
From: Bill Currie <bill AT taniwha DOT tssc DOT co DOT nz>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.1.129 i486)
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: djasm patches (final for 2.2)
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.
--------------AED9A63943D690ABCBFD93E7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This patch enables shift type operations on memory (eg rorb [foo]) and
corrects the resulting conflict for shld/shrd (64 bit shift).  These
names now do 32 bit memory shifts and the 64 bit shifts are now shldl
and shrdl.  The 64 bit shifts do not accept memory operands (never did
anyway), even though the i386 allows this (just not implemented; should
I for 2.2? easy enough to do).

There is also a patch to change the max length of the strncat for
copyright messages from 476 to 480.  I can't remember why I made this
change, but more importantly, why is the lenght of the current copyright
string subtracted from the max length?  This in effect makes the max
copyright lenght 240 (238 prev), or have I goofed?

Bill
-- 
Leave others their otherness.
--------------AED9A63943D690ABCBFD93E7
Content-Type: text/plain; charset=us-ascii; name="djasm.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="djasm.diff"

*** src/stub/djasm.y	Tue Jul 28 17:44:32 1998
--- ../djasm/djasm.y	Sun Aug  2 20:48:28 1998
***************
*** 227,233 ****
  %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
  %token <i> BITTEST GROUP3 GROUP3B GROUP3D GROUP3W GROUP6 GROUP7 STRUCT
  %token ALIGN ARPL
--- 226,232 ----
  %token <i> ARITH2 ARITH2B ARITH2D ARITH2W
  %token <i> LXS MOVSZX MOVSZXB MOVSZXW
  %token <i> JCC JCCL JCXZ LOOP SETCC
! %token <i> SHIFT SHIFTB SHIFTD SHIFTW SHLRD
  %token <i> ONEBYTE TWOBYTE ASCADJ
  %token <i> BITTEST GROUP3 GROUP3B GROUP3D GROUP3W GROUP6 GROUP7 STRUCT
  %token ALIGN ARPL
***************
*** 517,530 ****
--- 516,544 ----
    {"pushw", PUSHW, NO_ATTR},
    {"pushd", PUSHD, NO_ATTR},
    {"rcl", SHIFT, 2},
+   {"rclb", SHIFTB, 2},
+   {"rcld", SHIFTD, 2},
+   {"rclw", SHIFTW, 2},
    {"rcr", SHIFT, 3},
+   {"rcrb", SHIFTB, 3},
+   {"rcrd", SHIFTD, 3},
+   {"rcrw", SHIFTW, 3},
    {"ret", RET, NO_ATTR},
    {"retd", RETD, NO_ATTR},
    {"retf", RETF, NO_ATTR},
    {"retfd", RETFD, NO_ATTR},
    {"rol", SHIFT, 0},
+   {"rolb", SHIFTB, 0},
+   {"rold", SHIFTD, 0},
+   {"rolw", SHIFTW, 0},
    {"ror", SHIFT, 1},
+   {"rorb", SHIFTB, 1},
+   {"rord", SHIFTD, 1},
+   {"rorw", SHIFTW, 1},
    {"sar", SHIFT, 7},
+   {"sarb", SHIFTB, 7},
+   {"sard", SHIFTD, 7},
+   {"sarw", SHIFTW, 7},
    {"sbb", ARITH2, 3},
    {"sbbb", ARITH2B, 3},
    {"sbbd", ARITH2D, 3},
***************
*** 565,574 ****
    {"sidt", GROUP7, 1},
    {"sldt", GROUP6, 0},
    {"sal", SHIFT, 4},
    {"shl", SHIFT, 4},
!   {"shld", SHLRD, 0xa4},
    {"shr", SHIFT, 5},
!   {"shrd", SHLRD, 0xac},
    {"smsw", GROUP7, 4},
    {"str", GROUP6, 1},
    {"sub", ARITH2, 5},
--- 579,597 ----
    {"sidt", GROUP7, 1},
    {"sldt", GROUP6, 0},
    {"sal", SHIFT, 4},
+   {"salb", SHIFTB, 4},
+   {"sald", SHIFTD, 4},
+   {"salw", SHIFTW, 4},
    {"shl", SHIFT, 4},
!   {"shlb", SHIFTB, 4},
!   {"shld", SHIFTD, 4},
!   {"shlw", SHIFTW, 4},
!   {"shldl", SHLRD, 0xa4},
    {"shr", SHIFT, 5},
!   {"shrb", SHIFTB, 5},
!   {"shrd", SHIFTD, 5},
!   {"shrw", SHIFTW, 5},
!   {"shrdl", SHLRD, 0xac},
    {"smsw", GROUP7, 4},
    {"str", GROUP6, 1},
    {"sub", ARITH2, 5},
***************
*** 997,1006 ****
--- 1020,1035 ----
  
  	| SHIFT REG8 ',' const		{ emitb($4 == 1 ? 0xd0 : 0xc0); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
  	| SHIFT REG8 ',' REG8		{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd2); modrm(3, $1, $2); }
+ 	| SHIFTB regmem ',' const	{ emitb($4 == 1 ? 0xd0 : 0xc0); reg($1); if ($4 != 1) emitb($4); }
+ 	| SHIFTB regmem ',' REG8	{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd2); reg($1); }
  	| SHIFT REG16 ',' const       	{ emitb($4 == 1 ? 0xd1 : 0xc1); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
  	| SHIFT REG16 ',' REG8		{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd3); modrm(3, $1, $2); }
+ 	| SHIFTW regmem ',' const	{ emitb($4 == 1 ? 0xd1 : 0xc1); reg($1); if ($4 != 1) emitb($4); }
+ 	| SHIFTW regmem ',' REG8	{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0xd3); reg($1); }
  	| SHIFT REG32 ',' const       	{ emitb(0x66); emitb($4 == 1 ? 0xd1 : 0xc1); modrm(3, $1, $2); if ($4 != 1) emitb($4); }
  	| SHIFT REG32 ',' REG8		{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0x66); emitb(0xd3); modrm(3, $1, $2); }
+ 	| SHIFTD regmem ',' const	{ emitb(0x66); emitb($4 == 1 ? 0xd1 : 0xc1); reg($1); if ($4 != 1) emitb($4); }
+ 	| SHIFTD regmem ',' REG8	{ if ($4 != 1) djerror ("Non-constant shift count must be `cl'"); emitb(0x66); emitb(0xd3); reg($1); }
  
  	| SHLRD REG16 ',' REG16 ',' const
  	  { emitb(0x0f); emitb($1); modrm(3, $4, $2); emitb($6); }
***************
*** 1364,1370 ****
    time(&now);
    sprintf(exe+28, "\r\n%s generated from %s by djasm, on %.24s\r\n", argv[2], argv[1], ctime(&now));
    if (copyright)
!     strncat(exe+36, copyright, 476-strlen(exe+36));
    strcat(exe+36, "\r\n\032");
  
    if (argv[2] == 0)
--- 1393,1399 ----
    time(&now);
    sprintf(exe+28, "\r\n%s generated from %s by djasm, on %.24s\r\n", argv[2], argv[1], ctime(&now));
    if (copyright)
!     strncat(exe+36, copyright, 480-strlen(exe+36));
    strcat(exe+36, "\r\n\032");
  
    if (argv[2] == 0)

--------------AED9A63943D690ABCBFD93E7--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019