Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"If anything can go wrong, it will." -- Edsel Murphy


devel / alt.lang.asm / Re: MASM/WASM .model

SubjectAuthor
* MASM/WASM .modelRobert Pengelly
`* Re: MASM/WASM .modelAlexei A. Frounze
 `* Re: MASM/WASM .modelRobert Pengelly
  `* Re: MASM/WASM .modelAlexei A. Frounze
   `* Re: MASM/WASM .modelRobert Pengelly
    `* Re: MASM/WASM .modelAlexei A. Frounze
     `* Re: MASM/WASM .modelRobert Pengelly
      `* Re: MASM/WASM .modelAlexei A. Frounze
       `* Re: MASM/WASM .modelRobert Pengelly
        `* Re: MASM/WASM .modelsean
         `* Re: MASM/WASM .modelRobert Pengelly
          `* Re: MASM/WASM .modelsean
           +* Re: MASM/WASM .modelRobert Pengelly
           |+* Re: MASM/WASM .modelAlexei A. Frounze
           ||`* Re: MASM/WASM .modelRobert Pengelly
           || +* Re: MASM/WASM .modelwolfgang kern
           || |`* Re: MASM/WASM .modelRobert Pengelly
           || | `* Re: MASM/WASM .modelsean
           || |  `* Re: MASM/WASM .modelRobert Pengelly
           || |   +- Re: MASM/WASM .modelAlexei A. Frounze
           || |   `- Re: MASM/WASM .modelsean
           || `- Re: MASM/WASM .modelsean
           |`* Re: MASM/WASM .modelFrank Kotler
           | +- Re: MASM/WASM .modelFrank Kotler
           | `* Re: MASM/WASM .modelRobert Pengelly
           |  +* Re: MASM/WASM .modelRobert Pengelly
           |  |`- Re: MASM/WASM .modelFrank Kotler
           |  `* Re: MASM/WASM .modelFrank Kotler
           |   `* Re: MASM/WASM .modelRobert Pengelly
           |    `* Re: MASM/WASM .modelFrank Kotler
           |     `* Re: MASM/WASM .modelRobert Pengelly
           |      +* Re: MASM/WASM .modelRobert Pengelly
           |      |`- Re: MASM/WASM .modelRobert Pengelly
           |      `* Re: MASM/WASM .modelsean
           |       `- Re: MASM/WASM .modelRobert Pengelly
           `- Re: MASM/WASM .modelFrank Kotler

Pages:12
MASM/WASM .model

<49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=290&group=alt.lang.asm#290

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a37:917:0:b0:6b5:b9a4:bdda with SMTP id 23-20020a370917000000b006b5b9a4bddamr11920673qkj.36.1657993484141;
Sat, 16 Jul 2022 10:44:44 -0700 (PDT)
X-Received: by 2002:a0d:d889:0:b0:31d:3b1b:da48 with SMTP id
a131-20020a0dd889000000b0031d3b1bda48mr22096671ywe.244.1657993483745; Sat, 16
Jul 2022 10:44:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 10:44:43 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
Subject: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Sat, 16 Jul 2022 17:44:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1425
 by: Robert Pengelly - Sat, 16 Jul 2022 17:44 UTC

Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use ..model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.

Re: MASM/WASM .model

<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=291&group=alt.lang.asm#291

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a0c:dd11:0:b0:473:34ad:8e06 with SMTP id u17-20020a0cdd11000000b0047334ad8e06mr15841105qvk.4.1657995068421;
Sat, 16 Jul 2022 11:11:08 -0700 (PDT)
X-Received: by 2002:a5b:a4f:0:b0:669:9661:55e4 with SMTP id
z15-20020a5b0a4f000000b00669966155e4mr19050289ybq.466.1657995067560; Sat, 16
Jul 2022 11:11:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 11:11:07 -0700 (PDT)
In-Reply-To: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Sat, 16 Jul 2022 18:11:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1862
 by: Alexei A. Frounze - Sat, 16 Jul 2022 18:11 UTC

On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.

Are you expecting it to forbid additional segments that you may mistakenly define?
Are you getting too many segments when you expect only two?

As usual, what's your code and how do you assemble and link it?
Alex

Re: MASM/WASM .model

<0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=292&group=alt.lang.asm#292

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:620a:31c:b0:6b5:d5a5:687f with SMTP id s28-20020a05620a031c00b006b5d5a5687fmr4192852qkm.375.1657997007416;
Sat, 16 Jul 2022 11:43:27 -0700 (PDT)
X-Received: by 2002:a05:6902:120a:b0:66f:3a6:d07e with SMTP id
s10-20020a056902120a00b0066f03a6d07emr18716985ybu.607.1657997007069; Sat, 16
Jul 2022 11:43:27 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 11:43:26 -0700 (PDT)
In-Reply-To: <84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Sat, 16 Jul 2022 18:43:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 50
 by: Robert Pengelly - Sat, 16 Jul 2022 18:43 UTC

On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> Are you expecting it to forbid additional segments that you may mistakenly define?
> Are you getting too many segments when you expect only two?
>
> As usual, what's your code and how do you assemble and link it?
> Alex
Sorry, I have the following code:

..model small, c
..386p

_DATA segment word public 'DATA'
data1 dw 18h
_DATA ends

_DTEST segment word public 'DATA'
data2 dw 80h
_DTEST ends

_TEXT segment word public 'CODE'

start:

cli
hlt

_TEXT ends

_TTEXT segment word public 'CODE'

test:

cli
hlt

_TTEXT ends

end

If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.

Re: MASM/WASM .model

<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=293&group=alt.lang.asm#293

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a0c:cd0e:0:b0:473:8489:21a6 with SMTP id b14-20020a0ccd0e000000b00473848921a6mr16406746qvm.11.1658007234396;
Sat, 16 Jul 2022 14:33:54 -0700 (PDT)
X-Received: by 2002:a0d:f647:0:b0:31d:17cc:3337 with SMTP id
g68-20020a0df647000000b0031d17cc3337mr22869253ywf.100.1658007234051; Sat, 16
Jul 2022 14:33:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 14:33:53 -0700 (PDT)
In-Reply-To: <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Sat, 16 Jul 2022 21:33:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3388
 by: Alexei A. Frounze - Sat, 16 Jul 2022 21:33 UTC

On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > Are you expecting it to forbid additional segments that you may mistakenly define?
> > Are you getting too many segments when you expect only two?
> >
> > As usual, what's your code and how do you assemble and link it?
> > Alex
> Sorry, I have the following code:
>
> .model small, c
> .386p
>
> _DATA segment word public 'DATA'
> data1 dw 18h
> _DATA ends
>
> _DTEST segment word public 'DATA'
> data2 dw 80h
> _DTEST ends
>
> _TEXT segment word public 'CODE'
>
> start:
>
> cli
> hlt
>
> _TEXT ends
>
> _TTEXT segment word public 'CODE'
>
> test:
>
> cli
> hlt
>
> _TTEXT ends
>
> end
>
> If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.

Then don't define more segments than you need.
(It's a good question of why you may think you need them!)

However, if you still want somewhat (just visually?) separate segments
for e.g. different kinds of data (constants, initialized-to-zero vars,
other initialized vars, etc) which in the end will be part of one 64KB
segment, you may group them. See the group directive.

Also, if you only use the "Simplified segment directives" like .CODE,
..CONST, .DATA, I bet they would be automatically grouped together
as necessary.

Alex

Re: MASM/WASM .model

<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=294&group=alt.lang.asm#294

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:ad4:5c8c:0:b0:473:874c:dd71 with SMTP id o12-20020ad45c8c000000b00473874cdd71mr16777549qvh.3.1658014001215;
Sat, 16 Jul 2022 16:26:41 -0700 (PDT)
X-Received: by 2002:a5b:a4f:0:b0:669:9661:55e4 with SMTP id
z15-20020a5b0a4f000000b00669966155e4mr19970184ybq.466.1658014000920; Sat, 16
Jul 2022 16:26:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 16:26:40 -0700 (PDT)
In-Reply-To: <980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Sat, 16 Jul 2022 23:26:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4074
 by: Robert Pengelly - Sat, 16 Jul 2022 23:26 UTC

On Saturday, 16 July 2022 at 22:33:55 UTC+1, Alexei A. Frounze wrote:
> On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> > On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > > Are you expecting it to forbid additional segments that you may mistakenly define?
> > > Are you getting too many segments when you expect only two?
> > >
> > > As usual, what's your code and how do you assemble and link it?
> > > Alex
> > Sorry, I have the following code:
> >
> > .model small, c
> > .386p
> >
> > _DATA segment word public 'DATA'
> > data1 dw 18h
> > _DATA ends
> >
> > _DTEST segment word public 'DATA'
> > data2 dw 80h
> > _DTEST ends
> >
> > _TEXT segment word public 'CODE'
> >
> > start:
> >
> > cli
> > hlt
> >
> > _TEXT ends
> >
> > _TTEXT segment word public 'CODE'
> >
> > test:
> >
> > cli
> > hlt
> >
> > _TTEXT ends
> >
> > end
> >
> > If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.
> Then don't define more segments than you need.
> (It's a good question of why you may think you need them!)
>
> However, if you still want somewhat (just visually?) separate segments
> for e.g. different kinds of data (constants, initialized-to-zero vars,
> other initialized vars, etc) which in the end will be part of one 64KB
> segment, you may group them. See the group directive.
>
> Also, if you only use the "Simplified segment directives" like .CODE,
> .CONST, .DATA, I bet they would be automatically grouped together
> as necessary.
>
> Alex
It's not a case of whether I define them or not, I'm just trying to understand how MASM (and MASM-compatible assemblers) work and I'm asking what .model actually does/doesn't do as from my understanding it shouldn't compile and display an error instead. If your not going to bother answering the question and instead tell me what I should and shouldn't do then why both even replying.

Re: MASM/WASM .model

<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=295&group=alt.lang.asm#295

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a37:917:0:b0:6b5:b9a4:bdda with SMTP id 23-20020a370917000000b006b5b9a4bddamr12665218qkj.36.1658022574186;
Sat, 16 Jul 2022 18:49:34 -0700 (PDT)
X-Received: by 2002:a81:6104:0:b0:31d:b641:a0ab with SMTP id
v4-20020a816104000000b0031db641a0abmr25163175ywb.459.1658022573931; Sat, 16
Jul 2022 18:49:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 18:49:33 -0700 (PDT)
In-Reply-To: <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Sun, 17 Jul 2022 01:49:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 84
 by: Alexei A. Frounze - Sun, 17 Jul 2022 01:49 UTC

On Saturday, July 16, 2022 at 4:26:41 PM UTC-7, Robert Pengelly wrote:
> On Saturday, 16 July 2022 at 22:33:55 UTC+1, Alexei A. Frounze wrote:
> > On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> > > On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > > > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > > > Are you expecting it to forbid additional segments that you may mistakenly define?
> > > > Are you getting too many segments when you expect only two?
> > > >
> > > > As usual, what's your code and how do you assemble and link it?
> > > > Alex
> > > Sorry, I have the following code:
> > >
> > > .model small, c
> > > .386p
> > >
> > > _DATA segment word public 'DATA'
> > > data1 dw 18h
> > > _DATA ends
> > >
> > > _DTEST segment word public 'DATA'
> > > data2 dw 80h
> > > _DTEST ends
> > >
> > > _TEXT segment word public 'CODE'
> > >
> > > start:
> > >
> > > cli
> > > hlt
> > >
> > > _TEXT ends
> > >
> > > _TTEXT segment word public 'CODE'
> > >
> > > test:
> > >
> > > cli
> > > hlt
> > >
> > > _TTEXT ends
> > >
> > > end
> > >
> > > If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.
> > Then don't define more segments than you need.
> > (It's a good question of why you may think you need them!)
> >
> > However, if you still want somewhat (just visually?) separate segments
> > for e.g. different kinds of data (constants, initialized-to-zero vars,
> > other initialized vars, etc) which in the end will be part of one 64KB
> > segment, you may group them. See the group directive.
> >
> > Also, if you only use the "Simplified segment directives" like .CODE,
> > .CONST, .DATA, I bet they would be automatically grouped together
> > as necessary.
> >
> > Alex
> It's not a case of whether I define them or not, I'm just trying to understand how MASM (and MASM-compatible assemblers) work and I'm asking what .model actually does/doesn't do as from my understanding it shouldn't compile and display an error instead. If your not going to bother answering the question and instead tell me what I should and shouldn't do then why both even replying.

Maybe you should state your problem/task/objective more fully when asking for help with it.
What you just said did not immediately follow from the original post.

Alex

Re: MASM/WASM .model

<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=296&group=alt.lang.asm#296

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:6214:3009:b0:473:990:6d08 with SMTP id ke9-20020a056214300900b0047309906d08mr16788638qvb.121.1658023664924;
Sat, 16 Jul 2022 19:07:44 -0700 (PDT)
X-Received: by 2002:a0d:d889:0:b0:31d:3b1b:da48 with SMTP id
a131-20020a0dd889000000b0031d3b1bda48mr23628690ywe.244.1658023664704; Sat, 16
Jul 2022 19:07:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 19:07:44 -0700 (PDT)
In-Reply-To: <0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Sun, 17 Jul 2022 02:07:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 95
 by: Robert Pengelly - Sun, 17 Jul 2022 02:07 UTC

On Sunday, 17 July 2022 at 02:49:34 UTC+1, Alexei A. Frounze wrote:
> On Saturday, July 16, 2022 at 4:26:41 PM UTC-7, Robert Pengelly wrote:
> > On Saturday, 16 July 2022 at 22:33:55 UTC+1, Alexei A. Frounze wrote:
> > > On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> > > > On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > > > > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > > > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > > > > Are you expecting it to forbid additional segments that you may mistakenly define?
> > > > > Are you getting too many segments when you expect only two?
> > > > >
> > > > > As usual, what's your code and how do you assemble and link it?
> > > > > Alex
> > > > Sorry, I have the following code:
> > > >
> > > > .model small, c
> > > > .386p
> > > >
> > > > _DATA segment word public 'DATA'
> > > > data1 dw 18h
> > > > _DATA ends
> > > >
> > > > _DTEST segment word public 'DATA'
> > > > data2 dw 80h
> > > > _DTEST ends
> > > >
> > > > _TEXT segment word public 'CODE'
> > > >
> > > > start:
> > > >
> > > > cli
> > > > hlt
> > > >
> > > > _TEXT ends
> > > >
> > > > _TTEXT segment word public 'CODE'
> > > >
> > > > test:
> > > >
> > > > cli
> > > > hlt
> > > >
> > > > _TTEXT ends
> > > >
> > > > end
> > > >
> > > > If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.
> > > Then don't define more segments than you need.
> > > (It's a good question of why you may think you need them!)
> > >
> > > However, if you still want somewhat (just visually?) separate segments
> > > for e.g. different kinds of data (constants, initialized-to-zero vars,
> > > other initialized vars, etc) which in the end will be part of one 64KB
> > > segment, you may group them. See the group directive.
> > >
> > > Also, if you only use the "Simplified segment directives" like .CODE,
> > > .CONST, .DATA, I bet they would be automatically grouped together
> > > as necessary.
> > >
> > > Alex
> > It's not a case of whether I define them or not, I'm just trying to understand how MASM (and MASM-compatible assemblers) work and I'm asking what ..model actually does/doesn't do as from my understanding it shouldn't compile and display an error instead. If your not going to bother answering the question and instead tell me what I should and shouldn't do then why both even replying.
> Maybe you should state your problem/task/objective more fully when asking for help with it.
> What you just said did not immediately follow from the original post.
>
> Alex
Actually it does I did ask "Does anyone know what .model actually does in MASM?" and "Have I misunderstood what ".model" does" then you asked for code and I provided it then you tell me what I should and shouldn't be doing. How hard is it to understand that I'm trying to understand how MASM and MASM-compatible assemblers function with regards to .model. I'm under the assumption that if you use .model small, c then the assembler should fail (and before you bitch again like I originally asked) have I misunderstood what ".model" does or is WASM ignoring the .model line. Seriously how hard is it to get a simple answer to a question.

Re: MASM/WASM .model

<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=297&group=alt.lang.asm#297

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:622a:11d2:b0:31e:e3de:2824 with SMTP id n18-20020a05622a11d200b0031ee3de2824mr3975317qtk.625.1658030508169;
Sat, 16 Jul 2022 21:01:48 -0700 (PDT)
X-Received: by 2002:a81:645:0:b0:31c:c8e2:1c5d with SMTP id
66-20020a810645000000b0031cc8e21c5dmr23593848ywg.282.1658030507896; Sat, 16
Jul 2022 21:01:47 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sat, 16 Jul 2022 21:01:47 -0700 (PDT)
In-Reply-To: <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Sun, 17 Jul 2022 04:01:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 142
 by: Alexei A. Frounze - Sun, 17 Jul 2022 04:01 UTC

On Saturday, July 16, 2022 at 7:07:45 PM UTC-7, Robert Pengelly wrote:
> On Sunday, 17 July 2022 at 02:49:34 UTC+1, Alexei A. Frounze wrote:
> > On Saturday, July 16, 2022 at 4:26:41 PM UTC-7, Robert Pengelly wrote:
> > > On Saturday, 16 July 2022 at 22:33:55 UTC+1, Alexei A. Frounze wrote:
> > > > On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> > > > > On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > > > > > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > > > > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > > > > > Are you expecting it to forbid additional segments that you may mistakenly define?
> > > > > > Are you getting too many segments when you expect only two?
> > > > > >
> > > > > > As usual, what's your code and how do you assemble and link it?
> > > > > > Alex
> > > > > Sorry, I have the following code:
> > > > >
> > > > > .model small, c
> > > > > .386p
> > > > >
> > > > > _DATA segment word public 'DATA'
> > > > > data1 dw 18h
> > > > > _DATA ends
> > > > >
> > > > > _DTEST segment word public 'DATA'
> > > > > data2 dw 80h
> > > > > _DTEST ends
> > > > >
> > > > > _TEXT segment word public 'CODE'
> > > > >
> > > > > start:
> > > > >
> > > > > cli
> > > > > hlt
> > > > >
> > > > > _TEXT ends
> > > > >
> > > > > _TTEXT segment word public 'CODE'
> > > > >
> > > > > test:
> > > > >
> > > > > cli
> > > > > hlt
> > > > >
> > > > > _TTEXT ends
> > > > >
> > > > > end
> > > > >
> > > > > If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.
> > > > Then don't define more segments than you need.
> > > > (It's a good question of why you may think you need them!)
> > > >
> > > > However, if you still want somewhat (just visually?) separate segments
> > > > for e.g. different kinds of data (constants, initialized-to-zero vars,
> > > > other initialized vars, etc) which in the end will be part of one 64KB
> > > > segment, you may group them. See the group directive.
> > > >
> > > > Also, if you only use the "Simplified segment directives" like .CODE,
> > > > .CONST, .DATA, I bet they would be automatically grouped together
> > > > as necessary.
> > > >
> > > > Alex
> > > It's not a case of whether I define them or not, I'm just trying to understand how MASM (and MASM-compatible assemblers) work and I'm asking what .model actually does/doesn't do as from my understanding it shouldn't compile and display an error instead. If your not going to bother answering the question and instead tell me what I should and shouldn't do then why both even replying.
> > Maybe you should state your problem/task/objective more fully when asking for help with it.
> > What you just said did not immediately follow from the original post.
> >
> > Alex
> Actually it does I did ask "Does anyone know what .model actually does in MASM?" and "Have I misunderstood what ".model" does" then you asked for code and I provided it then you tell me what I should and shouldn't be doing. How hard is it to understand that I'm trying to understand how MASM and MASM-compatible assemblers function with regards to .model. I'm under the assumption that if you use .model small, c then the assembler should fail (and before you bitch again like I originally asked) have I misunderstood what ".model" does or is WASM ignoring the .model line. Seriously how hard is it to get a simple answer to a question.

It's not a typical question I'd expect without any prior history or larger
context. As it turns out you're not asking about how to use the tool
(which is a more common question), you're asking about how it's
implemented, about its edge cases, you're almost asking how to
reverse engineer or replicate the tool.
This isn't the kind of question I would normally expect.

Further, this may not be implemented equally in similar/compatible
assemblers.

xASM may not be ignoring the .MODEL directive, it just may not be
doing the kind of check you're expecting from it. All it may be doing
in response to .MODEL is generating .CODE, .DATA and other such
special segments into two groups, which will reside in two distinct
64KB segments after linking. And that's it, without imposing any
limitations on any other segments you may throw in.
(and, of course, there's some support for subroutines, argument
passing and such, which is also affected by .MODEL, but we
aren't discussing subroutines here/now)
Your linker may then either fail to link or it just may produce an
executable with all your segments. And there isn't any problem in
DOS .EXEs having several dozens or even a hundred of different
segments (possibly overlapping).

If you want more info, check the official documentation or
find the answer by experimentation. But I'm guessing you already
have your answer. The assembler doesn't limit the number of
your segments. So, if you want to replicate this behavior, do it.
If you still want the check that the assembler isn't doing for you,
you need something else to do it. If you're generating code,
you may check for it on the generator side. If you're writing the
code by hand, either be careful or see if there's anything that
you can use to catch undesired segments. See if there are other
useful directives or options in the assembler or linker. See if you
can just post-process the object file or the map file or even the
executable...

There's no need to be so rude. Explain what you're trying to do.
Do some research yourself. You're not always going to get
everything right away and the way you want it.

Alex

Re: MASM/WASM .model

<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=298&group=alt.lang.asm#298

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:6214:1c4d:b0:473:67a4:14de with SMTP id if13-20020a0562141c4d00b0047367a414demr17839667qvb.69.1658055870548;
Sun, 17 Jul 2022 04:04:30 -0700 (PDT)
X-Received: by 2002:a25:d54:0:b0:670:322d:61c6 with SMTP id
81-20020a250d54000000b00670322d61c6mr1427093ybn.391.1658055870174; Sun, 17
Jul 2022 04:04:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Sun, 17 Jul 2022 04:04:29 -0700 (PDT)
In-Reply-To: <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<84f78dc3-06b0-4764-8250-f4d67b17d024n@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Sun, 17 Jul 2022 11:04:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 165
 by: Robert Pengelly - Sun, 17 Jul 2022 11:04 UTC

On Sunday, 17 July 2022 at 05:01:48 UTC+1, Alexei A. Frounze wrote:
> On Saturday, July 16, 2022 at 7:07:45 PM UTC-7, Robert Pengelly wrote:
> > On Sunday, 17 July 2022 at 02:49:34 UTC+1, Alexei A. Frounze wrote:
> > > On Saturday, July 16, 2022 at 4:26:41 PM UTC-7, Robert Pengelly wrote:
> > > > On Saturday, 16 July 2022 at 22:33:55 UTC+1, Alexei A. Frounze wrote:
> > > > > On Saturday, July 16, 2022 at 11:43:28 AM UTC-7, Robert Pengelly wrote:
> > > > > > On Saturday, 16 July 2022 at 19:11:09 UTC+1, Alexei A. Frounze wrote:
> > > > > > > On Saturday, July 16, 2022 at 10:44:44 AM UTC-7, Robert Pengelly wrote:
> > > > > > > > Does anyone know what .model actually does in MASM? I found http://www.c-jump.com/CIS77/ASM/Directives/lecture.html#D77_0030_models which states "Small model supports one data segment and one code segment." but yet if I use .model small,c with WASM I can still create multiple segments when I use 'CODE' or 'DATA'. Have I misunderstood what ".model" does or is WASM ignoring the .model line.
> > > > > > > Are you expecting it to forbid additional segments that you may mistakenly define?
> > > > > > > Are you getting too many segments when you expect only two?
> > > > > > >
> > > > > > > As usual, what's your code and how do you assemble and link it?
> > > > > > > Alex
> > > > > > Sorry, I have the following code:
> > > > > >
> > > > > > .model small, c
> > > > > > .386p
> > > > > >
> > > > > > _DATA segment word public 'DATA'
> > > > > > data1 dw 18h
> > > > > > _DATA ends
> > > > > >
> > > > > > _DTEST segment word public 'DATA'
> > > > > > data2 dw 80h
> > > > > > _DTEST ends
> > > > > >
> > > > > > _TEXT segment word public 'CODE'
> > > > > >
> > > > > > start:
> > > > > >
> > > > > > cli
> > > > > > hlt
> > > > > >
> > > > > > _TEXT ends
> > > > > >
> > > > > > _TTEXT segment word public 'CODE'
> > > > > >
> > > > > > test:
> > > > > >
> > > > > > cli
> > > > > > hlt
> > > > > >
> > > > > > _TTEXT ends
> > > > > >
> > > > > > end
> > > > > >
> > > > > > If small only supports one code and one data segment then I don't expect the code to assemble using WASM as there's two code and two data segments but yet it does.
> > > > > Then don't define more segments than you need.
> > > > > (It's a good question of why you may think you need them!)
> > > > >
> > > > > However, if you still want somewhat (just visually?) separate segments
> > > > > for e.g. different kinds of data (constants, initialized-to-zero vars,
> > > > > other initialized vars, etc) which in the end will be part of one 64KB
> > > > > segment, you may group them. See the group directive.
> > > > >
> > > > > Also, if you only use the "Simplified segment directives" like .CODE,
> > > > > .CONST, .DATA, I bet they would be automatically grouped together
> > > > > as necessary.
> > > > >
> > > > > Alex
> > > > It's not a case of whether I define them or not, I'm just trying to understand how MASM (and MASM-compatible assemblers) work and I'm asking what .model actually does/doesn't do as from my understanding it shouldn't compile and display an error instead. If your not going to bother answering the question and instead tell me what I should and shouldn't do then why both even replying.
> > > Maybe you should state your problem/task/objective more fully when asking for help with it.
> > > What you just said did not immediately follow from the original post.
> > >
> > > Alex
> > Actually it does I did ask "Does anyone know what .model actually does in MASM?" and "Have I misunderstood what ".model" does" then you asked for code and I provided it then you tell me what I should and shouldn't be doing. How hard is it to understand that I'm trying to understand how MASM and MASM-compatible assemblers function with regards to .model. I'm under the assumption that if you use .model small, c then the assembler should fail (and before you bitch again like I originally asked) have I misunderstood what ".model" does or is WASM ignoring the .model line. Seriously how hard is it to get a simple answer to a question.
> It's not a typical question I'd expect without any prior history or larger
> context. As it turns out you're not asking about how to use the tool
> (which is a more common question), you're asking about how it's
> implemented, about its edge cases, you're almost asking how to
> reverse engineer or replicate the tool.
> This isn't the kind of question I would normally expect.
>
> Further, this may not be implemented equally in similar/compatible
> assemblers.
>
> xASM may not be ignoring the .MODEL directive, it just may not be
> doing the kind of check you're expecting from it. All it may be doing
> in response to .MODEL is generating .CODE, .DATA and other such
> special segments into two groups, which will reside in two distinct
> 64KB segments after linking. And that's it, without imposing any
> limitations on any other segments you may throw in.
> (and, of course, there's some support for subroutines, argument
> passing and such, which is also affected by .MODEL, but we
> aren't discussing subroutines here/now)
> Your linker may then either fail to link or it just may produce an
> executable with all your segments. And there isn't any problem in
> DOS .EXEs having several dozens or even a hundred of different
> segments (possibly overlapping).
>
> If you want more info, check the official documentation or
> find the answer by experimentation. But I'm guessing you already
> have your answer. The assembler doesn't limit the number of
> your segments. So, if you want to replicate this behavior, do it.
> If you still want the check that the assembler isn't doing for you,
> you need something else to do it. If you're generating code,
> you may check for it on the generator side. If you're writing the
> code by hand, either be careful or see if there's anything that
> you can use to catch undesired segments. See if there are other
> useful directives or options in the assembler or linker. See if you
> can just post-process the object file or the map file or even the
> executable...
>
> There's no need to be so rude. Explain what you're trying to do.
> Do some research yourself. You're not always going to get
> everything right away and the way you want it.
>
> Alex
I weren't being rude (not intentionally any) I just got a little annoyed by you telling me "Then don't define more segments than you need." and then "What you just said did not immediately follow from the original post. " plus it was late and I couldn't sleep due to the heat, I have a very short fuse and I tend to lash out easily and I'm sorry for that but now I have a clear head. I've tried doing research when it come to wasm but I can't seem to find anything about it from google and other search engines (some examples are https://www.google.co.uk/search?q=wasm+model give me results about webassembly whatever that is). Other than trying to understand the source code (which I have tried and failed at multiple times) I have no idea what should and shouldn't happen. For larger context, I'm a developer and I'm fascinated by assemblers at the moment and I'm trying to understand how they work from a developer perspective (how they work, how they could be implemented, etc) by using existing ones and examining the output. Microsoft's documentation about MASM directives I kind of useless as well, take https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-model?view=msvc-170 it tells you about the directive, the arguments and model types but doesn't tell what the types actually do. I've also looked a JWasm to try and understand it (source code is a bit earlier to go through) but it doesn't support ".model" it does support "-ms" as a command line option but couldn't really find where it was effecting the code. Is that better or do you need more.


Click here to read the complete article
Re: MASM/WASM .model

<tb2q04$5fgk$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=299&group=alt.lang.asm#299

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sea...@conman.org
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Mon, 18 Jul 2022 05:10:29 -0000 (UTC)
Organization: Conman Laboratories
Lines: 86
Sender: Sean Conner <spc@lucy.roswell.conman.org>
Message-ID: <tb2q04$5fgk$1@dont-email.me>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com> <980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com> <0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com> <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
Reply-To: sean@conman.org
Injection-Date: Mon, 18 Jul 2022 05:10:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="354306c5ac57d184ce863016351d0d6a";
logging-data="179732"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gPND3AOQlaAdD2lugY4I7"
User-Agent: tin/2.4.0-20160823 ("Octomore") (UNIX) (Linux/2.6.9-100.EL.plus.c4smp (i686))
Cancel-Lock: sha1:KnCM0w65eXWxUfPAmlQbpAS0TR4=
 by: sea...@conman.org - Mon, 18 Jul 2022 05:10 UTC

It was thus said that the Great Robert Pengelly <robertapengelly@gmail.com> once stated:
>
> I weren't being rude (not intentionally any) I just got a little annoyed
> by you telling me "Then don't define more segments than you need." and
> then "What you just said did not immediately follow from the original
> post. " plus it was late and I couldn't sleep due to the heat, I have a
> very short fuse and I tend to lash out easily and I'm sorry for that but
> now I have a clear head. I've tried doing research when it come to wasm
> but I can't seem to find anything about it from google and other search
> engines (some examples are https://www.google.co.uk/search?q=wasm+model
> give me results about webassembly whatever that is). Other than trying to
> understand the source code (which I have tried and failed at multiple
> times) I have no idea what should and shouldn't happen. For larger
> context, I'm a developer and I'm fascinated by assemblers at the moment
> and I'm trying to understand how they work from a developer perspective
> (how they work, how they could be implemented, etc) by using existing ones
> and examining the output. Microsoft's documentation about MASM directives
> I kind of useless as well, take
> https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-model?view=msvc-170
> it tells you about the directive, the arguments and model types but
> doesn't tell what the types actually do. I've also looked a JWasm to try
> and understand it (source code is a bit earlier to go through) but it
> doesn't support ".model" it does support "-ms" as a command line option
> but couldn't really find where it was effecting the code. Is that better
> or do you need more.

The "model" directive is more for interfacing with higher level languages
like C or Pascal and dictate how the code is laid out for real mode x86
developement. It's been years since I had to deal with this, but I do
recall a few details. What I recall are: this assume an x86 in real mode
with each segment being limited to 64K in size, with the models being
defined as:

tiny
This model all the code (CS), data (DS) and stack (SS) reside in a
single segment of memory. So CS=DS=SS.

small
This model the code is in a separate segment, and the data (DS) and
stack (CS) are in a separate segment. So CS by itself, and DS=SS

medium
I don't recall the specifics

compact
I don't recall the specifics

large
I don't recall the specifics

huge
You can have multiple code segments, data segments and stack
segments---in other words, you can have more than 64k of code, more
than 64k of data and mroe than 64k of stack.

flat
New to me actually (from the link you provided), but from context, I
think it means using the 80386 protected mode [1] with a single 4G
segment (flat mode)---i.e. CS=DS=SS (this is a very simplified view
of what is actually going on).

I do know there exists a model where you are limited to one code segment
of 64k (max length), one data segment, and one stack segment, but I don't
recall which model that is. The other ones are variations (>64k code, 64k
of data+stack, 64k code, 64k data, 64k stack, etc.).

All of this is very particular to MS-DOS and real mode programming on the
x86 line. These days you can ignore all this since it's not really relevant
anymore (unless you are maintaining legacy code for MS-DOS systems).

Personally, I no longer use MASM (last time I used it was in the mid-90s).
These days, if I am doing x86 programming, it's on Unix systems (like Linux
or Mac OS-X) with nasm, where one does not have to deal with segments at
all (it's all flat).

Assemblers are like any other compiler---they accept source code and
generate object files or executable files (depending upon assembler,
options, platform, etc.) and they can be implemented in any language (I've
used assemblers written in assembly, C, Perl and Lua). There's nothing
really magical about them, and in some ways, they are easier to implement
than a compiler.

-spc

[1] This can be done in real mode, by the way, but I don't recall the
exact details in setting this up.

Re: MASM/WASM .model

<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=300&group=alt.lang.asm#300

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:620a:4004:b0:6af:3e30:f5d3 with SMTP id h4-20020a05620a400400b006af3e30f5d3mr16531578qko.57.1658131527343;
Mon, 18 Jul 2022 01:05:27 -0700 (PDT)
X-Received: by 2002:a0d:f647:0:b0:31d:17cc:3337 with SMTP id
g68-20020a0df647000000b0031d17cc3337mr28665172ywf.100.1658131527038; Mon, 18
Jul 2022 01:05:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Mon, 18 Jul 2022 01:05:26 -0700 (PDT)
In-Reply-To: <tb2q04$5fgk$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<0e81e9a4-82a3-4453-846c-96c4dd7b96f8n@googlegroups.com> <980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com> <0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com> <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Mon, 18 Jul 2022 08:05:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 131
 by: Robert Pengelly - Mon, 18 Jul 2022 08:05 UTC

On Monday, 18 July 2022 at 06:10:30 UTC+1, se...@conman.org wrote:
> It was thus said that the Great Robert Pengelly <roberta...@gmail.com> once stated:
> >
> > I weren't being rude (not intentionally any) I just got a little annoyed
> > by you telling me "Then don't define more segments than you need." and
> > then "What you just said did not immediately follow from the original
> > post. " plus it was late and I couldn't sleep due to the heat, I have a
> > very short fuse and I tend to lash out easily and I'm sorry for that but
> > now I have a clear head. I've tried doing research when it come to wasm
> > but I can't seem to find anything about it from google and other search
> > engines (some examples are https://www.google.co.uk/search?q=wasm+model
> > give me results about webassembly whatever that is). Other than trying to
> > understand the source code (which I have tried and failed at multiple
> > times) I have no idea what should and shouldn't happen. For larger
> > context, I'm a developer and I'm fascinated by assemblers at the moment
> > and I'm trying to understand how they work from a developer perspective
> > (how they work, how they could be implemented, etc) by using existing ones
> > and examining the output. Microsoft's documentation about MASM directives
> > I kind of useless as well, take
> > https://docs.microsoft.com/en-us/cpp/assembler/masm/dot-model?view=msvc-170
> > it tells you about the directive, the arguments and model types but
> > doesn't tell what the types actually do. I've also looked a JWasm to try
> > and understand it (source code is a bit earlier to go through) but it
> > doesn't support ".model" it does support "-ms" as a command line option
> > but couldn't really find where it was effecting the code. Is that better
> > or do you need more.
> The "model" directive is more for interfacing with higher level languages
> like C or Pascal and dictate how the code is laid out for real mode x86
> developement. It's been years since I had to deal with this, but I do
> recall a few details. What I recall are: this assume an x86 in real mode
> with each segment being limited to 64K in size, with the models being
> defined as:
>
> tiny
> This model all the code (CS), data (DS) and stack (SS) reside in a
> single segment of memory. So CS=DS=SS.
>
> small
> This model the code is in a separate segment, and the data (DS) and
> stack (CS) are in a separate segment. So CS by itself, and DS=SS
>
> medium
> I don't recall the specifics
>
> compact
> I don't recall the specifics
>
> large
> I don't recall the specifics
>
> huge
> You can have multiple code segments, data segments and stack
> segments---in other words, you can have more than 64k of code, more
> than 64k of data and mroe than 64k of stack.
>
> flat
> New to me actually (from the link you provided), but from context, I
> think it means using the 80386 protected mode [1] with a single 4G
> segment (flat mode)---i.e. CS=DS=SS (this is a very simplified view
> of what is actually going on).
>
> I do know there exists a model where you are limited to one code segment
> of 64k (max length), one data segment, and one stack segment, but I don't
> recall which model that is. The other ones are variations (>64k code, 64k
> of data+stack, 64k code, 64k data, 64k stack, etc.).
>
> All of this is very particular to MS-DOS and real mode programming on the
> x86 line. These days you can ignore all this since it's not really relevant
> anymore (unless you are maintaining legacy code for MS-DOS systems).
>
> Personally, I no longer use MASM (last time I used it was in the mid-90s)..
> These days, if I am doing x86 programming, it's on Unix systems (like Linux
> or Mac OS-X) with nasm, where one does not have to deal with segments at
> all (it's all flat).
>
> Assemblers are like any other compiler---they accept source code and
> generate object files or executable files (depending upon assembler,
> options, platform, etc.) and they can be implemented in any language (I've
> used assemblers written in assembly, C, Perl and Lua). There's nothing
> really magical about them, and in some ways, they are easier to implement
> than a compiler.
>
> -spc
>
> [1] This can be done in real mode, by the way, but I don't recall the
> exact details in setting this up.
Thanks for that very detailed response, when you say "The "model" directive is more for interfacing with higher level languages
like C or Pascal" does that mean that the assembly source doesn't really get effected by it? Also from what you wrote about the models I'm assuming that '.model' doesn't effect the number of 'CODE' and 'DATA' segments within the source file it just effects the output and will merge the segments together later or am I wrong with that assumption? Only recently I've looked at MASM (or rather WASM), I used to use NASM before I helped create an assembler based on GAS although I don't really like att syntax and it's annoying putting .intel_syntax noprefix at the top of every file so I'm going to fork it and use just intel syntax but I'm trying to decide on whether it will be worth making it somewhat MASM compatible.

Re: MASM/WASM .model

<tb4nrm$kfv2$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=302&group=alt.lang.asm#302

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sea...@conman.org
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Mon, 18 Jul 2022 22:46:15 -0000 (UTC)
Organization: Conman Laboratories
Lines: 33
Sender: Sean Conner <spc@lucy.roswell.conman.org>
Message-ID: <tb4nrm$kfv2$1@dont-email.me>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com> <0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com> <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
Reply-To: sean@conman.org
Injection-Date: Mon, 18 Jul 2022 22:46:15 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="c9500188f58492563c06dd0253a7e435";
logging-data="671714"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SlqmPmq+ppLrGjzDh+dLS"
User-Agent: tin/2.4.0-20160823 ("Octomore") (UNIX) (Linux/2.6.9-100.EL.plus.c4smp (i686))
Cancel-Lock: sha1:FaV/lW5aGEBdDJS8sQUbwTvfRBw=
 by: sea...@conman.org - Mon, 18 Jul 2022 22:46 UTC

It was thus said that the Great Robert Pengelly <robertapengelly@gmail.com> once stated:

> Thanks for that very detailed response, when you say "The "model"
> directive is more for interfacing with higher level languages like C or
> Pascal" does that mean that the assembly source doesn't really get
> effected by it?

I don't know. All my work under MS-DOS was with assembly only, so I was
never really affected by all this. I do know that some compilers for MS-DOS
have switches to select the model, but that's generally used to get around
the 64K segment limit.

> Also from what you wrote about the models I'm assuming
> that '.model' doesn't effect the number of 'CODE' and 'DATA' segments
> within the source file it just effects the output and will merge the
> segments together later or am I wrong with that assumption?

Again, I'm not sure. That would be a valid interpretation to me, but it
could be completely wrong.

> Only recently
> I've looked at MASM (or rather WASM), I used to use NASM before I helped
> create an assembler based on GAS although I don't really like att syntax
> and it's annoying putting .intel_syntax noprefix at the top of every file
> so I'm going to fork it and use just intel syntax but I'm trying to decide
> on whether it will be worth making it somewhat MASM compatible.

Why not use nasm? I've found it very close to MASM but then again, I
don't have a lot of MASM code to convert (all my MASM stuff was 16-bit x86
code, which I don't use much of these days).

-spc

Re: MASM/WASM .model

<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=303&group=alt.lang.asm#303

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:6214:246f:b0:473:5145:d906 with SMTP id im15-20020a056214246f00b004735145d906mr23799629qvb.126.1658207286803;
Mon, 18 Jul 2022 22:08:06 -0700 (PDT)
X-Received: by 2002:a5b:cd1:0:b0:66f:ad59:be9d with SMTP id
e17-20020a5b0cd1000000b0066fad59be9dmr27986487ybr.308.1658207286519; Mon, 18
Jul 2022 22:08:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Mon, 18 Jul 2022 22:08:06 -0700 (PDT)
In-Reply-To: <tb4nrm$kfv2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Tue, 19 Jul 2022 05:08:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4324
 by: Robert Pengelly - Tue, 19 Jul 2022 05:08 UTC

On Monday, 18 July 2022 at 23:46:16 UTC+1, se...@conman.org wrote:
> It was thus said that the Great Robert Pengelly <roberta...@gmail.com> once stated:
> > Thanks for that very detailed response, when you say "The "model"
> > directive is more for interfacing with higher level languages like C or
> > Pascal" does that mean that the assembly source doesn't really get
> > effected by it?
> I don't know. All my work under MS-DOS was with assembly only, so I was
> never really affected by all this. I do know that some compilers for MS-DOS
> have switches to select the model, but that's generally used to get around
> the 64K segment limit.
> > Also from what you wrote about the models I'm assuming
> > that '.model' doesn't effect the number of 'CODE' and 'DATA' segments
> > within the source file it just effects the output and will merge the
> > segments together later or am I wrong with that assumption?
> Again, I'm not sure. That would be a valid interpretation to me, but it
> could be completely wrong.
> > Only recently
> > I've looked at MASM (or rather WASM), I used to use NASM before I helped
> > create an assembler based on GAS although I don't really like att syntax
> > and it's annoying putting .intel_syntax noprefix at the top of every file
> > so I'm going to fork it and use just intel syntax but I'm trying to decide
> > on whether it will be worth making it somewhat MASM compatible.
> Why not use nasm? I've found it very close to MASM but then again, I
> don't have a lot of MASM code to convert (all my MASM stuff was 16-bit x86
> code, which I don't use much of these days).
>
> -spc
I used to use NASM but it has limitations. One example would be that it only allows one file to be assembled at a time and another example would be far jumps, using nasm -f coff test.asm -o test.o I get "error: COFF format does not support non-32-bit relocations" and using nasm -f bin test.asm -o test.bin I get "error: binary output format does not support segment base references" so I don't know how to far jump with NASM. I've also used GAS but you can't assemble for 8086, there is the ia16-elf fork but that also has limitations and it's only available on ubuntu, I assume compiling it from source would make it available on other systems but when you jump between systems that becomes awkward and time consuming not to mention there's no way to get it on Windows. What ever the developers are doing to WASM very often makes the build fail on Linux so I end up using a VM to test things out with it. It's just easier to create one.

Re: MASM/WASM .model

<c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=304&group=alt.lang.asm#304

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:622a:248:b0:31e:ec07:7c28 with SMTP id c8-20020a05622a024800b0031eec077c28mr7242100qtx.595.1658208640771;
Mon, 18 Jul 2022 22:30:40 -0700 (PDT)
X-Received: by 2002:a05:690c:90:b0:2f1:9b7a:ceec with SMTP id
be16-20020a05690c009000b002f19b7aceecmr33768700ywb.308.1658208640515; Mon, 18
Jul 2022 22:30:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Mon, 18 Jul 2022 22:30:40 -0700 (PDT)
In-Reply-To: <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Tue, 19 Jul 2022 05:30:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4170
 by: Alexei A. Frounze - Tue, 19 Jul 2022 05:30 UTC

On Monday, July 18, 2022 at 10:08:07 PM UTC-7, Robert Pengelly wrote:
> I used to use NASM but it has limitations. One example would be that it only allows one file to be assembled at a time

A minor problem. You can have your ASM files %include "somefile.asm"
with NASM.

> and another example would be far jumps, using nasm -f coff test.asm -o test.o I get "error: COFF format does not support non-32-bit relocations"

AFAIR, -f obj would be the proper option to generate object files with
16-bit segmented code. Then you'd need to link the object file(s) with
say Turbo/Borland linker, TLINK, that comes with some old Pascal and
C/C++ compilers for DOS. MASM's LINK and WASM's WLINK might
work too, but I haven't tried doing that in a long time.

> and using nasm -f bin test.asm -o test.bin I get "error: binary output format does not support segment base references" so I don't know how to far jump with NASM.

If you don't use instructions that require unsupported relocations,
you can do far jumps just fine. Except, maybe it won't be a very
meaningful thing to try to do on a 32-bit OS like Windows and Linux.

You could always push the 16-bit segment and then the 16-bit offset
and then do RETF to perform a far jump in 16-bit mode.

The segmentation problems you're talking about are an indicator of
lack of knowledge of the x86 architecture and/or tools. There are ways
to do unconventional things like mixing 16-bit and 32-bit code in the
same executable, like using segmentation in object/executable file
formats that don't seemingly allow it, like generating non-trivial
binaries with NASM without using a linker or any other similar tool.
It does take time to learn and try and come up with working solutions.
It can be frustrating in the beginning when the tools don't do what
you want right away.

> I've also used GAS but you can't assemble for 8086, there is the ia16-elf fork but that also has limitations and it's only available on ubuntu, I assume compiling it from source would make it available on other systems but when you jump between systems that becomes awkward and time consuming not to mention there's no way to get it on Windows. What ever the developers are doing to WASM very often makes the build fail on Linux so I end up using a VM to test things out with it. It's just easier to create one.

I'm just using NASM for my stuff. DOS, Windows, Linux, MacOS, doesn't
matter.

Alex

Re: MASM/WASM .model

<97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=305&group=alt.lang.asm#305

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a37:de07:0:b0:6b5:56d1:140f with SMTP id h7-20020a37de07000000b006b556d1140fmr19437599qkj.114.1658210876901;
Mon, 18 Jul 2022 23:07:56 -0700 (PDT)
X-Received: by 2002:a05:6902:124d:b0:66d:5ce6:5924 with SMTP id
t13-20020a056902124d00b0066d5ce65924mr31463802ybu.320.1658210876658; Mon, 18
Jul 2022 23:07:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Mon, 18 Jul 2022 23:07:56 -0700 (PDT)
In-Reply-To: <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
<c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Tue, 19 Jul 2022 06:07:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5026
 by: Robert Pengelly - Tue, 19 Jul 2022 06:07 UTC

On Tuesday, 19 July 2022 at 06:30:41 UTC+1, Alexei A. Frounze wrote:
> On Monday, July 18, 2022 at 10:08:07 PM UTC-7, Robert Pengelly wrote:
> > I used to use NASM but it has limitations. One example would be that it only allows one file to be assembled at a time
> A minor problem. You can have your ASM files %include "somefile.asm"
> with NASM.
> > and another example would be far jumps, using nasm -f coff test.asm -o test.o I get "error: COFF format does not support non-32-bit relocations"
> AFAIR, -f obj would be the proper option to generate object files with
> 16-bit segmented code. Then you'd need to link the object file(s) with
> say Turbo/Borland linker, TLINK, that comes with some old Pascal and
> C/C++ compilers for DOS. MASM's LINK and WASM's WLINK might
> work too, but I haven't tried doing that in a long time.
> > and using nasm -f bin test.asm -o test.bin I get "error: binary output format does not support segment base references" so I don't know how to far jump with NASM.
> If you don't use instructions that require unsupported relocations,
> you can do far jumps just fine. Except, maybe it won't be a very
> meaningful thing to try to do on a 32-bit OS like Windows and Linux.
>
> You could always push the 16-bit segment and then the 16-bit offset
> and then do RETF to perform a far jump in 16-bit mode.
>
> The segmentation problems you're talking about are an indicator of
> lack of knowledge of the x86 architecture and/or tools. There are ways
> to do unconventional things like mixing 16-bit and 32-bit code in the
> same executable, like using segmentation in object/executable file
> formats that don't seemingly allow it, like generating non-trivial
> binaries with NASM without using a linker or any other similar tool.
> It does take time to learn and try and come up with working solutions.
> It can be frustrating in the beginning when the tools don't do what
> you want right away.
> > I've also used GAS but you can't assemble for 8086, there is the ia16-elf fork but that also has limitations and it's only available on ubuntu, I assume compiling it from source would make it available on other systems but when you jump between systems that becomes awkward and time consuming not to mention there's no way to get it on Windows. What ever the developers are doing to WASM very often makes the build fail on Linux so I end up using a VM to test things out with it. It's just easier to create one.
> I'm just using NASM for my stuff. DOS, Windows, Linux, MacOS, doesn't
> matter.
>
> Alex
I know nasm has the %include option I just saying that only being able to assemble one file at a time is a limitation. as for .obj files only open watcom v2 in avaiable on Linux (when I can actually get it to compile). As for the far jump, sorry I weren't specific, I know you can push values to the stack then retf, what I mean was say I have:

section .data
roffs: dd some_offset
rseg: dw some_segment

section .text
jump:
jmp far roffs

I get the segmentation errors. Don't get me wrong NASM is a great tool it just has limitations that you got to find workarounds for.

Re: MASM/WASM .model

<tb6nua$9id$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=306&group=alt.lang.asm#306

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!aioe.org!OiZNWXZEPhm9mRvfM6bAfg.user.46.165.242.75.POSTED!not-for-mail
From: nowh...@nevernet.at (wolfgang kern)
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 18:59:53 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tb6nua$9id$1@gioia.aioe.org>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me>
<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
<c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
<97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="9805"; posting-host="OiZNWXZEPhm9mRvfM6bAfg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: wolfgang kern - Tue, 19 Jul 2022 16:59 UTC

On 19/07/2022 08:07, Robert Pengelly wrote:
.....
> section .data
> roffs: dd some_offset
> rseg: dw some_segment
>
> section .text
> jump:
> jmp far roffs

> I get the segmentation errors. Don't get me wrong NASM is a great tool it just has limitations that you got to find workarounds for.

perhaps you want to jump to the memory contents of roffs ?
shouldn't offset be 16bit (dw) ?
jmp far [ds: roffs] ;the ds may be not required.
__
wolfgang

Re: MASM/WASM .model

<b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=307&group=alt.lang.asm#307

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:620a:2890:b0:6b2:7363:1472 with SMTP id j16-20020a05620a289000b006b273631472mr23346548qkp.697.1658272927990;
Tue, 19 Jul 2022 16:22:07 -0700 (PDT)
X-Received: by 2002:a25:7bc5:0:b0:66f:d1:1ad with SMTP id w188-20020a257bc5000000b0066f00d101admr35380292ybc.538.1658272927763;
Tue, 19 Jul 2022 16:22:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Tue, 19 Jul 2022 16:22:07 -0700 (PDT)
In-Reply-To: <tb6nua$9id$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com> <8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com> <5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
<c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com> <97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com>
<tb6nua$9id$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Tue, 19 Jul 2022 23:22:07 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2550
 by: Robert Pengelly - Tue, 19 Jul 2022 23:22 UTC

On Tuesday, 19 July 2022 at 17:59:59 UTC+1, wolfgang kern wrote:
> On 19/07/2022 08:07, Robert Pengelly wrote:
> ....
> > section .data
> > roffs: dd some_offset
> > rseg: dw some_segment
> >
> > section .text
> > jump:
> > jmp far roffs
>
> > I get the segmentation errors. Don't get me wrong NASM is a great tool it just has limitations that you got to find workarounds for.
> perhaps you want to jump to the memory contents of roffs ?
> shouldn't offset be 16bit (dw) ?
> jmp far [ds: roffs] ;the ds may be not required.
> __
> wolfgang
I don't think the roffs should be 16bit, from what I've read a far jump is a jump to a 16bit segment and 32bit offset. I'm assuming that jmp far roffs in NASM should be the equivalent to jmp fword ptr roffs in MASM.

Re: MASM/WASM .model

<tb7f68$17i3a$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=308&group=alt.lang.asm#308

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sea...@conman.org
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 23:36:40 -0000 (UTC)
Organization: Conman Laboratories
Lines: 13
Sender: Sean Conner <spc@lucy.roswell.conman.org>
Message-ID: <tb7f68$17i3a$1@dont-email.me>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com> <tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com> <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com> <97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com>
Reply-To: sean@conman.org
Injection-Date: Tue, 19 Jul 2022 23:36:40 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="27a4d59c8a57a6c26ef3c56519d39187";
logging-data="1296490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19D70LWRfj12roYwi94Pugv"
User-Agent: tin/2.4.0-20160823 ("Octomore") (UNIX) (Linux/2.6.9-100.EL.plus.c4smp (i686))
Cancel-Lock: sha1:vJ4SnvOd2oy6oz2y79ewy8xLetY=
 by: sea...@conman.org - Tue, 19 Jul 2022 23:36 UTC

It was thus said that the Great Robert Pengelly <robertapengelly@gmail.com> once stated:
>
> I know nasm has the %include option I just saying that only being able to
> assemble one file at a time is a limitation. as for .obj files only open
> watcom v2 in avaiable on Linux (when I can actually get it to compile).

Are you trying to generate executables for MS-DOS? Because that's the
only operating system where all of this really applies. Anything using the
x86 architecture today basically ignore the segment registers and operate in
a flat mode.

-spc

Re: MASM/WASM .model

<tb7fhn$17i3a$2@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=309&group=alt.lang.asm#309

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sea...@conman.org
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 23:42:47 -0000 (UTC)
Organization: Conman Laboratories
Lines: 28
Sender: Sean Conner <spc@lucy.roswell.conman.org>
Message-ID: <tb7fhn$17i3a$2@dont-email.me>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com> <tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com> <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com> <97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com> <tb6nua$9id$1@gioia.aioe.org> <b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com>
Reply-To: sean@conman.org
Injection-Date: Tue, 19 Jul 2022 23:42:47 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="27a4d59c8a57a6c26ef3c56519d39187";
logging-data="1296490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zVCIYi7QZJ3Knw21Fymdv"
User-Agent: tin/2.4.0-20160823 ("Octomore") (UNIX) (Linux/2.6.9-100.EL.plus.c4smp (i686))
Cancel-Lock: sha1:r3MxuDDaJMP7w6D1SKFKP1wvTO8=
 by: sea...@conman.org - Tue, 19 Jul 2022 23:42 UTC

It was thus said that the Great Robert Pengelly <robertapengelly@gmail.com> once stated:
> On Tuesday, 19 July 2022 at 17:59:59 UTC+1, wolfgang kern wrote:
>> On 19/07/2022 08:07, Robert Pengelly wrote:
>>
>> > I get the segmentation errors. Don't get me wrong NASM is a great tool
>> > it just has limitations that you got to find workarounds for.
>>
>> perhaps you want to jump to the memory contents of roffs ?
>> shouldn't offset be 16bit (dw) ?
>> jmp far [ds: roffs] ;the ds may be not required.

> I don't think the roffs should be 16bit, from what I've read a far jump is
> a jump to a 16bit segment and 32bit offset. I'm assuming that jmp far
> roffs in NASM should be the equivalent to jmp fword ptr roffs in MASM.

It depends upon how the CPU is running. In real mode, it's a 16-bit
segment, with a 16-bit offset. In protected mode in a 16-bit segment, it's
still a 16-bit selector (NOT a segment) with a 16-bit offset, and if the
target is a 32-bit segment, a 16-bit selector with a 32-bit offset. 64-bit
mode doesn't use segements for the most part.

Unless you are trying to write code for MS-DOS, there's no need to deal
with segments or far calls at all. There's over 40 years of historical
bagage to the Intel x86 line.

-spc

Re: MASM/WASM .model

<7a24d19e-782b-4e63-9bef-91d7634f61f6n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=310&group=alt.lang.asm#310

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:6214:c8a:b0:473:26f:59e0 with SMTP id r10-20020a0562140c8a00b00473026f59e0mr27285878qvr.63.1658277604337;
Tue, 19 Jul 2022 17:40:04 -0700 (PDT)
X-Received: by 2002:a81:645:0:b0:31c:c8e2:1c5d with SMTP id
66-20020a810645000000b0031cc8e21c5dmr38274108ywg.282.1658277604075; Tue, 19
Jul 2022 17:40:04 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Tue, 19 Jul 2022 17:40:03 -0700 (PDT)
In-Reply-To: <tb7fhn$17i3a$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=51.9.176.194; posting-account=8PoR_AoAAACGGSg3xbkDgqdI88QVi-yY
NNTP-Posting-Host: 51.9.176.194
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com> <tb4nrm$kfv2$1@dont-email.me>
<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com> <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
<97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com> <tb6nua$9id$1@gioia.aioe.org>
<b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com> <tb7fhn$17i3a$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7a24d19e-782b-4e63-9bef-91d7634f61f6n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: robertap...@gmail.com (Robert Pengelly)
Injection-Date: Wed, 20 Jul 2022 00:40:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3456
 by: Robert Pengelly - Wed, 20 Jul 2022 00:40 UTC

On Wednesday, 20 July 2022 at 00:42:49 UTC+1, se...@conman.org wrote:
> It was thus said that the Great Robert Pengelly <roberta...@gmail.com> once stated:
> > On Tuesday, 19 July 2022 at 17:59:59 UTC+1, wolfgang kern wrote:
> >> On 19/07/2022 08:07, Robert Pengelly wrote:
> >>
> >> > I get the segmentation errors. Don't get me wrong NASM is a great tool
> >> > it just has limitations that you got to find workarounds for.
> >>
> >> perhaps you want to jump to the memory contents of roffs ?
> >> shouldn't offset be 16bit (dw) ?
> >> jmp far [ds: roffs] ;the ds may be not required.
> > I don't think the roffs should be 16bit, from what I've read a far jump is
> > a jump to a 16bit segment and 32bit offset. I'm assuming that jmp far
> > roffs in NASM should be the equivalent to jmp fword ptr roffs in MASM.
> It depends upon how the CPU is running. In real mode, it's a 16-bit
> segment, with a 16-bit offset. In protected mode in a 16-bit segment, it's
> still a 16-bit selector (NOT a segment) with a 16-bit offset, and if the
> target is a 32-bit segment, a 16-bit selector with a 32-bit offset. 64-bit
> mode doesn't use segements for the most part.
>
> Unless you are trying to write code for MS-DOS, there's no need to deal
> with segments or far calls at all. There's over 40 years of historical
> bagage to the Intel x86 line.
>
> -spc
There's a need for far calls and segments when dealing with boot loaders as they tend to switch between real mode and protected mode. Where there are need though is sort of irrelevant, as regardless of the reasons they are used other than targeting omf objects there doesn't appear to be a way to do 16-bit selector and 32-bit offset using NASM as I keep getting the errors.

Re: MASM/WASM .model

<57042bbb-b567-42b4-82cb-4605e7ecefb1n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=311&group=alt.lang.asm#311

 copy link   Newsgroups: alt.lang.asm
X-Received: by 2002:a05:620a:4502:b0:6b4:6c2f:e7b7 with SMTP id t2-20020a05620a450200b006b46c2fe7b7mr22802571qkp.11.1658279382351;
Tue, 19 Jul 2022 18:09:42 -0700 (PDT)
X-Received: by 2002:a81:5d41:0:b0:31d:d394:d6e2 with SMTP id
r62-20020a815d41000000b0031dd394d6e2mr31989053ywb.466.1658279382113; Tue, 19
Jul 2022 18:09:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Tue, 19 Jul 2022 18:09:41 -0700 (PDT)
In-Reply-To: <7a24d19e-782b-4e63-9bef-91d7634f61f6n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.47.8.185; posting-account=r_UqYQoAAADroB0Qe_EzH25J5Oyuce4G
NNTP-Posting-Host: 98.47.8.185
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com> <tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com> <tb4nrm$kfv2$1@dont-email.me>
<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com> <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com>
<97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com> <tb6nua$9id$1@gioia.aioe.org>
<b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com> <tb7fhn$17i3a$2@dont-email.me>
<7a24d19e-782b-4e63-9bef-91d7634f61f6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <57042bbb-b567-42b4-82cb-4605e7ecefb1n@googlegroups.com>
Subject: Re: MASM/WASM .model
From: alexfrun...@gmail.com (Alexei A. Frounze)
Injection-Date: Wed, 20 Jul 2022 01:09:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3198
 by: Alexei A. Frounze - Wed, 20 Jul 2022 01:09 UTC

On Tuesday, July 19, 2022 at 5:40:04 PM UTC-7, Robert Pengelly wrote:
> There's a need for far calls and segments when dealing with boot loaders as they tend to switch between real mode and protected mode. Where there are need though is sort of irrelevant, as regardless of the reasons they are used other than targeting omf objects there doesn't appear to be a way to do 16-bit selector and 32-bit offset using NASM as I keep getting the errors..

The boot sector is too small to do much useful beyond loading
a few more sectors from hard-coded locations or a file from
FAT12/16/32 and it shouldn't be switching to protected mode
(other than, perhaps, to copy loaded sectors to beyond 1MB mark)
as that would further complicate things and leave less room
for what's important.

Yes, one sector is enough to load a DOS-style .COM or .EXE file
off a FAT1x/32 FS. See my https://github.com/alexfru/BootProg .

That 2nd stage loader (.COM or .EXE), which can be much larger,
may load the rest of your OS kernel (if not just contain it if it's
not too big) and compared to just one sector there's enough room
for code that would query BIOS, examine the hardware and
switch to protected mode and all.

If you use my https://github.com/alexfru/SmallerC , you can make
a DOS-style .EXE 2nd stage loader, mostly written in C, that would
operate in unreal mode and let you easily do the rest of loading
and what not.
See https://wiki.osdev.org/Unreal_Mode#Smaller_C .

Alex

Re: MASM/WASM .model

<tb7nkl$dq4$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=312&group=alt.lang.asm#312

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!aioe.org!9V4Y849qAXW5MLE+FNi3sg.user.46.165.242.75.POSTED!not-for-mail
From: fbkot...@myfairpoint.net (Frank Kotler)
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 21:58:55 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tb7nkl$dq4$1@gioia.aioe.org>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="14148"; posting-host="9V4Y849qAXW5MLE+FNi3sg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Frank Kotler - Wed, 20 Jul 2022 01:58 UTC

On 07/18/2022 06:46 PM, sean@conman.org wrote:
....
> Why not use nasm?

No ".model" directive (AFAIK). Which makes the answer easy...

Best,
Frank

Re: MASM/WASM .model

<tb7o7c$iqu$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=313&group=alt.lang.asm#313

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!aioe.org!9V4Y849qAXW5MLE+FNi3sg.user.46.165.242.75.POSTED!not-for-mail
From: fbkot...@myfairpoint.net (Frank Kotler)
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 22:08:53 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tb7o7c$iqu$1@gioia.aioe.org>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me>
<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="19294"; posting-host="9V4Y849qAXW5MLE+FNi3sg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Frank Kotler - Wed, 20 Jul 2022 02:08 UTC

On 07/19/2022 01:08 AM, Robert Pengelly wrote:
....
> I used to use NASM but it has limitations. One example would be that it only allows one file to be assembled at a time and another example would be far jumps, using nasm -f coff test.asm -o test.o I get "error: COFF format does not support non-32-bit relocations"

COFF is pretty obsolete, no? Why not "-f win32"?

Best,
Frank

Re: MASM/WASM .model

<tb7pff$1bdgu$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=314&group=alt.lang.asm#314

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: sea...@conman.org
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Wed, 20 Jul 2022 02:32:15 -0000 (UTC)
Organization: Conman Laboratories
Lines: 46
Sender: Sean Conner <spc@lucy.roswell.conman.org>
Message-ID: <tb7pff$1bdgu$1@dont-email.me>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com> <18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com> <tb4nrm$kfv2$1@dont-email.me> <674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com> <c1c2a579-a603-4a87-b76d-59f20c0afb56n@googlegroups.com> <97949c73-fa69-4610-a182-f8ac50aec348n@googlegroups.com> <tb6nua$9id$1@gioia.aioe.org> <b7dc33a1-6f10-4378-a158-abbbe78e3298n@googlegroups.com> <tb7fhn$17i3a$2@dont-email.me> <7a24d19e-782b-4e63-9bef-91d7634f61f6n@googlegroups.com>
Reply-To: sean@conman.org
Injection-Date: Wed, 20 Jul 2022 02:32:15 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="27a4d59c8a57a6c26ef3c56519d39187";
logging-data="1422878"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hJwPq0lpVVbPS6Yalw8Jf"
User-Agent: tin/2.4.0-20160823 ("Octomore") (UNIX) (Linux/2.6.9-100.EL.plus.c4smp (i686))
Cancel-Lock: sha1:aIab6YpOzRenYWhb48bDLcZkt84=
 by: sea...@conman.org - Wed, 20 Jul 2022 02:32 UTC

It was thus said that the Great Robert Pengelly <robertapengelly@gmail.com> once stated:
> On Wednesday, 20 July 2022 at 00:42:49 UTC+1, se...@conman.org wrote:
>>
>> Unless you are trying to write code for MS-DOS, there's no need to deal
>> with segments or far calls at all. There's over 40 years of historical
>> bagage to the Intel x86 line.
>
> There's a need for far calls and segments when dealing with boot loaders
> as they tend to switch between real mode and protected mode. Where there
> are need though is sort of irrelevant, as regardless of the reasons they
> are used other than targeting omf objects there doesn't appear to be a way
> to do 16-bit selector and 32-bit offset using NASM as I keep getting the
> errors.

I checked the Nasm documentation, and the syntax to do a far call is:

CALL seg:offset ; supported by elf format

or

CALL FAR offset ; may not be supported by all formats

Two examples from nasm (both are list files)---the first for 16-bit code:

1 bits 16
2 global foo
3 extern bar
4 00000000 E8(0000) foo: call bar
5 00000003 9A[0000]0C00 call 12:bar
6 00000008 9A[0000][0000] call far bar
7 0000000D C3 ret

and the second for 32-bit code:

1 bits 32
2 global foo
3 extern bar
4 00000000 E8(00000000) foo: call bar
5 00000005 9A[00000000]0C00 call 12:bar
6 0000000C 9A[00000000][0000] call far bar
7 00000013 C3 ret

Both were compiled with "nasm -f obj ...". So it's possible, just not
possible with a Linux-only tool chain.

-spc

Re: MASM/WASM .model

<tb7pfi$iqu$2@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=315&group=alt.lang.asm#315

 copy link   Newsgroups: alt.lang.asm
Path: i2pn2.org!i2pn.org!aioe.org!9V4Y849qAXW5MLE+FNi3sg.user.46.165.242.75.POSTED!not-for-mail
From: fbkot...@myfairpoint.net (Frank Kotler)
Newsgroups: alt.lang.asm
Subject: Re: MASM/WASM .model
Date: Tue, 19 Jul 2022 22:30:20 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tb7pfi$iqu$2@gioia.aioe.org>
References: <49cf90f2-c5b9-4e28-9aac-7372d4baa10cn@googlegroups.com>
<980dbde1-0efe-406d-b8fd-9af94709f9e2n@googlegroups.com>
<8ffe96ea-bdbb-4478-a3dd-80d40004a918n@googlegroups.com>
<0955f624-16ed-48cf-ab11-68a1504e124bn@googlegroups.com>
<5c2aec03-67c2-4dfb-b884-4410247097c2n@googlegroups.com>
<2e4fb6e5-73cd-4f4c-9215-13a26760282cn@googlegroups.com>
<603a328f-f89b-400b-9c20-bd7b99f24347n@googlegroups.com>
<tb2q04$5fgk$1@dont-email.me>
<18191eea-86e7-4403-b6c1-208df4bbc10dn@googlegroups.com>
<tb4nrm$kfv2$1@dont-email.me>
<674d1214-e443-4050-9b38-3874a7077cf3n@googlegroups.com>
<tb7o7c$iqu$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="19294"; posting-host="9V4Y849qAXW5MLE+FNi3sg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Frank Kotler - Wed, 20 Jul 2022 02:30 UTC

On 07/19/2022 10:08 PM, Frank Kotler wrote:
> On 07/19/2022 01:08 AM, Robert Pengelly wrote:
> ...
>> I used to use NASM but it has limitations.  One example would be that
>> it only allows one file to be assembled at a time and another example
>> would be far jumps, using nasm -f coff test.asm -o test.o I get
>> "error: COFF format does not support non-32-bit relocations"
>
> COFF is pretty obsolete, no? Why not "-f win32"?

My mistake. Ignore!

Best,
Frank

Pages:12
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor