delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/11/11/17:02:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
Date: Wed, 11 Nov 2009 13:50:55 -0800 (PST)
In-Reply-To: <hddtej$g02$1@aioe.org>
X-IP: 65.13.115.246
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>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5)
Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Message-ID: <b7e3b865-abbc-4ee7-a29a-88239153ad80@k17g2000yqh.googlegroups.com>
Subject: Fwd: 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

Hey guys, is this a better place to discuss this (DJASM hacks/
improvements)?


---------- Forwarded message ----------
From: Martin Str|mberg <a DOT  DOT  DOT  AT sister DOT ludd DOT ltu DOT se>
Date: Nov 11, 2:42=A0am
Subject: GAS ".code16" and DJASM quirks ...
To: comp.os.msdos.djgpp


Rugxulo <rugx DOT  DOT  DOT  AT gmail DOT com> wrote:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> *** tony_y.bk1 =A0 =A0 Tue Nov 10 17:37:22 2009
> --- tony.y Tue Nov 10 21:26:58 2009
> ***************
> *** 2335,2340 ****
> --- 2335,2341 ----
> =A0 {
> =A0 =A0 int c, c2, i, oldc;
> =A0 =A0 struct opcode *opp, op;
> + =A0 char str[33], str2[33];

No.

#define MAX 32
#define CHARS "0-9a-fA-FhHxX"
char str[MAX+1+1], ... /* One for nul and one for "h"->"0x"
transformation. */
char format[1+ sizeof("2147483647") /* INT_MAX */ +1+ sizeof(CHARS)
+1+1];
sprintf(format "%%%d[%s]", MAX, CHARS); /* Possibly error handling
here too. */

> ! =A0 =A0 =A0 fscanf(infile, "%[0-9a-fA-FhHxX]",str);

fscanf(infile, format, str);

> !
> ! =A0 =A0 =A0 if (str[strlen(str)-1] =3D=3D 'h' || str[strlen(str)-1] =3D=
=3D 'H')
> ! =A0 =A0 =A0 {
> ! =A0 =A0 =A0 =A0 str[strlen(str)-1]=3D'\0';
> ! =A0 =A0 =A0 =A0 strcpy(str2,"0x");
> ! =A0 =A0 =A0 =A0 strcat(str2,str);

Why not sprintf(str2, "0x%s", str)? /* Again some proper size! */

> ! =A0 =A0 =A0 =A0 strcpy(str,str2);
> ! =A0 =A0 =A0 }
> ! =A0 =A0 =A0 sscanf(str, "%i", &(yylval.i));
> !
> !
> =A0 =A0 =A0 #endif
> =A0 =A0 =A0 =A0 sprintf(last_token, "%d", yylval.i);
> =A0 =A0 =A0 =A0 return NUMBER;
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Thanks!

MartinS

- Raw text -


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