delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/11/11/19:23:33

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:mime-version:received:in-reply-to:references
:date:message-id:subject:from:to:content-type;
bh=nBDw0OFnOlYxVXYKq1eLudApIGjs4toZV0qrqiovCIQ=;
b=rlWmqvEzz62cmMrG9MYXVA4LT+zzjfRfrU/AVQau4IJFMAODNCeQkPBp5gZYModOPj
OXwI+KDdChiVOzerfWdhvN1vPqATpgSvqiSlEYlo3tt+aQc5Oy4ej+fIzgx61pgH7e5a
AtliPOcMlPIM456vHbs6CQDl5yH4gWvtp2dlI=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
b=bPSGS3lpe7Gm6sgnqFn9cwNePa+tF+Pa6ZWRuK74WTHARDk+5kW+nmz1SDxeV5nujb
xs3Ls1JKC7xWcjJ2ZSUOCkkPDwzX5JApsS84VexoyzOcvkaULB9pWkoE5nGXTXDk2xjW
lVO9ZtetM7HNbSOaW4Si8E/xlhg/2SVLGBANY=
MIME-Version: 1.0
In-Reply-To: <93c172b50911111559t37cfbc6p5b9063354fa90dab@mail.gmail.com>
References: <0008cd2e-63c9-43cb-82d4-11aece7c209f AT c3g2000yqd DOT googlegroups DOT com>
<200911100429 DOT nAA4T6BM021619 AT envy DOT delorie DOT com>
<b74a4c40-3d78-4952-98b0-ff9777f0594d AT p35g2000yqh DOT googlegroups DOT com>
<200911102010 DOT nAAKAxKI006111 AT envy DOT delorie DOT com>
<ebf65bf7-5445-44cc-a73f-7dd40fbe49d3 AT v30g2000yqm DOT googlegroups DOT com>
<hddtej$g02$1 AT aioe DOT org>
<b7e3b865-abbc-4ee7-a29a-88239153ad80 AT k17g2000yqh DOT googlegroups DOT com>
<93c172b50911111559t37cfbc6p5b9063354fa90dab AT mail DOT gmail DOT com>
Date: Wed, 11 Nov 2009 18:02:39 -0600
Message-ID: <93c172b50911111602w56b341aeva794e508496122f3@mail.gmail.com>
Subject: Re: GAS ".code16" and DJASM quirks ...
From: Rugxulo <rugxulo AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Hi again,

On Wed, Nov 11, 2009 at 5:59 PM, Rugxulo <rugxulo AT gmail DOT com> wrote:
>
> Okay, here's a small context diff against DJASM with Martin's
> suggestions (and it works, too):

Hmmm, maybe I should've diff'd against the latest DJASM.Y from CVS
instead. Hope this isn't too annoying.   :-/


*** djasm.y	Fri Aug 29 08:33:00 2008
--- martin.y	Wed Nov 11 17:51:16 2009
***************
*** 15,25 ****
  #include <time.h>
  #include <ctype.h>
  #include <unistd.h>
  #ifndef O_BINARY
  #define O_BINARY 0
  #endif
  #undef _POSIX_SOURCE
! #include "../../include/coff.h"

  #define SMALL_EXE_HEADER 0
  #if SMALL_EXE_HEADER
--- 15,26 ----
  #include <time.h>
  #include <ctype.h>
  #include <unistd.h>
+ #include <limits.h> /* INT_MAX */
  #ifndef O_BINARY
  #define O_BINARY 0
  #endif
  #undef _POSIX_SOURCE
! #include <coff.h>

  #define SMALL_EXE_HEADER 0
  #if SMALL_EXE_HEADER
***************
*** 285,290 ****
--- 286,292 ----
    {"insb", ONEBYTE, 0x6c},
    {"insw", ONEBYTE, 0x6d},
    {"insd", TWOBYTE, 0x666d},
+   {"int3", ONEBYTE, 0xcc},
    {"into", ONEBYTE, 0xce},
    {"iret", ONEBYTE, 0xcf},
    {"iretd", TWOBYTE, 0x66cf},
***************
*** 315,320 ****
--- 317,323 ----
    {"repne", ONEBYTE, 0xf2},
    {"repnz", ONEBYTE, 0xf2},
    {"sahf", ONEBYTE, 0x9e},
+   {"salc", ONEBYTE, 0xd6},
    {"scasb", ONEBYTE, 0xae},
    {"scasw", ONEBYTE, 0xaf},
    {"scasd", TWOBYTE, 0x66af},
***************
*** 2334,2339 ****
--- 2337,2350 ----
    int c, c2, i, oldc;
    struct opcode *opp, op;

+
+ #define STRMAX 32
+ #define CHARS "0-9a-fA-FhHxX"
+   char str [STRMAX+1+1],  /* 1 for NUL, 1 for 'h' -> "0x" transformation */
+        str2[STRMAX+1+1];
+   char format[1 + sizeof(INT_MAX) + 1 + sizeof(CHARS) + 1 + 1];
+
+
    do {
      c = fgetc(infile);
    } while (c == ' ' || c == '\t');
***************
*** 2451,2458 ****
  	    }
          }
      #else
        ungetc(c, infile);
!       fscanf(infile, "%i", &(yylval.i));
      #endif
        sprintf(last_token, "%d", yylval.i);
        return NUMBER;
--- 2462,2485 ----
  	    }
          }
      #else
+
        ungetc(c, infile);
!       /* fscanf(infile, "%i", &(yylval.i)); */
!
!
!       sprintf(format, "%%%d[%s]", STRMAX, CHARS);
!       fscanf(infile, format, str);
!       strcpy(str2,str);
!
!       if (str[strlen(str)-1] == 'h' || str[strlen(str)-1] == 'H')
!       {
!         sprintf(str2, "0x%s", str);
!         str2[strlen(str2)-1]='\0';
!       }
!
!       sscanf(str2, "%i", &(yylval.i));
!
!
      #endif
        sprintf(last_token, "%d", yylval.i);
        return NUMBER;

- Raw text -


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