Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I've got a bad feeling about this.


devel / comp.lang.forth / Looking for guidance on assembling executables from Forth.

SubjectAuthor
* Looking for guidance on assembling executables from Forth.Krzysztof Jeszke
+- Re: Looking for guidance on assembling executables from Forth.none
+* Re: Looking for guidance on assembling executables from Forth.Stephen Pelc
|+* Re: Looking for guidance on assembling executables from Forth.Michał Kasprzak
||`- Re: Looking for guidance on assembling executables from Forth.none
|`* Re: Looking for guidance on assembling executables from Forth.Zbig
| `- Re: Looking for guidance on assembling executables from Forth.Stephen Pelc
+- Re: Looking for guidance on assembling executables from Forth.Anton Ertl
+* Re: Looking for guidance on assembling executables from Forth.S Jack
|`* Re: Looking for guidance on assembling executables from Forth.Krzysztof Jeszke
| +- Re: Looking for guidance on assembling executables from Forth.Marcel Hendrix
| `- Re: Looking for guidance on assembling executables from Forth.minf...@arcor.de
`- Re: Looking for guidance on assembling executables from Forth.Brian Fox

1
Looking for guidance on assembling executables from Forth.

<93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19425&group=comp.lang.forth#19425

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2909:b0:6b6:a94:a988 with SMTP id m9-20020a05620a290900b006b60a94a988mr433076qkp.350.1659038655074;
Thu, 28 Jul 2022 13:04:15 -0700 (PDT)
X-Received: by 2002:a05:620a:1981:b0:6b5:cccf:62e1 with SMTP id
bm1-20020a05620a198100b006b5cccf62e1mr405417qkb.376.1659038654870; Thu, 28
Jul 2022 13:04:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 28 Jul 2022 13:04:14 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=78.28.35.202; posting-account=dOqm5AoAAAC80NiInKf8VrwShej5Sz5e
NNTP-Posting-Host: 78.28.35.202
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
Subject: Looking for guidance on assembling executables from Forth.
From: krzyszto...@gmail.com (Krzysztof Jeszke)
Injection-Date: Thu, 28 Jul 2022 20:04:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 5
 by: Krzysztof Jeszke - Thu, 28 Jul 2022 20:04 UTC

Hello everyone.
i'm currently trying to build an executable using GForth's built in assembler, but apparently it, and most of the assemblers that are written in forth only assemble the code to be used as a word. Is it possible to somehow redirect the assemblers or something similar to write the machine code to an allocated chunk of memory instead of the forth vocabulary?

Re: Looking for guidance on assembling executables from Forth.

<nnd$07068676$2ff89130@4c8456a44bdf99d4>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19430&group=comp.lang.forth#19430

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$07068676$2ff89130@4c8456a44bdf99d4>
Organization: KPN B.V.
Date: Fri, 29 Jul 2022 10:53:35 +0200
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 50
Injection-Date: Fri, 29 Jul 2022 10:53:35 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 3002
 by: none - Fri, 29 Jul 2022 08:53 UTC

In article <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>,
Krzysztof Jeszke <krzysztofjeszke0@gmail.com> wrote:
>Hello everyone.
>i'm currently trying to build an executable using GForth's built in assembler, but apparently it, and most of the assemblers that are written in forth only
>assemble the code to be used as a word. Is it possible to somehow redirect the assemblers or something similar to write the machine code to an allocated
>chunk of memory instead of the forth vocabulary?

First of all, the choice of assembler matters. The following is about
Intel 386.

If you want to tie Forth to assembler, your are better off with a Forth
written in assembler, where the correspondance is clear.
If you compile in ciforth :
lina -c hello.frt
you generate an executable `hello',
with an intermediate step that identifies
the part of memory that is written to the executable.
It is not hard to extend lina.asm with the assembler code
that result in hello.asm, provided that hello is small.

There is a reverse engineering assembler written in ciforth:
https://github.com/albertvanderhorst/ciasdis
These can generate an assembler file from an executable, and then
regenerate the executable. That second part you could port to gforth.
Examples are part of the tests.
A prestigious example is to generate version 4.0.5 of lina 32 itself,
analysing the code and generating labels found in the executable.
Expect to write a Forth code plug in to extract these labels.

Likewise a 64 bit lina is reverse engineered and reassembled, but this
is not transferred to github yet.
Part of the Makefile:

lina530.asm : ciasdis lina530crawl.cul testcmp/lina530
ciasdis -d testcmp/lina530 lina530crawl.cul >$@
ciasdis -a $@ lina530
$(DIFF_BIN) lina530
$(DIFF_TXT) $@

So the lina530 in testcmp is disassembled (-d) generating lina530.asm.
Then this source is assembler (-a) to a lina530.
The files are identical to the ones in testcmp, or the test fails.

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Looking for guidance on assembling executables from Forth.

<tc07ap$3f504$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19431&group=comp.lang.forth#19431

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: step...@vfxforth.com (Stephen Pelc)
Newsgroups: comp.lang.forth
Subject: Re: Looking for guidance on assembling executables from Forth.
Date: Fri, 29 Jul 2022 08:55:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <tc07ap$3f504$1@dont-email.me>
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 29 Jul 2022 08:55:53 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a997133f69ae95d0881a9aa340c67023";
logging-data="3642372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/liKkym/zaaJYKJtUF4Ny"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:ayR3BteGD72LjNRHIenWWGO+C/M=
X-Usenapp: v1.22/l - Full License
 by: Stephen Pelc - Fri, 29 Jul 2022 08:55 UTC

On 28 Jul 2022 at 22:04:14 CEST, "Krzysztof Jeszke"
<krzysztofjeszke0@gmail.com> wrote:

> Hello everyone.
> i'm currently trying to build an executable using GForth's built in assembler,
> but apparently it, and most of the assemblers that are written in forth only
> assemble the code to be used as a word. Is it possible to somehow redirect the
> assemblers or something similar to write the machine code to an allocated
> chunk of memory instead of the forth vocabulary?

You may find this easier to do with a native Forth system such as VFX.

Nearly all Forth systems defined one or more pairs of words to turn the
assembler on and off. These deal with placing names in the right place, and to
put the dictionary pointer HERE in the right place. It's not magic. What you
want to do is (probably) to put the names in the Forth and the assembled code
at HERE. To do this you will need to know how to change the address returned
by HERE.

The other way to do this is to use a cross compiler. Most Forth cross
compilers are undocumented and user-hostile. The only ones with real
documentation and a focus on usability are IMHO the ones from the commercial
vendors.

Stephen
--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612,
+34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: Looking for guidance on assembling executables from Forth.

<6c5f6b33-ddf3-47ab-aa77-958f9972e783n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19433&group=comp.lang.forth#19433

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:2aa6:b0:474:844b:24ff with SMTP id js6-20020a0562142aa600b00474844b24ffmr2722386qvb.51.1659091022621;
Fri, 29 Jul 2022 03:37:02 -0700 (PDT)
X-Received: by 2002:a05:620a:102e:b0:6b5:c925:788d with SMTP id
a14-20020a05620a102e00b006b5c925788dmr2111617qkk.517.1659091022407; Fri, 29
Jul 2022 03:37:02 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 03:37:02 -0700 (PDT)
In-Reply-To: <tc07ap$3f504$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=94.254.172.155; posting-account=6_WQ-goAAAB1rf-V6zYvzNSXvyUB0tj4
NNTP-Posting-Host: 94.254.172.155
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com> <tc07ap$3f504$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c5f6b33-ddf3-47ab-aa77-958f9972e783n@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: siarcze...@gmail.com (Michał Kasprzak)
Injection-Date: Fri, 29 Jul 2022 10:37:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3112
 by: Michał Kasprzak - Fri, 29 Jul 2022 10:37 UTC

Hi Krzysztof!

Stephen Pelc's 64-bit VFX Forth not only has the best code generator on the market, but also the best assembler / disassembler due to the syntax close to Intel syntax, as well as adding encoding when disassembling in the comment, which allows you to use the result as a source. And it's made available to the community for free if you don't intend to make money.

I will show you and others how to assemble in VFX Forth in a selected block of memory.

First, let's prepare a memory block (for example 4KB) and write its address in word a:
$1000 allocate drop value a

Second, we will prepare the h word to store the current HERE value so that we can restore the state it was before changing the place for assembly:
here value h

Now we can start defining the word in assembly language. While defining it, we will change the assembly target place. We will remove this word afterwards.
code krzysztof
here to h
a h - allot

Now we can assemble from address a with the convenient 64-bit VFX Forth assembler, for example:
mov rax, rbx
mov r11, rax
inc r11
inc rbx
nop
It is important that the last instruction will not be placed in the memory block provided by us because VFX Forth will put it in the dictionary when terminating the word definition with END-CODE. Therefore, we add an unnecessary nop at the end.

Now we're going to bring the HERE pointer back to its pre-assembly state and finish defining our helper word:
h here - allot
end-code

You can see what has been assembled from address a (first 30 bytes) as follows:
a 30 disasm/al
Likewise, you probably want to see out of curiosity what our temporary word looks like:
' krzysztof 30 disasm/al
Finally, you can delete the temporary word:
forget krzysztof
Your clean assembly code is in your block from address a :)
Cheers!

Re: Looking for guidance on assembling executables from Forth.

<nnd$27fe598f$77405011@bca8b574f3afb3e8>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19436&group=comp.lang.forth#19436

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com> <tc07ap$3f504$1@dont-email.me> <6c5f6b33-ddf3-47ab-aa77-958f9972e783n@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$27fe598f$77405011@bca8b574f3afb3e8>
Organization: KPN B.V.
Date: Fri, 29 Jul 2022 14:12:05 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 42
Injection-Date: Fri, 29 Jul 2022 14:12:05 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2360
 by: none - Fri, 29 Jul 2022 12:12 UTC

In article <6c5f6b33-ddf3-47ab-aa77-958f9972e783n@googlegroups.com>,
Micha� Kasprzak <siarczek83@gmail.com> wrote:
>Hi Krzysztof!
>
> Stephen Pelc's 64-bit VFX Forth not only has the best code generator
> on the market, but also the best assembler / disassembler due to the
> syntax close to Intel syntax, as well as adding encoding when
> disassembling in the comment, which allows you to use the result as a
> source. And it's made available to the community for free if you don't
> intend to make money.

I will agree that the VFX is one of the best choices of assembling 64
bit Intel in Forth. Bluntly asserting that it is the best, cannot fly,
because there can be numerous considerations valid, applicable to
any sort of situation.

A requirement that ciasdis observes is that a object can be disassembled
and then be assembled to the exact same object.
A litmus test is that the assembler makes a distinction between the
two short forms of the instruction:

MOV AX BX \ or EAX or RAX

(not counting longer forms of the same instruction.)
In ciasdis this is either of the two forms:
MOV, X| T| BX'| R| AX| \ AX --> BX to
MOV, X| F| AX'| R| BX| \ AX --> BX from

If you investigate viruses, you will need this.

<SNIP>
>mov rax, rbx
<NIP>
>Cheers!

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Looking for guidance on assembling executables from Forth.

<be40aea5-af39-4699-a23f-c538d4dc3890n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19438&group=comp.lang.forth#19438

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5fc1:0:b0:31e:f847:6c6f with SMTP id k1-20020ac85fc1000000b0031ef8476c6fmr3086709qta.616.1659097278415;
Fri, 29 Jul 2022 05:21:18 -0700 (PDT)
X-Received: by 2002:a37:8d44:0:b0:6b5:d6b5:54ac with SMTP id
p65-20020a378d44000000b006b5d6b554acmr2398614qkd.546.1659097278262; Fri, 29
Jul 2022 05:21:18 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 05:21:18 -0700 (PDT)
In-Reply-To: <tc07ap$3f504$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:a31d:a141:5b00:3176:cc50:14b9:1f4a;
posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 2a02:a31d:a141:5b00:3176:cc50:14b9:1f4a
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com> <tc07ap$3f504$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <be40aea5-af39-4699-a23f-c538d4dc3890n@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: zbigniew...@gmail.com (Zbig)
Injection-Date: Fri, 29 Jul 2022 12:21:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1476
 by: Zbig - Fri, 29 Jul 2022 12:21 UTC

> You may find this easier to do with a native Forth system such as VFX.

But from what I see on „download” page VFX is family of „hosted” Forths,
not „native” at all?

Re: Looking for guidance on assembling executables from Forth.

<2022Jul29.144520@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19440&group=comp.lang.forth#19440

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Looking for guidance on assembling executables from Forth.
Date: Fri, 29 Jul 2022 12:45:20 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 30
Message-ID: <2022Jul29.144520@mips.complang.tuwien.ac.at>
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
Injection-Info: reader01.eternal-september.org; posting-host="68eeb690a35778754a53f3de12d2e8a9";
logging-data="3692717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cmTtDysWX59fQcEsUwrUq"
Cancel-Lock: sha1:S1YHa0fXIa8F5EUrKUEAu54fsUY=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 29 Jul 2022 12:45 UTC

Krzysztof Jeszke <krzysztofjeszke0@gmail.com> writes:
>Hello everyone.
>i'm currently trying to build an executable using GForth's built in assembl=
>er, but apparently it, and most of the assemblers that are written in forth=
> only assemble the code to be used as a word.

Yes, that's the primary purpose.

>Is it possible to somehow red=
>irect the assemblers or something similar to write the machine code to an a=
>llocated chunk of memory instead of the forth vocabulary?

The most straightforward way is to define a section (in a recent
development snapshot of Gforth), maybe something like

1024 1024 * extra-section mycode
' section# mycode #>section
assember
.... \ assemble away

For executables you also need to store the meta-information of the
exeutable file formats, and you will have to find out how to handle
that yourself.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: http://www.euroforth.org/ef22/cfp.html

Re: Looking for guidance on assembling executables from Forth.

<1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19442&group=comp.lang.forth#19442

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4053:b0:6b5:df8f:3573 with SMTP id i19-20020a05620a405300b006b5df8f3573mr3131115qko.578.1659108005516;
Fri, 29 Jul 2022 08:20:05 -0700 (PDT)
X-Received: by 2002:a05:622a:654:b0:31e:e8aa:aef0 with SMTP id
a20-20020a05622a065400b0031ee8aaaef0mr3732660qtb.328.1659108005303; Fri, 29
Jul 2022 08:20:05 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 08:20:05 -0700 (PDT)
In-Reply-To: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:dd5e:4a1b:907e:2c39;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:dd5e:4a1b:907e:2c39
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Fri, 29 Jul 2022 15:20:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2639
 by: S Jack - Fri, 29 Jul 2022 15:20 UTC

On Thursday, July 28, 2022 at 3:04:16 PM UTC-5, Krzysztof Jeszke wrote:
> Hello everyone.
> i'm currently trying to build an executable using GForth's built in assembler, but apparently it, and most of the assemblers that are written in forth only assemble the code to be used as a word. Is it possible to somehow redirect the assemblers or something similar to write the machine code to an allocated chunk of memory instead of the forth vocabulary?

I think you are asking for a Forth assembler to just lay down code
instead of laying down some minimal Forth and adapting the Forth to
the application. Typical from what I have seen is the latter and have
seen comments from noted experts as why anyone would want the former.
Whatever, I'm not interested in such a debate.

In past on DOS I made some small comm programs just compiling, "C," ,
machine code. Today, hosted by Linux, I can send code to its assembler
and have the results compiled in a word. Haven't really used it other
than seeing it can be done. Also, why bring Forth into it, just do the
assembly.

Another possibility having an assembly based Forth is just use the
assembler and its Forth primitives, perhaps with some adjustment, to
lay agnostic code. Haven't tried it but long back I saw someone's
assembler that had a set of Forth macros to just do that or so I
thought.
--
me

Re: Looking for guidance on assembling executables from Forth.

<tc0ubl$3hmvr$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19444&group=comp.lang.forth#19444

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: step...@vfxforth.com (Stephen Pelc)
Newsgroups: comp.lang.forth
Subject: Re: Looking for guidance on assembling executables from Forth.
Date: Fri, 29 Jul 2022 15:28:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <tc0ubl$3hmvr$1@dont-email.me>
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com> <tc07ap$3f504$1@dont-email.me> <be40aea5-af39-4699-a23f-c538d4dc3890n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 29 Jul 2022 15:28:53 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a997133f69ae95d0881a9aa340c67023";
logging-data="3726331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bhZagy5YgEO6x9UFCpxQv"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:Fc4KGucxbKBnGUI182wf7hbA+Zo=
X-Usenapp: v1.22/l - Full License
 by: Stephen Pelc - Fri, 29 Jul 2022 15:28 UTC

On 29 Jul 2022 at 14:21:18 CEST, "Zbig" <zbigniew2011@gmail.com> wrote:

>> You may find this easier to do with a native Forth system such as VFX.
>
> But from what I see on „download” page VFX is family of „hosted” Forths,
> not „native” at all?

As opposed to being written in C or some other language.
I meant a Forth written in Forth. Sorry for the confusion.

Stephen
--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612,
+34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: Looking for guidance on assembling executables from Forth.

<58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19445&group=comp.lang.forth#19445

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5e4d:0:b0:31f:36b7:5b16 with SMTP id i13-20020ac85e4d000000b0031f36b75b16mr3902218qtx.132.1659108618389;
Fri, 29 Jul 2022 08:30:18 -0700 (PDT)
X-Received: by 2002:a05:622a:1911:b0:31e:eef1:9d5a with SMTP id
w17-20020a05622a191100b0031eeef19d5amr3914011qtc.233.1659108618219; Fri, 29
Jul 2022 08:30:18 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 08:30:18 -0700 (PDT)
In-Reply-To: <1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=78.28.35.202; posting-account=dOqm5AoAAAC80NiInKf8VrwShej5Sz5e
NNTP-Posting-Host: 78.28.35.202
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com> <1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: krzyszto...@gmail.com (Krzysztof Jeszke)
Injection-Date: Fri, 29 Jul 2022 15:30:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1909
 by: Krzysztof Jeszke - Fri, 29 Jul 2022 15:30 UTC

Friday, July 29, 2022 at 17:20:06 UTC+2 S Jack wrote:

> I think you are asking for a Forth assembler to just lay down code
> instead of laying down some minimal Forth and adapting the Forth to
> the application. Typical from what I have seen is the latter and have
> seen comments from noted experts as why anyone would want the former.
> Whatever, I'm not interested in such a debate.

I'm aiming to write a metacompiled forth in a combination of forth and assembly, which the goal of is it being a minimal bootable forth for multiple platforms. One can't simply make an executable without any assembly.

Re: Looking for guidance on assembling executables from Forth.

<cc2fd43f-3e14-424a-8e53-903a7fe3564bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19449&group=comp.lang.forth#19449

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4546:b0:6b5:f144:68bb with SMTP id u6-20020a05620a454600b006b5f14468bbmr3501854qkp.253.1659117128845;
Fri, 29 Jul 2022 10:52:08 -0700 (PDT)
X-Received: by 2002:ac8:7dcf:0:b0:31f:9fc:fa93 with SMTP id
c15-20020ac87dcf000000b0031f09fcfa93mr4404260qte.185.1659117128684; Fri, 29
Jul 2022 10:52:08 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 10:52:08 -0700 (PDT)
In-Reply-To: <58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:b5e5:f954:7601:f69c;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:b5e5:f954:7601:f69c
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
<1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com> <58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cc2fd43f-3e14-424a-8e53-903a7fe3564bn@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 29 Jul 2022 17:52:08 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2516
 by: Marcel Hendrix - Fri, 29 Jul 2022 17:52 UTC

On Friday, July 29, 2022 at 5:30:19 PM UTC+2, Krzysztof Jeszke wrote:
> Friday, July 29, 2022 at 17:20:06 UTC+2 S Jack wrote:
>
> > I think you are asking for a Forth assembler to just lay down code
> > instead of laying down some minimal Forth and adapting the Forth to
> > the application. Typical from what I have seen is the latter and have
> > seen comments from noted experts as why anyone would want the former.
> > Whatever, I'm not interested in such a debate.
> I'm aiming to write a metacompiled forth in a combination of forth and assembly,
> which the goal of is it being a minimal bootable forth for multiple platforms.
> One can't simply make an executable without any assembly.

I have done it that way since the MSDOS days, and before that
on Motorola's 68k, Inmos transputer, and Z80.

It is always a hassle when the processor architecture upgrades
wordsize (16->32->64bits->...), or when changing from one processor
to another (e.g. from 68K to Intel to M1). Given the current state-of-the-art,
I don't think I'll need to write a 128 or 256bit Forth for a radically new
processor that is orders of magnitude better than the ice-giants, anytime soon.

-marcel

Re: Looking for guidance on assembling executables from Forth.

<76aaa741-02c6-4bbc-9546-61b81cfa358an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19450&group=comp.lang.forth#19450

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:29e9:b0:473:63b:5c61 with SMTP id jv9-20020a05621429e900b00473063b5c61mr4671390qvb.99.1659127608317;
Fri, 29 Jul 2022 13:46:48 -0700 (PDT)
X-Received: by 2002:ac8:5993:0:b0:31f:6a2:872a with SMTP id
e19-20020ac85993000000b0031f06a2872amr5130914qte.663.1659127608171; Fri, 29
Jul 2022 13:46:48 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 13:46:48 -0700 (PDT)
In-Reply-To: <58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f05:595a:1dc3:cd4f:9a7f:13fb;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f05:595a:1dc3:cd4f:9a7f:13fb
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
<1f4a19da-9ab8-4059-9c16-a594f9f7ef9en@googlegroups.com> <58b3ef40-36b1-46d4-9521-15472e9ae934n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <76aaa741-02c6-4bbc-9546-61b81cfa358an@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Fri, 29 Jul 2022 20:46:48 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2398
 by: minf...@arcor.de - Fri, 29 Jul 2022 20:46 UTC

Krzysztof Jeszke schrieb am Freitag, 29. Juli 2022 um 17:30:19 UTC+2:
> Friday, July 29, 2022 at 17:20:06 UTC+2 S Jack wrote:
>
> > I think you are asking for a Forth assembler to just lay down code
> > instead of laying down some minimal Forth and adapting the Forth to
> > the application. Typical from what I have seen is the latter and have
> > seen comments from noted experts as why anyone would want the former.
> > Whatever, I'm not interested in such a debate.
> I'm aiming to write a metacompiled forth in a combination of forth and assembly, which the goal of is it being a minimal bootable forth for multiple platforms. One can't simply make an executable without any assembly.

We had been doing that in the eighties and nineties for programmable controllers,
and with every new CPU or controller generation - or sometimes by customer requirement -
we had to reengineer and reimplement and test and document a new kernel variant.
What a hassle - particularly for maintenance !!!!

Then we switched from assembly to C and never looked back.

Re: Looking for guidance on assembling executables from Forth.

<e43c3635-907e-4652-b756-8acf19e303e1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19452&group=comp.lang.forth#19452

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:1002:b0:31e:f2ff:e3fd with SMTP id d2-20020a05622a100200b0031ef2ffe3fdmr5739541qte.304.1659145498789;
Fri, 29 Jul 2022 18:44:58 -0700 (PDT)
X-Received: by 2002:a05:622a:48b:b0:31f:2416:2f3f with SMTP id
p11-20020a05622a048b00b0031f24162f3fmr5601850qtx.376.1659145498613; Fri, 29
Jul 2022 18:44:58 -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: comp.lang.forth
Date: Fri, 29 Jul 2022 18:44:58 -0700 (PDT)
In-Reply-To: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=99.242.210.36; posting-account=2z7GawoAAADc70p5SM5AbaCyzjLblS3g
NNTP-Posting-Host: 99.242.210.36
References: <93b46356-bb52-4da7-bf0b-1a8231c9d2edn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e43c3635-907e-4652-b756-8acf19e303e1n@googlegroups.com>
Subject: Re: Looking for guidance on assembling executables from Forth.
From: brian....@brianfox.ca (Brian Fox)
Injection-Date: Sat, 30 Jul 2022 01:44:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2921
 by: Brian Fox - Sat, 30 Jul 2022 01:44 UTC

On Thursday, July 28, 2022 at 4:04:16 PM UTC-4, Krzysztof Jeszke wrote:
> Hello everyone.
> i'm currently trying to build an executable using GForth's built in assembler, but apparently it, and most of the assemblers that are written in forth only assemble the code to be used as a word. Is it possible to somehow redirect the assemblers or something similar to write the machine code to an allocated chunk of memory instead of the forth vocabulary?

This is totally obvious to the old hands here but since it wasn't mentioned specifically
I will stick my neck out because I didn't understand this years ago either..
When I realized how simple it was I was kind of shocked. :-)

You can make a Forth cross-Assembler with special pointable versions of comma,
w-comma, c-comma and whatever other number compilers your architecture needs.
You also need a new HERE and ALLOT for the target memory space.

Once you have those, you just re-compile the assembler with those "pointable"
versions of comma replacing the generic versions and replacing HERE with THERE.

From a quick scan of GForth source it looks like the various asm.fs files are available.
This might be more trouble than it's worth for you needs, but it does work.

Here is how my cross-assembler begins for a 16 bit machine:

VARIABLE TDP \ "target dictionary point"

\ set where the Cross-assembler puts its code
: ORG ( addr -- ) TDP ! ;

\ Target versions of HERE and ALLOT
: THERE ( -- addr) TDP @ ;
: TALLOT ( n -- ) TDP +! ;

\ integer and byte "Target" compilers
: T, ( n -- ) THERE ! 2 TALLOT ;
: TC, ( c -- ) THERE C! 1 TALLOT ;

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor