delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/11/10/22:45:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Rugxulo <rugxulo AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GAS ".code16" and DJASM quirks ...
Date: Tue, 10 Nov 2009 19:35:33 -0800 (PST)
Organization: http://groups.google.com
Lines: 74
Message-ID: <ebf65bf7-5445-44cc-a73f-7dd40fbe49d3@v30g2000yqm.googlegroups.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>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1257910533 28942 127.0.0.1 (11 Nov 2009 03:35:33 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Wed, 11 Nov 2009 03:35:33 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: v30g2000yqm.googlegroups.com; posting-host=65.13.115.246;
posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
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)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

On Nov 10, 2:10=A0pm, DJ Delorie <d DOT  DOT  DOT  AT delorie DOT com> wrote:
>
> If you want to continue the fine tradition of making it meet your
> needs, go ahead :-)

Okay, this hack below seems to work (even though I swear I am not a C
programmer):

=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	Tue Nov 10 17:37:22 2009
--- tony.y	Tue Nov 10 21:26:58 2009
***************
*** 2335,2340 ****
--- 2335,2341 ----
  {
    int c, c2, i, oldc;
    struct opcode *opp, op;
+   char str[33], str2[33];

    do {
      c =3D fgetc(infile);
***************
*** 2454,2460 ****
          }
      #else
        ungetc(c, infile);
!       fscanf(infile, "%i", &(yylval.i));
      #endif
        sprintf(last_token, "%d", yylval.i);
        return NUMBER;
--- 2455,2473 ----
          }
      #else
        ungetc(c, infile);
!
!       fscanf(infile, "%[0-9a-fA-FhHxX]",str);
!
!       if (str[strlen(str)-1] =3D=3D 'h' || str[strlen(str)-1] =3D=3D 'H')
!       {
!         str[strlen(str)-1]=3D'\0';
!         strcpy(str2,"0x");
!         strcat(str2,str);
!         strcpy(str,str2);
!       }
!       sscanf(str, "%i", &(yylval.i));
!
!
      #endif
        sprintf(last_token, "%d", yylval.i);
        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

And here's the simplest example (modified HELLO.ASM) although a bigger
example, BEFI.COM using "0x100" or "100h" style both assemble to the
exact same .COM, matching CRC32.

=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
     .type   "com"
     .org    0x100                   ; origin for .COM program

             mov dx, msg             ; point DX to message
             mov ah, 0x9             ; DOS print string function
             int 21h
             mov ax, 4c00h           ; DOS exit with errorlevel
             int 0x21
     msg:
             .db "hello, world\r\n$"
=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

- Raw text -


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