Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Of all the tyrannies that affect mankind, tyranny in religion is the worst." -- Thomas Paine


devel / comp.lang.forth / Re: hacking a trace output in forth 79?

SubjectAuthor
* hacking a trace output in forth 79?luser droog
+- Re: hacking a trace output in forth 79?dxforth
+* Re: hacking a trace output in forth 79?dxforth
|`* Re: hacking a trace output in forth 79?luser droog
| `* Re: hacking a trace output in forth 79?luser droog
|  `- Re: hacking a trace output in forth 79?luser droog
+- Re: hacking a trace output in forth 79?S Jack
+* Re: hacking a trace output in forth 79?Rick C
|`- Re: hacking a trace output in forth 79?luser droog
+* Re: hacking a trace output in forth 79?dxforth
|`* Re: hacking a trace output in forth 79?luser droog
| `- Re: hacking a trace output in forth 79?dxforth
`- Re: hacking a trace output in forth 79?Doug Hoffman

1
hacking a trace output in forth 79?

<a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7207:: with SMTP id a7mr15437182qtp.32.1625540328259;
Mon, 05 Jul 2021 19:58:48 -0700 (PDT)
X-Received: by 2002:a05:620a:1487:: with SMTP id w7mr17399780qkj.128.1625540328070;
Mon, 05 Jul 2021 19:58:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 5 Jul 2021 19:58:47 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
Subject: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Tue, 06 Jul 2021 02:58:48 +0000
Content-Type: text/plain; charset="UTF-8"
 by: luser droog - Tue, 6 Jul 2021 02:58 UTC

I've added some DOS file functions to my 8086 emulator and it seems that
somehow i've broken my forth interpreter. I'm trying to dig through the trace
of machine operators and register values armed with my list of dictionary
addresses, but it's tedious and boring trying to figure out what's going on.

Is there a "standard" way to hack a higher level trace output by replacing
DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
just stdout for now) every time a procedure is entered.

Does this seem like a good idea? Are there other better ways to generate
a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.

Re: hacking a trace output in forth 79?

<sc0m1d$elj$1@gioia.aioe.org>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: hacking a trace output in forth 79?
Date: Tue, 6 Jul 2021 14:26:19 +1000
Organization: Aioe.org NNTP Server
Lines: 30
Message-ID: <sc0m1d$elj$1@gioia.aioe.org>
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Tue, 6 Jul 2021 04:26 UTC

On 6/07/2021 12:58, luser droog wrote:
> I've added some DOS file functions to my 8086 emulator and it seems that
> somehow i've broken my forth interpreter. I'm trying to dig through the trace
> of machine operators and register values armed with my list of dictionary
> addresses, but it's tedious and boring trying to figure out what's going on.
>
> Is there a "standard" way to hack a higher level trace output by replacing
> DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> just stdout for now) every time a procedure is entered.
>
> Does this seem like a good idea? Are there other better ways to generate
> a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.
>

Fig-Forth listings (6502 at least) included such a patch. I assume that's
what you're referring to.

DOCOL LDA IP+1
PHA
LDA IP
PHA
JSR TCOLON ; mark the start of a traced : def.
CLC
LDA W
ADC #2
STA IP
TYA
ADC W+1
STA IP+1
JMP NEXT

Re: hacking a trace output in forth 79?

<sc10rj$e7r$1@gioia.aioe.org>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: hacking a trace output in forth 79?
Date: Tue, 6 Jul 2021 17:30:59 +1000
Organization: Aioe.org NNTP Server
Lines: 20
Message-ID: <sc10rj$e7r$1@gioia.aioe.org>
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Tue, 6 Jul 2021 07:30 UTC

On 6/07/2021 12:58, luser droog wrote:
> I've added some DOS file functions to my 8086 emulator and it seems that
> somehow i've broken my forth interpreter. I'm trying to dig through the trace
> of machine operators and register values armed with my list of dictionary
> addresses, but it's tedious and boring trying to figure out what's going on.
>
> Is there a "standard" way to hack a higher level trace output by replacing
> DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> just stdout for now) every time a procedure is entered.
>
> Does this seem like a good idea? Are there other better ways to generate
> a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.
>

From a precursor to 8080 DX-Forth:

https://pastebin.com/uAyE6iFA

Should be easy to convert the trace code to 8086. If NEXT is inline you'll
only be able to trace DOCOL and other datatypes you nominate.

Re: hacking a trace output in forth 79?

<82ea4716-b4e4-40f0-9b2d-b07bb45a7915n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:688f:: with SMTP id d137mr17798121qkc.453.1625577918797;
Tue, 06 Jul 2021 06:25:18 -0700 (PDT)
X-Received: by 2002:a37:b42:: with SMTP id 63mr20295534qkl.325.1625577918615;
Tue, 06 Jul 2021 06:25:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 6 Jul 2021 06:25:18 -0700 (PDT)
In-Reply-To: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:42:21d1:539d:2595;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:42:21d1:539d:2595
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <82ea4716-b4e4-40f0-9b2d-b07bb45a7915n@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Tue, 06 Jul 2021 13:25:18 +0000
Content-Type: text/plain; charset="UTF-8"
 by: S Jack - Tue, 6 Jul 2021 13:25 UTC

On Monday, July 5, 2021 at 9:58:49 PM UTC-5, luser droog wrote:
> I've added some DOS file functions to my 8086 emulator and it seems that

; Forth Interest Group 8086 FORTH
; Version 1.0
; Original implementation by Thomas Newman
; Modified by Joe Smith

; NEXT with code to trace FORTH word execution

TNEXT: PUSHF ;save executing word's data
PUSH AX
MOV AX,BIP ;addr1
OR AX,AX
JZ TNEXT2 ;no trace if addr1==0
CMP AX,-1
JZ TNEXT1 ;trace all
CMP AX,SI
JZ TNEXT1 ;in range, so trace
JA TNEXT2 ;not in range
MOV AX,BIPE
OR AX,AX
JZ TNEXT2 ;trace addr1 only
CMP AX,SI
JB TNEXT2 ;no longer in range

; Pause on address

TNEXT1: POP AX ;restore executing word's reg's.
POPF
INT 3 ;Break to DEBUG
BREAK: JMP SHORT TNEXT3 ;continue

; No pause, restore registers

TNEXT2: POP AX
POPF
TNEXT3: LODSW ;AX:=(IP)
MOV BX,AX
JMP SHORT NEXT1

; Inner interpreter, DPUSH, APUSH entry points

DPUSH: PUSH DX ;common entry point; DX, AX to S2, S1
APUSH: PUSH AX ;common entry point, AX to S1

NEXT:
IF _DEBUG
JMP TNEXT
ELSE
LODSW ; AX:=(IP), IP:=IP+1
MOV BX,AX
ENDIF

NEXT1: MOV DX,BX
INC DX ; W:=(IP)+1
JMP WORD PTR [BX] ;to CFA
--
me

Re: hacking a trace output in forth 79?

<f372aa61-90f1-4927-b41e-ee64338987f3n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:e9c7:: with SMTP id q7mr19462693qvo.50.1625594236264;
Tue, 06 Jul 2021 10:57:16 -0700 (PDT)
X-Received: by 2002:a05:622a:118f:: with SMTP id m15mr16310625qtk.319.1625594236126;
Tue, 06 Jul 2021 10:57:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 6 Jul 2021 10:57:15 -0700 (PDT)
In-Reply-To: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=72.50.1.29; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 72.50.1.29
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f372aa61-90f1-4927-b41e-ee64338987f3n@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: gnuarm.d...@gmail.com (Rick C)
Injection-Date: Tue, 06 Jul 2021 17:57:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Rick C - Tue, 6 Jul 2021 17:57 UTC

On Monday, July 5, 2021 at 10:58:49 PM UTC-4, luser droog wrote:
> I've added some DOS file functions to my 8086 emulator and it seems that
> somehow i've broken my forth interpreter. I'm trying to dig through the trace
> of machine operators and register values armed with my list of dictionary
> addresses, but it's tedious and boring trying to figure out what's going on.
>
> Is there a "standard" way to hack a higher level trace output by replacing
> DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> just stdout for now) every time a procedure is entered.
>
> Does this seem like a good idea? Are there other better ways to generate
> a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.

I'd chalk this up to the X/Y problem. You are asking question X and I'm going to give you the answer to the question Y because I think it is more useful to you.

Even though a Forth interpreter is not a large piece of code, it is big enough that debugging as a full unit is a PITA. The way to debug this is to break it into smaller pieces and test the pieces separately, then together in levels until you have a working unit of code. If all the pieces work until they are all assembled there is something fundamentally wrong with the way you have designed it most likely.

Having and testing these units should be a slam dunk because this is the way the code should have been written and tested in the first place. You should be able to repeat this process and find the issue that is causing the current problem without adding any special debug features.

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: hacking a trace output in forth 79?

<09e07259-42c4-4756-aed8-c70d0b218084n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:6209:: with SMTP id w9mr14039459qkb.490.1625722149580;
Wed, 07 Jul 2021 22:29:09 -0700 (PDT)
X-Received: by 2002:a0c:f14a:: with SMTP id y10mr27593591qvl.7.1625722149355;
Wed, 07 Jul 2021 22:29:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 7 Jul 2021 22:29:09 -0700 (PDT)
In-Reply-To: <f372aa61-90f1-4927-b41e-ee64338987f3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com> <f372aa61-90f1-4927-b41e-ee64338987f3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <09e07259-42c4-4756-aed8-c70d0b218084n@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Thu, 08 Jul 2021 05:29:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: luser droog - Thu, 8 Jul 2021 05:29 UTC

On Tuesday, July 6, 2021 at 12:57:16 PM UTC-5, gnuarm.del...@gmail.com wrote:
> On Monday, July 5, 2021 at 10:58:49 PM UTC-4, luser droog wrote:
> > I've added some DOS file functions to my 8086 emulator and it seems that
> > somehow i've broken my forth interpreter. I'm trying to dig through the trace
> > of machine operators and register values armed with my list of dictionary
> > addresses, but it's tedious and boring trying to figure out what's going on.
> >
> > Is there a "standard" way to hack a higher level trace output by replacing
> > DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> > just stdout for now) every time a procedure is entered.
> >
> > Does this seem like a good idea? Are there other better ways to generate
> > a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.
> I'd chalk this up to the X/Y problem. You are asking question X and I'm going to give you the answer to the question Y because I think it is more useful to you.
>
> Even though a Forth interpreter is not a large piece of code, it is big enough that debugging as a full unit is a PITA. The way to debug this is to break it into smaller pieces and test the pieces separately, then together in levels until you have a working unit of code. If all the pieces work until they are all assembled there is something fundamentally wrong with the way you have designed it most likely.
>
> Having and testing these units should be a slam dunk because this is the way the code should have been written and tested in the first place. You should be able to repeat this process and find the issue that is causing the current problem without adding any special debug features.
>

Thanks. You're almost certainly right. Trouble is, I've written myself into a
corner (or possibly many corners) with this project. It began as a codegolf
exercise in PostScript, just an emulator for a restricted subset of 8086
instructions. Then I rewrote it in C with heavy (cumbersome?) use of
macros. It wasn't ever really codegolf per se, but it was a challenge posted
on codegolf.SE so I had golf on the brain while writing.

Then a few years later I tried adding more opcodes and a forth on top,
so it's kind of a screwy mess. It's only virtue is it's short. By aggressive
macro-ing, the entire source is under 2k lines.

I did stumble upon the error I introduced. When factoring out my dos
and bios handlers I had tried to collect a bunch of cases with fallthrough,
forgetting that my CASE macro is defined as "break; case" to prevent
fallthrough.

Re: hacking a trace output in forth 79?

<sc64o8$1eja$1@gioia.aioe.org>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: hacking a trace output in forth 79?
Date: Thu, 8 Jul 2021 16:08:08 +1000
Organization: Aioe.org NNTP Server
Lines: 6
Message-ID: <sc64o8$1eja$1@gioia.aioe.org>
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Thu, 8 Jul 2021 06:08 UTC

On 6/07/2021 12:58, luser droog wrote:
>
> I've got maybe 70% of forth 79 implemented.
>

Why Forth-79 which was generally considered broken?

Re: hacking a trace output in forth 79?

<09867efc-6547-46f5-9982-eda2ee7a5bf1n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:b145:: with SMTP id a66mr29025010qkf.329.1625726740501;
Wed, 07 Jul 2021 23:45:40 -0700 (PDT)
X-Received: by 2002:a05:620a:13ec:: with SMTP id h12mr13671130qkl.217.1625726740206;
Wed, 07 Jul 2021 23:45:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 7 Jul 2021 23:45:40 -0700 (PDT)
In-Reply-To: <sc64o8$1eja$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com> <sc64o8$1eja$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <09867efc-6547-46f5-9982-eda2ee7a5bf1n@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Thu, 08 Jul 2021 06:45:40 +0000
Content-Type: text/plain; charset="UTF-8"
 by: luser droog - Thu, 8 Jul 2021 06:45 UTC

On Thursday, July 8, 2021 at 1:08:13 AM UTC-5, dxforth wrote:
> On 6/07/2021 12:58, luser droog wrote:
> >
> > I've got maybe 70% of forth 79 implemented.
> >
> Why Forth-79 which was generally considered broken?

That's been my habit in investigating languages. Generally, the
earliest version is smaller and simpler to understand. One big
exception I've found is MS-DOS, where version 2.0 is immensely
simpler than all the 1.0 stuff it replaces.

What about Forth-79 is considered broken? Did 83 fix it?

Re: hacking a trace output in forth 79?

<sc6atv$tbb$1@gioia.aioe.org>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: hacking a trace output in forth 79?
Date: Thu, 8 Jul 2021 17:53:34 +1000
Organization: Aioe.org NNTP Server
Lines: 43
Message-ID: <sc6atv$tbb$1@gioia.aioe.org>
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
<sc64o8$1eja$1@gioia.aioe.org>
<09867efc-6547-46f5-9982-eda2ee7a5bf1n@googlegroups.com>
NNTP-Posting-Host: xrnZ5uanw3pSzK+Ytx4Jfg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 8 Jul 2021 07:53 UTC

On 8/07/2021 16:45, luser droog wrote:
> On Thursday, July 8, 2021 at 1:08:13 AM UTC-5, dxforth wrote:
>> On 6/07/2021 12:58, luser droog wrote:
>> >
>> > I've got maybe 70% of forth 79 implemented.
>> >
>> Why Forth-79 which was generally considered broken?
>
> That's been my habit in investigating languages. Generally, the
> earliest version is smaller and simpler to understand. One big
> exception I've found is MS-DOS, where version 2.0 is immensely
> simpler than all the 1.0 stuff it replaces.
>
> What about Forth-79 is considered broken?

Never looked closely at it myself as I went straight from FIG to 83.
However commentary about Forth-79 suggested it was problematic. That
may be because forth standards have always been an amalgam of the
systems of the day.

> Did 83 fix it?
>

Depends on who you ask :)

'The Evolution of Forth'

"Although FORTH-79 was very influential, many Forth users and vendors
found flaws in it; in 1982 two meetings were held to update the standard,
and in 1983 a new standard was released called FORTH-83."

'Forth-83: A Minority View' (FD 5/3)

"83-Standard does not have state-smart required words. This seems
to have grown from the problems using '(tick). In 79-Standard, FIND
wasn't of much use so most people used the state-smart '(tick). This
led to problems, since some state-smart words must be used cautiously
when compiled within a colon definition. The solution adopted was to
make all words state-dumb and to add words to handle some of the lost
functions. FIND was later made useful, yet state-dumb words remain."

"FORTH-79 was heavily influenced by FIG, who insisted on its inclusion"
- E. Rather (c.l.f. Mar 28, 2005)

Re: hacking a trace output in forth 79?

<60e7060d$0$697$14726298@news.sunsite.dk>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Subject: Re: hacking a trace output in forth 79?
Newsgroups: comp.lang.forth
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
From: dhoffman...@gmail.com (Doug Hoffman)
Date: Thu, 8 Jul 2021 10:04:57 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.11.0
MIME-Version: 1.0
In-Reply-To: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Lines: 52
Message-ID: <60e7060d$0$697$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: b47812be.news.sunsite.dk
X-Trace: 1625753101 news.sunsite.dk 697 glidedog@gmail.com/68.55.82.126:57272
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Thu, 8 Jul 2021 14:04 UTC

On 7/5/21 10:58 PM, luser droog wrote:

> Is there a "standard" way to hack a higher level trace output by replacing
> DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> just stdout for now) every time a procedure is entered.
>
> Does this seem like a good idea? Are there other better ways to generate
> a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.

Are you thinking about something like the following?

Here's an example output from a recent thread on a buggy TYPE.
First test has 2 letters in the string, second test has 0.

traceon \ start trace when TYPE starts
: type ( a u -- ) dup IF 0 DO dup c@ emit 1+ LOOP ELSE drop THEN ;
traceoff \ end trace when TYPE ends

debug on \ with debug off no trace output occurs, even when TYPE is
\ executed.

s" hi" type ( 2 ) \ -1073750448 \ 2
dup ( 3 ) \ -1073750448 \ 2 \ 2
IF ( 2 ) \ -1073750448 \ 2
0 ( 3 ) \ -1073750448 \ 2 \ 0
DO ( 1 ) \ -1073750448
dup ( 2 ) \ -1073750448 \ -1073750448
c@ ( 2 ) \ -1073750448 \ 104
emit h ( 1 ) \ -1073750448
1+ ( 1 ) \ -1073750447
LOOP ( 1 ) \ -1073750447
dup ( 2 ) \ -1073750447 \ -1073750447
c@ ( 2 ) \ -1073750447 \ 105
emit i ( 1 ) \ -1073750447
1+ ( 1 ) \ -1073750446
LOOP ( 1 ) \ -1073750446
ELSE ( 1 ) \ -1073750446
; ok ( 1 ) \ -1073750446

pad 0 type ( 2 ) \ -1073749856 \ 0
dup ( 3 ) \ -1073749856 \ 0 \ 0
IF ( 2 ) \ -1073749856 \ 0
drop ( 1 ) \ -1073749856
THEN ( 1 ) \ -1073749856
; ok ( 1 ) \ -1073749856

This trace tool was written by Ward McFarland for MacForth (sold by
MPE). I have often found it very useful. But it is proprietary code so I
can't give out the implementation.

-Doug

Re: hacking a trace output in forth 79?

<ceaf7715-18a0-4285-bbeb-d3b1cf37ad09n@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:144c:: with SMTP id v12mr2753631qtx.102.1627020766029;
Thu, 22 Jul 2021 23:12:46 -0700 (PDT)
X-Received: by 2002:a05:622a:50:: with SMTP id y16mr2841376qtw.322.1627020765785;
Thu, 22 Jul 2021 23:12:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 22 Jul 2021 23:12:45 -0700 (PDT)
In-Reply-To: <sc10rj$e7r$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com> <sc10rj$e7r$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ceaf7715-18a0-4285-bbeb-d3b1cf37ad09n@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Fri, 23 Jul 2021 06:12:46 +0000
Content-Type: text/plain; charset="UTF-8"
 by: luser droog - Fri, 23 Jul 2021 06:12 UTC

On Tuesday, July 6, 2021 at 2:31:03 AM UTC-5, dxforth wrote:
> On 6/07/2021 12:58, luser droog wrote:
> > I've added some DOS file functions to my 8086 emulator and it seems that
> > somehow i've broken my forth interpreter. I'm trying to dig through the trace
> > of machine operators and register values armed with my list of dictionary
> > addresses, but it's tedious and boring trying to figure out what's going on.
> >
> > Is there a "standard" way to hack a higher level trace output by replacing
> > DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> > just stdout for now) every time a procedure is entered.
> >
> > Does this seem like a good idea? Are there other better ways to generate
> > a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.
> >
> From a precursor to 8080 DX-Forth:
>
> https://pastebin.com/uAyE6iFA
>
> Should be easy to convert the trace code to 8086. If NEXT is inline you'll
> only be able to trace DOCOL and other datatypes you nominate.

That was the hint I needed. Replacing NEXT was more straightforward than
DOCOL, or at least it should have been. It turns out I discovered a bug in
my emulator for the "SUB ax, immediate" instruction. It was subtracting
the wrong way. With that fixed and some more stumbling and groping around,
I did finally get the trace output I wanted with this code:

#define TNEXT \
/*MOV(,R,BX,SI),*/ \
LODS, PUSH(AX), \
/*MOV(,R,BX,AX), MOV(,Z,AX,BX_),*/ \
/*MOV(,R,AX,SI),*/ \
/*MOV(,R,AX,BX),*/ \
SUBAX(MAX_NAME), \
MOV(,R,DX,AX), \
DEC(AX), MOV(,R,BX,AX), MOV(BYTE,Z,CL,BX_), XOR(BYTE,R,CH,CH),\
/*MOVI(CX,1),*/ \
MOVI(AX,0x4000), MOVI(BX,1), INT(21), \
MOVI(AX,0x0E00+'\n'), INT(10), \
POP(AX), MOV(,R,BX,AX), MOV(,Z,BX,BX_), JMP_(R,BX)
#define _NEXT LODS, MOV(,R,BX,AX), MOV(,Z,BX,BX_), JMP_(R,BX)
#define NEXT TNEXT

which gives me this trace output (trimmed after 'bye'):

$ !.
../a8086
resetrsp
[ 0
state
! exit
quit
resetsp
accept
readline
resetbuf
lit
lit
setbuf
lit
! lit
! exit
exit
buffer
drop
dup
key
bye

Not terrifically useful or exciting, but I did get it working ultimately.

Thanks for all the help, everyone!

--
droog

Re: hacking a trace output in forth 79?

<facd6e39-87f8-4f27-9ea1-d8f848cce62an@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:2d04:: with SMTP id t4mr3416211qkh.160.1627022787875;
Thu, 22 Jul 2021 23:46:27 -0700 (PDT)
X-Received: by 2002:a05:6214:961:: with SMTP id do1mr3242812qvb.25.1627022787587;
Thu, 22 Jul 2021 23:46:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 22 Jul 2021 23:46:27 -0700 (PDT)
In-Reply-To: <ceaf7715-18a0-4285-bbeb-d3b1cf37ad09n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
<sc10rj$e7r$1@gioia.aioe.org> <ceaf7715-18a0-4285-bbeb-d3b1cf37ad09n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <facd6e39-87f8-4f27-9ea1-d8f848cce62an@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Fri, 23 Jul 2021 06:46:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: luser droog - Fri, 23 Jul 2021 06:46 UTC

On Friday, July 23, 2021 at 1:12:46 AM UTC-5, luser droog wrote:
> On Tuesday, July 6, 2021 at 2:31:03 AM UTC-5, dxforth wrote:
> > On 6/07/2021 12:58, luser droog wrote:
> > > I've added some DOS file functions to my 8086 emulator and it seems that
> > > somehow i've broken my forth interpreter. I'm trying to dig through the trace
> > > of machine operators and register values armed with my list of dictionary
> > > addresses, but it's tedious and boring trying to figure out what's going on.
> > >
> > > Is there a "standard" way to hack a higher level trace output by replacing
> > > DOCOL/ENTER maybe? I just want to dump the name to stderr (or even
> > > just stdout for now) every time a procedure is entered.
> > >
> > > Does this seem like a good idea? Are there other better ways to generate
> > > a trace with a beefier forth? I've got maybe 70% of forth 79 implemented.
> > >
> > From a precursor to 8080 DX-Forth:
> >
> > https://pastebin.com/uAyE6iFA
> >
> > Should be easy to convert the trace code to 8086. If NEXT is inline you'll
> > only be able to trace DOCOL and other datatypes you nominate.
> That was the hint I needed. Replacing NEXT was more straightforward than
> DOCOL, or at least it should have been. It turns out I discovered a bug in
> my emulator for the "SUB ax, immediate" instruction. It was subtracting
> the wrong way. With that fixed and some more stumbling and groping around,
> I did finally get the trace output I wanted with this code:
>
> #define TNEXT \
> /*MOV(,R,BX,SI),*/ \
> LODS, PUSH(AX), \
> /*MOV(,R,BX,AX), MOV(,Z,AX,BX_),*/ \
> /*MOV(,R,AX,SI),*/ \
> /*MOV(,R,AX,BX),*/ \
> SUBAX(MAX_NAME), \
> MOV(,R,DX,AX), \
> DEC(AX), MOV(,R,BX,AX), MOV(BYTE,Z,CL,BX_), XOR(BYTE,R,CH,CH),\
> /*MOVI(CX,1),*/ \
> MOVI(AX,0x4000), MOVI(BX,1), INT(21), \
> MOVI(AX,0x0E00+'\n'), INT(10), \
> POP(AX), MOV(,R,BX,AX), MOV(,Z,BX,BX_), JMP_(R,BX)
> #define _NEXT LODS, MOV(,R,BX,AX), MOV(,Z,BX,BX_), JMP_(R,BX)
> #define NEXT TNEXT
>
> which gives me this trace output (trimmed after 'bye'):
>
[snip]
>
> Not terrifically useful or exciting, but I did get it working ultimately.
>
> Thanks for all the help, everyone!
>

I changed the newline to space and moved BYE closer to the bottom
of the dictionary and now the output isn't so overwhelming. And possibly
illuminating. Here's the trace of a complete session which asks
for input and receives solely the word BYE.

[turn on your word-wrap setting, these lines get long...]

$ !m
make
cc -Wno-incompatible-pointer-types -o a8086 a8086.c
$ !.
../a8086
resetrsp [ 0 state ! exit quit resetsp accept readline resetbuf lit lit setbuf lit ! lit ! exit exit buffer drop dup key bye
swap 2dup ! 1+ swap 10 = 0branch key swap 2dup ! 1+ swap 10 = 0branch key swap 2dup ! 1+ swap 10 = 0branch key swap 2dup ! 1+ swap 10 = 0branch lit over 1- ! over - setbuf lit ! lit ! exit exit interpret parse buffer dup 0> 0branch 2drop bl word buffer rot pdelim -rot swap 0 2dup + c@ swap 1+ swap 4 pick <> = not exit 0branch 1- pdelim1 rot 2dup swap - swap drop -rot + swap exit exit pndelim dup 0> 0branch pndelim1 swap 0 2dup + c@ swap 1+ swap 4 pick = 0branch 2dup + c@ swap 1+ swap 4 pick = 0branch 2dup + c@ swap 1+ swap 4 pick = 0branch 2dup + c@ swap 1+ swap 4 pick = 0branch 1- pndelim2 swap >r rot drop 2dup - rot drop over r + swap setbuf lit ! lit ! exit r> swap dup 0> 0branch exit exit exit exit exit dup 0> 0branch find latest findloop -rot 3dup rot nfan lit + count dup 1+ swap c@ exit exit s= 1branch rot @ dup 0= 1branch -rot branch 3dup rot nfan lit + count dup 1+ swap c@ exit exit s= 1branch rot @ dup 0= 1branch -rot branch 3dup rot nfan lit + count dup 1+ swap c@ exit exit s= 1branch rot @ dup 0= 1branch -rot branch 3dup rot nfan lit + count dup 1+ swap c@ exit exit s= 1branch rot exit dup 0= not 0branch cfa lit + exit exit dup 0= 1branch iexec -rot drop drop execomp state @ 0= over isimmed lit + @ lit and exit or 1branch execute
$

It runs around the findloop a few times until finding the correct entry and
executing it, which halts the emulator.

Re: hacking a trace output in forth 79?

<2fd25cc2-494f-4634-8ecf-23d434b40aedn@googlegroups.com>

 copy mid

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

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:b145:: with SMTP id a66mr231466qkf.329.1627614378715;
Thu, 29 Jul 2021 20:06:18 -0700 (PDT)
X-Received: by 2002:ad4:4049:: with SMTP id r9mr486397qvp.41.1627614378544;
Thu, 29 Jul 2021 20:06:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 29 Jul 2021 20:06:18 -0700 (PDT)
In-Reply-To: <facd6e39-87f8-4f27-9ea1-d8f848cce62an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.207.183.245; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz
NNTP-Posting-Host: 24.207.183.245
References: <a51f4f60-868b-415b-ac93-cfdaf00ec23cn@googlegroups.com>
<sc10rj$e7r$1@gioia.aioe.org> <ceaf7715-18a0-4285-bbeb-d3b1cf37ad09n@googlegroups.com>
<facd6e39-87f8-4f27-9ea1-d8f848cce62an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2fd25cc2-494f-4634-8ecf-23d434b40aedn@googlegroups.com>
Subject: Re: hacking a trace output in forth 79?
From: luser.dr...@gmail.com (luser droog)
Injection-Date: Fri, 30 Jul 2021 03:06:18 +0000
Content-Type: text/plain; charset="UTF-8"
 by: luser droog - Fri, 30 Jul 2021 03:06 UTC

On Friday, July 23, 2021 at 1:46:28 AM UTC-5, luser droog wrote:
> On Friday, July 23, 2021 at 1:12:46 AM UTC-5, luser droog wrote:
\> [snip]
> >
> > Not terrifically useful or exciting, but I did get it working ultimately.
> >
> > Thanks for all the help, everyone!
> >
> I changed the newline to space and moved BYE closer to the bottom
> of the dictionary and now the output isn't so overwhelming. And possibly
> illuminating. Here's the trace of a complete session which asks
> for input and receives solely the word BYE.
>
> [turn on your word-wrap setting, these lines get long...]
[snip]
> It runs around the findloop a few times until finding the correct entry and
> executing it, which halts the emulator.

Staring at that trace output, it was irritating to see "lit" all over the place
and not know what number was being pushed. So I added a tracing LIT
in which I was unable to use U. .Really exercising the assembly lately.
Some macro adventures are described in a thread in comp.lang.c.

This code tries to print a 16bit number in base 10 using int 10h,
left to right without leading zeros. All the jump offsets are manually
calculated.

CODE(lit, lit, LODS, PUSH(AX)
#ifdef TRACE
, MOV(,R,BX,AX), OR(,R,BX,BX), JGE,7, MOVI(AX,0x0E00+'-'), INT(10), NEG(R,BX),
MOV(,R,AX,BX), XOR(,R,DX,DX), MOVI(CX,10000), DIV(R,CX),
OR(,R,AX,AX), JZ,6, MOVBI(AH,0x0E), ADDAL(48), INT(10),
MOV(,R,AX,DX), XOR(,R,DX,DX), MOVI(CX,1000), DIV(R,CX),
OR(,R,AX,AX), JZ,6, MOVBI(AH,0x0E), ADDAL(48), INT(10),
MOV(,R,AX,DX), MOVBI(CL,100), XOR(BYTE,R,CH,CH), BYTE+DIV(R,CL),
MOV(BYTE,R,DL,AH),
OR(BYTE,R,AL,AL), JZ,6, MOVBI(AH,0x0E), ADDAL(48), INT(10),
MOV(BYTE,R,AL,DL), XOR(BYTE,R,AH,AH), MOVBI(CL,10), BYTE+DIV(R,CL),
MOV(BYTE,R,DL,AH),
OR(BYTE,R,AL,AL), JZ,6, MOVBI(AH,0x0E), ADDAL(48), INT(10),
MOVBI(AH,0x0E), MOV(BYTE,R,AL,DL), ADDAL(48), INT(10),
MOVI(AX,0x0E00+' '), INT(10)
#endif
)/**/

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor