Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Before Xerox, five carbons were the maximum extension of anybody's ego.


devel / comp.lang.forth / A useful program, watdoido

SubjectAuthor
* A useful program, watdoidonone
+- Re: A useful program, watdoidosjack
`* Re: A useful program, watdoidoHans Bezemer
 `* Re: A useful program, watdoidoPaul Rubin
  `* Re: A useful program, watdoidoKerr-Mudd, John
   +* Re: A useful program, watdoidominforth
   |+* Re: A useful program, watdoidoKerr-Mudd, John
   ||`* Re: A useful program, watdoidodxf
   || +* Re: A useful program, watdoidoKerr-Mudd, John
   || |`* Re: A useful program, watdoidominforth
   || | `- Re: A useful program, watdoidodxf
   || `* Re: A useful program, watdoidoAnton Ertl
   ||  +- Re: A useful program, watdoidoKerr-Mudd, John
   ||  `* Re: A useful program, watdoidodxf
   ||   `* Re: A useful program, watdoidoalbert
   ||    `* Re: A useful program, watdoidodxf
   ||     +* Re: A useful program, watdoidoalbert
   ||     |`* Re: A useful program, watdoidodxf
   ||     | +* Re: A useful program, watdoidomhx
   ||     | |`* Re: A useful program, watdoidodxf
   ||     | | `* Re: A useful program, watdoidoAnton Ertl
   ||     | |  +- Re: A useful program, watdoidodxf
   ||     | |  `- Re: A useful program, watdoidodxf
   ||     | `* Re: A useful program, watdoidoalbert
   ||     |  +- Re: A useful program, watdoidominforth
   ||     |  `- Re: A useful program, watdoidodxf
   ||     `* Re: A useful program, watdoidomhx
   ||      +* Re: A useful program, watdoidoAnton Ertl
   ||      |`- Re: A useful program, watdoidodxf
   ||      +* Re: A useful program, watdoidoalbert
   ||      |`* Re: A useful program, watdoidomhx
   ||      | `- Re: A useful program, watdoidoalbert
   ||      `- Re: A useful program, watdoidoHans Bezemer
   |+* Re: A useful program, watdoidoAnton Ertl
   ||`* Re: A useful program, watdoidoGerry Jackson
   || +- Re: A useful program, watdoidoAnton Ertl
   || +* Re: A useful program, watdoidoalbert
   || |+* Re: A useful program, watdoidoahmed
   || ||`- Re: A useful program, watdoidoAnton Ertl
   || |`- Re: A useful program, watdoidoGerry Jackson
   || `- Re: A useful program, watdoidodxf
   |`- Re: A useful program, watdoidoalbert
   `* Re: A useful program, watdoidoalbert
    `* Re: A useful program, watdoidomhx
     `- Re: A useful program, watdoidomhx

Pages:12
A useful program, watdoido

<nnd$688f6514$2847ddd2@e099b08a19891604>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=25686&group=comp.lang.forth#25686

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: A useful program, watdoido
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$688f6514$2847ddd2@e099b08a19891604>
Organization: KPN B.V.
Date: Sat, 23 Dec 2023 15:33:40 +0100
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!tr1.iad1.usenetexpress.com!feeder.usenetexpress.com!tr1.eu1.usenetexpress.com!2001:67c:174:101:1:67:202:6.MISMATCH!feed.abavia.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 80
Injection-Date: Sat, 23 Dec 2023 15:33:40 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Sat, 23 Dec 2023 14:33 UTC

Often time you are interested how long some task takes.
It is intended to answer the question " "how have I
wasted my time."
The idea is to have a timer program.
If it finishes it tells you how much time has elapsed.
It is cumbersome to grab your smart phone, start the timer,
then stop the timer and read it back.
Once more the terminal interface is superior.

START: timer
STOP: BYE

~:timer
2000 MS BYE
~:you spend 0 minutes 6 seconds

In ciforth it is easy because TIME&DATE is exposed, and you
can inspect factors, in particular SSE SPLIT-OFF-TIME
This for linux 32/64 i86/arm/riscv

/-------- timer.frt ------8< ---------------------

WANT TIME&DATE
VARIABLE START

: BYE SSE START @ - SPLIT-OFF-TIME DROP
"You spent " TYPE DUP IF . "hours " TYPE ELSE DROP THEN
. "minutes " TYPE . "seconds " TYPE CR BYE ;
'ERROR RESTORED
: doit SSE START ! QUIT ;
/-------------------------8< ---------------------

lina -c timer.frt

You must restore error, else typing `` bye '' terminates
the program with a fatal error, instead of executing BYE.

SSE is very useful and is attainable in any Forth
that can execute system calls.

For inspiration I include the TIME&DATE block for
Linux.
/-------------------------8< ---------------------
( TIME&DATE ) CF: ?LI \ AH B30423
"-syscalls-" WANTED : SSE 0 0 0 __NR_time XOS ; ( 1970/1/1)
: | OVER , + ; : 5m 31 | 30 | 31 | 30 | 31 | ;
DATA TABLE ( start of month within leap period) -1
31 | 28 | 5m 5m 31 | 28 | 5m 5m 31 | 29 | 5m 5m
31 | 28 | 5m 5m , : T[] CELLS TABLE + @ ;
\ For DAYS within leap return MONTHS
: MONTHS >R 0 BEGIN R@ OVER T[] > WHILE 1+ REPEAT 1- RDROP ;
\ For DAYS within leap period return DAY MONTH YEARS
: SPLIT-LEAP DUP MONTHS DUP >R T[] - R> 12 /MOD >R 1+ R> ;
\ For TIME return SEC MIN HOUR DAYS
: SPLIT-OFF-TIME 0 60 UM/MOD 60 /MOD 24 /MOD ;
\ For DAYS return DAY MONTH YEAR
: SPLIT-OFF-DATE 1461 /MOD >R SPLIT-LEAP R> 4 * + 1970 + ;
\ Return current SEC MIN HOUR DAY MONTH YEAR
: TIME&DATE SSE SPLIT-OFF-TIME SPLIT-OFF-DATE ;

/-------------------------8< ---------------------
Note this TIME&DATE is only valid between 1900 and 2100,
because it doesn't do the century exception.

You can use the timer also for timing the real time of your
programs.
timer
INCLUDE sieve1G.frt
dosieve
BYE

You spend 10 hours 23 minutes 13 seconds

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

Re: A useful program, watdoido

<7c269ab51dbbb123861fc34ddd11aedd@news.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=25791&group=comp.lang.forth#25791

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: sdwjack69@gmail.com (sjack)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Mon, 25 Dec 2023 15:36:16 +0000
Organization: novaBBS
Message-ID: <7c269ab51dbbb123861fc34ddd11aedd@news.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1119354"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: 38a45832bc9b44da212ffa4812b707acd0ff1b7c
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$GkDlsasMloyTrWNxZ1WlM.jABLrmzMdGQsOPqnMID0m4cDMfrrq1C
 by: sjack - Mon, 25 Dec 2023 15:36 UTC

looks good.

Re: A useful program, watdoido

<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26033&group=comp.lang.forth#26033

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:11cf:b0:42a:ac70:fc3c with SMTP id n15-20020a05622a11cf00b0042aac70fc3cmr42304qtk.12.1706550446540;
Mon, 29 Jan 2024 09:47:26 -0800 (PST)
X-Received: by 2002:a05:622a:130b:b0:42a:9a97:df86 with SMTP id
v11-20020a05622a130b00b0042a9a97df86mr265552qtk.6.1706550446222; Mon, 29 Jan
2024 09:47:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.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: Mon, 29 Jan 2024 09:47:25 -0800 (PST)
In-Reply-To: <nnd$688f6514$2847ddd2@e099b08a19891604>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
Subject: Re: A useful program, watdoido
From: the.beez.speaks@gmail.com (Hans Bezemer)
Injection-Date: Mon, 29 Jan 2024 17:47:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1604
 by: Hans Bezemer - Mon, 29 Jan 2024 17:47 UTC

On Saturday, December 23, 2023 at 3:33:47 PM UTC+1, none albert wrote:
> DATA TABLE ( start of month within leap period) -1
> 31 | 28 | 5m 5m 31 | 28 | 5m 5m 31 | 29 | 5m 5m
> 31 | 28 | 5m 5m , : T[] CELLS TABLE + @ ;
> \ For DAYS within leap return MONTHS
> : MONTHS >R 0 BEGIN R@ OVER T[] > WHILE 1+ REPEAT 1- RDROP ;

All days per month in a single line:
: days/month 15662003 swap 1- 2* rshift 3 and 28 or ;

Hans Bezemer

Re: A useful program, watdoido

<87zfwnwxlb.fsf@nightsong.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26034&group=comp.lang.forth#26034

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Mon, 29 Jan 2024 15:04:16 -0800
Organization: A noiseless patient Spider
Lines: 4
Message-ID: <87zfwnwxlb.fsf@nightsong.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="350730d1f650b22cf1fccb30f754f91b";
logging-data="700410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PN4DMjKQSvGJhkKhzBjqW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:O3mJ8tCPpO6XU24zb2FF/+lJZag=
sha1:ixii5D5gmDn3Rxm7DAZVMS37c4Y=
 by: Paul Rubin - Mon, 29 Jan 2024 23:04 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;

;-)

Re: A useful program, watdoido

<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26038&group=comp.lang.forth#26038

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: admin@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Tue, 30 Jan 2024 11:12:51 +0000
Organization: Dis
Lines: 12
Message-ID: <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="2c0a15d92b9c671cd31b857f587d2b04";
logging-data="1022238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186zfrRpjh5yN4igXHKsJLSvFukloOrtxo="
Cancel-Lock: sha1:ET4XXTAeUhFMy9TVqw2Ptl/psLw=
GNU: Terry Pratchett
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
 by: Kerr-Mudd, John - Tue, 30 Jan 2024 11:12 UTC

On Mon, 29 Jan 2024 15:04:16 -0800
Paul Rubin <no.email@nospam.invalid> wrote:

> Hans Bezemer <the.beez.speaks@gmail.com> writes:
> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>
> ;-)

BTDT in asm
leap years are a pain.
--
Bah, and indeed Humbug.

Re: A useful program, watdoido

<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26039&group=comp.lang.forth#26039

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: minforth@gmx.net (minforth)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Tue, 30 Jan 2024 13:33:44 +0000
Organization: novaBBS
Message-ID: <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1084957"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$UkKmDuZC5QkCJLSaWzjJKOB9C8u3paKcPKazzVcOT9MtsyfQgtwXu
X-Rslight-Posting-User: d2a19558f194e2f1f8393b8d9be9ef51734a4da3
 by: minforth - Tue, 30 Jan 2024 13:33 UTC

Kerr-Mudd, John wrote:

> On Mon, 29 Jan 2024 15:04:16 -0800
> Paul Rubin <no.email@nospam.invalid> wrote:

>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>
>> ;-)

> BTDT in asm
> leap years are a pain.

ASM might be better, but probably not worth the pain.

Even my dumb compiler (TOS cached) already translates this to:

┌────────────────────────┐
│ MinForth V3.6 - 64 bit │
└────────────────────────┘
Stacks: d:1024 r:512 f:128
Unused: 199M
# see days/month
C DAYS/MONTH <799>
0000000000406242 <mf_DAYSslashMONTH>:
406242: 4c 89 e0 mov %r12,%rax
406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
406250: 49 89 c4 mov %rax,%r12
406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
40625e: 4d 89 27 mov %r12,(%r15)
406261: 41 bc 03 00 00 00 mov $0x3,%r12d
406267: 49 8b 07 mov (%r15),%rax
40626a: 83 e0 03 and $0x3,%eax
40626d: 49 89 07 mov %rax,(%r15)
406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
406276: 49 89 c4 mov %rax,%r12
406279: 49 83 cc 1c or $0x1c,%r12
40627d: c3 retq

Re: A useful program, watdoido

<20240131094016.7e034e5560e3952599a13401@127.0.0.1>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26043&group=comp.lang.forth#26043

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: admin@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 09:40:16 +0000
Organization: Dis
Lines: 50
Message-ID: <20240131094016.7e034e5560e3952599a13401@127.0.0.1>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="bc1f3307b366ff986626ea31fa075d8c";
logging-data="1537741"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fnowSLu/2HA9Lg6TOKvkesszxbnGTF1E="
Cancel-Lock: sha1:F9vPVNcKCebj6mTNbLCGpgZDB7U=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 31 Jan 2024 09:40 UTC

On Tue, 30 Jan 2024 13:33:44 +0000
minforth@gmx.net (minforth) wrote:

> Kerr-Mudd, John wrote:
>
> > On Mon, 29 Jan 2024 15:04:16 -0800
> > Paul Rubin <no.email@nospam.invalid> wrote:
>
> >> Hans Bezemer <the.beez.speaks@gmail.com> writes:
> >> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
> >>
> >> ;-)
>
> > BTDT in asm
> > leap years are a pain.
>
> ASM might be better, but probably not worth the pain.

I'm more comfortable in asm than forth!
The pain is taking care to deal with leap centuries.

> Even my dumb compiler (TOS cached) already translates this to:
>
> ┌────────────────────────┐
> │ MinForth V3.6 - 64 bit │
> └────────────────────────┘
> Stacks: d:1024 r:512 f:128
> Unused: 199M
> # see days/month
> C DAYS/MONTH <799>
> 0000000000406242 <mf_DAYSslashMONTH>:
> 406242: 4c 89 e0 mov %r12,%rax
> 406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
> 406250: 49 89 c4 mov %rax,%r12
> 406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
> 40625e: 4d 89 27 mov %r12,(%r15)
> 406261: 41 bc 03 00 00 00 mov $0x3,%r12d
> 406267: 49 8b 07 mov (%r15),%rax
> 40626a: 83 e0 03 and $0x3,%eax
> 40626d: 49 89 07 mov %rax,(%r15)
> 406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
> 406276: 49 89 c4 mov %rax,%r12
> 406279: 49 83 cc 1c or $0x1c,%r12
> 40627d: c3 retq

--
Bah, and indeed Humbug.

Re: A useful program, watdoido

<upd5f5$1f2mm$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26045&group=comp.lang.forth#26045

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxf)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 20:55:50 +1100
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <upd5f5$1f2mm$1@dont-email.me>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<20240131094016.7e034e5560e3952599a13401@127.0.0.1>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 31 Jan 2024 09:55:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b18a34d696434235a9c1776e3e5bfc3c";
logging-data="1542870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FRnrR5p4ZdoSxRUeEX4tY"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wAMJRP49XVQ16mCJ3z01fpUSuvg=
Content-Language: en-GB
In-Reply-To: <20240131094016.7e034e5560e3952599a13401@127.0.0.1>
 by: dxf - Wed, 31 Jan 2024 09:55 UTC

On 31/01/2024 8:40 pm, Kerr-Mudd, John wrote:
> On Tue, 30 Jan 2024 13:33:44 +0000
> minforth@gmx.net (minforth) wrote:
>
>> Kerr-Mudd, John wrote:
>>
>>> On Mon, 29 Jan 2024 15:04:16 -0800
>>> Paul Rubin <no.email@nospam.invalid> wrote:
>>
>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>>>
>>>> ;-)
>>
>>> BTDT in asm
>>> leap years are a pain.
>>
>> ASM might be better, but probably not worth the pain.
>
>
> I'm more comfortable in asm than forth!
> ...

Wasn't it the idea that Forth was easier than assembler?
I can see how ANS-Forth turned that around :)

Re: A useful program, watdoido

<2024Jan31.105910@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26046&group=comp.lang.forth#26046

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 09:59:10 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 113
Message-ID: <2024Jan31.105910@mips.complang.tuwien.ac.at>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
Injection-Info: dont-email.me; posting-host="b9c5437e8ad9a4977a884e846f828897";
logging-data="1558878"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cfCzxTPraB22ziybwSgvA"
Cancel-Lock: sha1:sD3JCEMiqWPeJMRRaP8N88dkiRU=
X-newsreader: xrn 10.11
 by: Anton Ertl - Wed, 31 Jan 2024 09:59 UTC

minforth@gmx.net (minforth) writes:
>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
....
>Even my dumb compiler (TOS cached) already translates this to:
....
>0000000000406242 <mf_DAYSslashMONTH>:
> 406242: 4c 89 e0 mov %r12,%rax
> 406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
> 406250: 49 89 c4 mov %rax,%r12
> 406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
> 40625e: 4d 89 27 mov %r12,(%r15)
> 406261: 41 bc 03 00 00 00 mov $0x3,%r12d
> 406267: 49 8b 07 mov (%r15),%rax
> 40626a: 83 e0 03 and $0x3,%eax
> 40626d: 49 89 07 mov %rax,(%r15)
> 406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
> 406276: 49 89 c4 mov %rax,%r12
> 406279: 49 83 cc 1c or $0x1c,%r12
> 40627d: c3 retq

Yes, this is a case (straight-line code) where existing Forth systems
do well. Let's see:

gforth-fast (development):
$7FA5FDC99158 lit 1->2
$7FA5FDC99160 #15662003
7FA5FD93F812: mov r15,$08[rbx]
$7FA5FDC99168 swap 2->1
7FA5FD93F816: mov $00[r13],r15
7FA5FD93F81A: sub r13,$08
$7FA5FDC99170 1- 1->1
7FA5FD93F81E: sub r8,$01
$7FA5FDC99178 2* 1->1
7FA5FD93F822: add r8,r8
$7FA5FDC99180 rshift 1->1
7FA5FD93F825: mov rax,$08[r13]
7FA5FD93F829: mov ecx,r8d
7FA5FD93F82C: add r13,$08
7FA5FD93F830: shr rax,CL
7FA5FD93F833: mov r8,rax
$7FA5FDC99188 lit and 1->1
$7FA5FDC99190 #3
$7FA5FDC99198 and
7FA5FD93F836: add rbx,$48
7FA5FD93F83A: and r8,-$10[rbx]
$7FA5FDC991A0 lit 1->2
$7FA5FDC991A8 #28
7FA5FD93F83E: mov r15,$08[rbx]
$7FA5FDC991B0 or 2->1
7FA5FD93F842: or r8,r15
$7FA5FDC991B8 ;s 1->1
7FA5FD93F845: mov rbx,[r14]
7FA5FD93F848: add r14,$08
7FA5FD93F84C: mov rax,[rbx]
7FA5FD93F84F: jmp eax

iforth lxf SwiftForth x64 vfx64
pop rbx dec ebx -8 [RBP] RBP LEA DEC RBX
lea rbx, [rbx -1 +] shl ebx, 1h EEFBB3 # 0 [RBP] MOV SHL RBX, #1
lea rbx, [rbx*2 0 +] mov eax, #EEFBB3h RBX DEC MOV RCX, RBX
mov rcx, rbx mov ecx, ebx RBX SHL MOV EBX, #00EEFBB3
mov rbx, $00EEFBB3 d# shr eax, cl RBX RCX MOV SHR RBX, CL
shr rbx, cl and eax, #3h 0 [RBP] RBX MOV AND RBX, #03
and rbx, 3 b# or eax, #1Ch 8 [RBP] RBP LEA OR RBX, #1C
or rbx, #28 b# mov ebx, eax RBX CL SHR RET/NEXT
push rbx ret near 3 # RBX AND
; 1C # RBX OR
RET

- 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 2023: https://euro.theforth.net/2023

Re: A useful program, watdoido

<nnd$393e3dc7$1944f902@a1696b33ea2b8b32>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26049&group=comp.lang.forth#26049

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
From: albert@spenarnc.xs4all.nl
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$393e3dc7$1944f902@a1696b33ea2b8b32>
Organization: KPN B.V.
Date: Wed, 31 Jan 2024 12:14:22 +0100
Path: i2pn2.org!i2pn.org!news.chmurka.net!nntp.terraraq.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 25
Injection-Date: Wed, 31 Jan 2024 12:14:22 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1726
 by: albert@spenarnc.xs4all.nl - Wed, 31 Jan 2024 11:14 UTC

In article <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>,
Kerr-Mudd, John <admin@127.0.0.1> wrote:
>On Mon, 29 Jan 2024 15:04:16 -0800
>Paul Rubin <no.email@nospam.invalid> wrote:
>
>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>
>> ;-)
>
>BTDT in asm
>leap years are a pain.

I have ignored the exception ending with 00 ciforth.
So my DAT&TIME has a year 2100 problem.
Now it fits neatly on one screen based on the __NR_time system
call, (seconds in epoch).

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -

Re: A useful program, watdoido

<20240131125246.ff213cd7ae2297fff3ab17c8@127.0.0.1>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26050&group=comp.lang.forth#26050

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: admin@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 12:52:46 +0000
Organization: Dis
Lines: 37
Message-ID: <20240131125246.ff213cd7ae2297fff3ab17c8@127.0.0.1>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<20240131094016.7e034e5560e3952599a13401@127.0.0.1>
<upd5f5$1f2mm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="bc1f3307b366ff986626ea31fa075d8c";
logging-data="1600009"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194++tvf0AU/Ts0+ECrGpQUNR465QoNotI="
Cancel-Lock: sha1:pQXp38roLk2lNVWR8xknA+Tz9MM=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 31 Jan 2024 12:52 UTC

On Wed, 31 Jan 2024 20:55:50 +1100
dxf <dxforth@gmail.com> wrote:

> On 31/01/2024 8:40 pm, Kerr-Mudd, John wrote:
> > On Tue, 30 Jan 2024 13:33:44 +0000
> > minforth@gmx.net (minforth) wrote:
> >
> >> Kerr-Mudd, John wrote:
> >>
> >>> On Mon, 29 Jan 2024 15:04:16 -0800
> >>> Paul Rubin <no.email@nospam.invalid> wrote:
> >>
> >>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
> >>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
> >>>>
> >>>> ;-)
> >>
> >>> BTDT in asm
> >>> leap years are a pain.
> >>
> >> ASM might be better, but probably not worth the pain.
> >
> >
> > I'm more comfortable in asm than forth!
> > ...
>
> Wasn't it the idea that Forth was easier than assembler?
> I can see how ANS-Forth turned that around :)
>

Somehow getting new stuff into my brain is getting hardwer; Forth has so
/many/ words. I learnt x86 (up to a usable standard, I'm not an expert)
ages back.

--
Bah, and indeed Humbug.

Re: A useful program, watdoido

<b7ceb93c9a2c2eace8fe8296a390888e@www.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26052&group=comp.lang.forth#26052

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: minforth@gmx.net (minforth)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 14:41:02 +0000
Organization: novaBBS
Message-ID: <b7ceb93c9a2c2eace8fe8296a390888e@www.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <20240131094016.7e034e5560e3952599a13401@127.0.0.1> <upd5f5$1f2mm$1@dont-email.me> <20240131125246.ff213cd7ae2297fff3ab17c8@127.0.0.1>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1206392"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: d2a19558f194e2f1f8393b8d9be9ef51734a4da3
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Site: $2y$10$HDWM8XkTc7757mRSwfOo0eEc/ckZ1cz8cAZ/XMuUz/04kl342ySNm
 by: minforth - Wed, 31 Jan 2024 14:41 UTC

Kerr-Mudd, John wrote:
>> Wasn't it the idea that Forth was easier than assembler?
>> I can see how ANS-Forth turned that around :)
>>

> Somehow getting new stuff into my brain is getting hardwer; Forth has so
> /many/ words. I learnt x86 (up to a usable standard, I'm not an expert)
> ages back.

CPU types and OS generations are constantly changing. You can't (re)learn
everything and constantly chase after it over decades.

An assembler is obsolete after a few years. And what use is a racehorse
if you can't maintain it after a while?

That's why we switched to a C-based Forth system a long time ago. This
made porting to new platforms much easier. Hand-optimised assembler words
are still possible, but practically never necessary (except for some
hardware drivers). This horse runs fast enough.

Re: A useful program, watdoido

<2024Jan31.180137@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26053&group=comp.lang.forth#26053

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 17:01:37 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 44
Message-ID: <2024Jan31.180137@mips.complang.tuwien.ac.at>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <20240131094016.7e034e5560e3952599a13401@127.0.0.1> <upd5f5$1f2mm$1@dont-email.me>
Injection-Info: dont-email.me; posting-host="b9c5437e8ad9a4977a884e846f828897";
logging-data="1706905"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+prZBqDrQ0FhCE4grj8Lif"
Cancel-Lock: sha1:bPIWy2I75UCasLj7S2+65fGZwGY=
X-newsreader: xrn 10.11
 by: Anton Ertl - Wed, 31 Jan 2024 17:01 UTC

dxf <dxforth@gmail.com> writes:
>On 31/01/2024 8:40 pm, Kerr-Mudd, John wrote:
>> On Tue, 30 Jan 2024 13:33:44 +0000
>> minforth@gmx.net (minforth) wrote:
>>
>>> Kerr-Mudd, John wrote:
>>>
>>>> On Mon, 29 Jan 2024 15:04:16 -0800
>>>> Paul Rubin <no.email@nospam.invalid> wrote:
>>>
>>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>>>>
>>>>> ;-)
>>>
>>>> BTDT in asm
>>>> leap years are a pain.
>>>
>>> ASM might be better, but probably not worth the pain.
>>
>>
>> I'm more comfortable in asm than forth!
>> ...
>
>Wasn't it the idea that Forth was easier than assembler?

And it is for Hans Bezemer, while Kerr-Mudd, John is more comfortable
in "x86" asm.

>I can see how ANS-Forth turned that around :)

I doubt that the comfort level of Kerr-Mudd, John is related to the
Forth dialect.

Anyway, taking your comment at face value, please present a version of
days/month above in your favourite Forth dialect so that we can
see the difference for ourselves.

- 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 2023: https://euro.theforth.net/2023

Re: A useful program, watdoido

<20240131195138.b2fbdf6f9e38c0b101d7072c@127.0.0.1>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26054&group=comp.lang.forth#26054

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: admin@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 19:51:38 +0000
Organization: Dis
Lines: 52
Message-ID: <20240131195138.b2fbdf6f9e38c0b101d7072c@127.0.0.1>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<20240131094016.7e034e5560e3952599a13401@127.0.0.1>
<upd5f5$1f2mm$1@dont-email.me>
<2024Jan31.180137@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="bc1f3307b366ff986626ea31fa075d8c";
logging-data="1758301"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ADiyKvSFbxp/S+amQfa/L6ErG7E+NjV8="
Cancel-Lock: sha1:7EPqXKm4AtnwBfzhgRilDTFANhY=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 31 Jan 2024 19:51 UTC

On Wed, 31 Jan 2024 17:01:37 GMT
anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:

> dxf <dxforth@gmail.com> writes:
> >On 31/01/2024 8:40 pm, Kerr-Mudd, John wrote:
> >> On Tue, 30 Jan 2024 13:33:44 +0000
> >> minforth@gmx.net (minforth) wrote:
> >>
> >>> Kerr-Mudd, John wrote:
> >>>
> >>>> On Mon, 29 Jan 2024 15:04:16 -0800
> >>>> Paul Rubin <no.email@nospam.invalid> wrote:
> >>>
> >>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
> >>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
> >>>>>
> >>>>> ;-)
> >>>
> >>>> BTDT in asm
> >>>> leap years are a pain.
> >>>
> >>> ASM might be better, but probably not worth the pain.
> >>
> >>
> >> I'm more comfortable in asm than forth!
> >> ...
> >
> >Wasn't it the idea that Forth was easier than assembler?
>
> And it is for Hans Bezemer, while Kerr-Mudd, John is more comfortable
> in "x86" asm.
>
> >I can see how ANS-Forth turned that around :)
>
> I doubt that the comfort level of Kerr-Mudd, John is related to the
> Forth dialect.

True - call me John if you want (or newbie forther or whatever) - it's a
bit of an embarrassing pseudonym, but I've had it for years.

>
> Anyway, taking your comment at face value, please present a version of
> days/month above in your favourite Forth dialect so that we can
> see the difference for ourselves.
>

My 8086 asm calendar program can be seen in clax, if you're keen enough and
willing to dig back a year or 2.
It also uses a magic number for days per month, but I 'm pretty sure I
stole^w borrowed it from somewhere else.
--
Bah, and indeed Humbug.

Re: A useful program, watdoido

<9161843a85bc18e374da3f44cf4e0a42@www.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26055&group=comp.lang.forth#26055

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 21:52:13 +0000
Organization: novaBBS
Message-ID: <9161843a85bc18e374da3f44cf4e0a42@www.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <nnd$393e3dc7$1944f902@a1696b33ea2b8b32>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1243595"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$tAKcLUEz5O86a0z.Vd0R/ezJS2QNN/0BBYhhK1RRvv1pmZL.Jicvm
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: mhx - Wed, 31 Jan 2024 21:52 UTC

> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;

Fun fact: The number 15662003 is the identifier for senile dementia.
( https://bioportal.bioontology.org/ontologies )

-marcel

Re: A useful program, watdoido

<8ba85b2cadae6188117ffca4ceab28d6@www.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26056&group=comp.lang.forth#26056

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Wed, 31 Jan 2024 22:03:05 +0000
Organization: novaBBS
Message-ID: <8ba85b2cadae6188117ffca4ceab28d6@www.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <nnd$393e3dc7$1944f902@a1696b33ea2b8b32> <9161843a85bc18e374da3f44cf4e0a42@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1244365"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
X-Rslight-Site: $2y$10$0kh8X2Dv9h0zZQo1ZXVjdOfaK1/eQtHkIaNsdCwNHTju5T2dNq32a
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: mhx - Wed, 31 Jan 2024 22:03 UTC

mhx wrote:

>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;

Somebody beat me to this much easier to understand improvement ...

It is of course possible to fit a polynomial through
the points in the table:

-( 11 x^11)/907200
+( 163 x^10)/181440
-( 37 x^9 )/1260
+( 13481 x^8 )/24192
-( 2055371 x^7 )/302400
+( 240683 x^6 )/4320
-( 28268521 x^5 )/90720
+( 85774775 x^4 )/72576
-(446998571 x^3 )/151200
+( 46351537 x^2 )/10080
-( 221017 x )/56
+1416

And now it also works for the month between January and February.

-marcel

Re: A useful program, watdoido

<upeigu$1n4af$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26057&group=comp.lang.forth#26057

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!nntp.comgw.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxf)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 1 Feb 2024 09:44:48 +1100
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <upeigu$1n4af$1@dont-email.me>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<20240131094016.7e034e5560e3952599a13401@127.0.0.1>
<upd5f5$1f2mm$1@dont-email.me> <2024Jan31.180137@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 31 Jan 2024 22:44:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b18a34d696434235a9c1776e3e5bfc3c";
logging-data="1806671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18MJmGg8gAot1o+YSEXw10M"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/lD/swg078cJAcu2Da1NeiqytjE=
In-Reply-To: <2024Jan31.180137@mips.complang.tuwien.ac.at>
Content-Language: en-GB
 by: dxf - Wed, 31 Jan 2024 22:44 UTC

On 1/02/2024 4:01 am, Anton Ertl wrote:
> dxf <dxforth@gmail.com> writes:
>> On 31/01/2024 8:40 pm, Kerr-Mudd, John wrote:
>>> On Tue, 30 Jan 2024 13:33:44 +0000
>>> minforth@gmx.net (minforth) wrote:
>>>
>>>> Kerr-Mudd, John wrote:
>>>>
>>>>> On Mon, 29 Jan 2024 15:04:16 -0800
>>>>> Paul Rubin <no.email@nospam.invalid> wrote:
>>>>
>>>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>>>>>
>>>>>> ;-)
>>>>
>>>>> BTDT in asm
>>>>> leap years are a pain.
>>>>
>>>> ASM might be better, but probably not worth the pain.
>>>
>>>
>>> I'm more comfortable in asm than forth!
>>> ...
>>
>> Wasn't it the idea that Forth was easier than assembler?
>
> And it is for Hans Bezemer, while Kerr-Mudd, John is more comfortable
> in "x86" asm.
>
>> I can see how ANS-Forth turned that around :)
>
> I doubt that the comfort level of Kerr-Mudd, John is related to the
> Forth dialect.

Perhaps not, but for me it does. Let's talk about expectations since
we all have them.

A non-Forth programmer acquaintance said he thought it (Forth) wasn't
a HLL at all - more like assembler (and he was well-versed in asm).
Apparently even asm coders have expectations and straying too far
doesn't go down well. Hence prefix assemblers in forth, $ prefix
to denote a hex number, recognizers etc. When Mitch Bradley suggested
parsers h# f# for hex and float respectively one could hear the
proverbial pin drop. Personally I'd wear it in a forth environment but
finding another so-inclined would be difficult. Harder still would be
finding an app end-user that tolerated Albert's approach to command-line
parsing. Giving end-users what they expect is the best policy. They
don't care what language the app was written in or in making things easy
for the programmer.

Re: A useful program, watdoido

<upet0u$1onlf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26058&group=comp.lang.forth#26058

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxf)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 1 Feb 2024 12:43:58 +1100
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <upet0u$1onlf$1@dont-email.me>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<20240131094016.7e034e5560e3952599a13401@127.0.0.1>
<upd5f5$1f2mm$1@dont-email.me>
<20240131125246.ff213cd7ae2297fff3ab17c8@127.0.0.1>
<b7ceb93c9a2c2eace8fe8296a390888e@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Feb 2024 01:43:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f9eae7a4206404f9520533fcab906d9d";
logging-data="1859247"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EMxmu/ftQDVerqCzJFHLI"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:s9lPXehYrfP7n8GeWdcpNnvH88Y=
Content-Language: en-GB
In-Reply-To: <b7ceb93c9a2c2eace8fe8296a390888e@www.novabbs.com>
 by: dxf - Thu, 1 Feb 2024 01:43 UTC

On 1/02/2024 1:41 am, minforth wrote:
> Kerr-Mudd, John wrote:
>>> Wasn't it the idea that Forth was easier than assembler?
>>> I can see how ANS-Forth turned that around :)
>>>
>
>> Somehow getting new stuff into my brain is getting hardwer; Forth has so
>> /many/ words. I learnt x86 (up to a usable standard, I'm not an expert)
>> ages back.
>
> CPU types and OS generations are constantly changing. You can't (re)learn
> everything and constantly chase after it over decades.
>
> An assembler is obsolete after a few years. And what use is a racehorse
> if you can't maintain it after a while?
>
> That's why we switched to a C-based Forth system a long time ago. This
> made porting to new platforms much easier. Hand-optimised assembler words
> are still possible, but practically never necessary (except for some
> hardware drivers). This horse runs fast enough.

Forth jockey to C horse: 'Winning isn't everything'.

Re: A useful program, watdoido

<upfjl6$1vmfh$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26059&group=comp.lang.forth#26059

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.samoylyk.net!hugayda.aid.in.ua!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: do-not-use@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 1 Feb 2024 08:10:14 +0000
Organization: A noiseless patient Spider
Lines: 85
Message-ID: <upfjl6$1vmfh$1@dont-email.me>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<2024Jan31.105910@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Feb 2024 08:10:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8065e6a07c219b5d2639ccab97ad296e";
logging-data="2087409"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sx4rpSHoUEm9PPUQZ6Gy6clHSas9dzpw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ITgGH35tKMfdAQKZLVaon/IEOZ4=
Content-Language: en-GB
In-Reply-To: <2024Jan31.105910@mips.complang.tuwien.ac.at>
 by: Gerry Jackson - Thu, 1 Feb 2024 08:10 UTC

On 31/01/2024 09:59, Anton Ertl wrote:
> minforth@gmx.net (minforth) writes:
>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
> ...
>> Even my dumb compiler (TOS cached) already translates this to:
> ...
>> 0000000000406242 <mf_DAYSslashMONTH>:
>> 406242: 4c 89 e0 mov %r12,%rax
>> 406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
>> 40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
>> 406250: 49 89 c4 mov %rax,%r12
>> 406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
>> 406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
>> 40625e: 4d 89 27 mov %r12,(%r15)
>> 406261: 41 bc 03 00 00 00 mov $0x3,%r12d
>> 406267: 49 8b 07 mov (%r15),%rax
>> 40626a: 83 e0 03 and $0x3,%eax
>> 40626d: 49 89 07 mov %rax,(%r15)
>> 406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
>> 406276: 49 89 c4 mov %rax,%r12
>> 406279: 49 83 cc 1c or $0x1c,%r12
>> 40627d: c3 retq
>
> Yes, this is a case (straight-line code) where existing Forth systems
> do well. Let's see:
>
> gforth-fast (development):
> $7FA5FDC99158 lit 1->2
> $7FA5FDC99160 #15662003
> 7FA5FD93F812: mov r15,$08[rbx]
> $7FA5FDC99168 swap 2->1
> 7FA5FD93F816: mov $00[r13],r15
> 7FA5FD93F81A: sub r13,$08
> $7FA5FDC99170 1- 1->1
> 7FA5FD93F81E: sub r8,$01
> $7FA5FDC99178 2* 1->1
> 7FA5FD93F822: add r8,r8
> $7FA5FDC99180 rshift 1->1
> 7FA5FD93F825: mov rax,$08[r13]
> 7FA5FD93F829: mov ecx,r8d
> 7FA5FD93F82C: add r13,$08
> 7FA5FD93F830: shr rax,CL
> 7FA5FD93F833: mov r8,rax
> $7FA5FDC99188 lit and 1->1
> $7FA5FDC99190 #3
> $7FA5FDC99198 and
> 7FA5FD93F836: add rbx,$48
> 7FA5FD93F83A: and r8,-$10[rbx]
> $7FA5FDC991A0 lit 1->2
> $7FA5FDC991A8 #28
> 7FA5FD93F83E: mov r15,$08[rbx]
> $7FA5FDC991B0 or 2->1
> 7FA5FD93F842: or r8,r15
> $7FA5FDC991B8 ;s 1->1
> 7FA5FD93F845: mov rbx,[r14]
> 7FA5FD93F848: add r14,$08
> 7FA5FD93F84C: mov rax,[rbx]
> 7FA5FD93F84F: jmp eax
>
> iforth lxf SwiftForth x64 vfx64
> pop rbx dec ebx -8 [RBP] RBP LEA DEC RBX
> lea rbx, [rbx -1 +] shl ebx, 1h EEFBB3 # 0 [RBP] MOV SHL RBX, #1
> lea rbx, [rbx*2 0 +] mov eax, #EEFBB3h RBX DEC MOV RCX, RBX
> mov rcx, rbx mov ecx, ebx RBX SHL MOV EBX, #00EEFBB3
> mov rbx, $00EEFBB3 d# shr eax, cl RBX RCX MOV SHR RBX, CL
> shr rbx, cl and eax, #3h 0 [RBP] RBX MOV AND RBX, #03
> and rbx, 3 b# or eax, #1Ch 8 [RBP] RBP LEA OR RBX, #1C
> or rbx, #28 b# mov ebx, eax RBX CL SHR RET/NEXT
> push rbx ret near 3 # RBX AND
> ; 1C # RBX OR
> RET
>
> - anton
>

How does this simple lookup solution compare?

: d/m s\" 0\x1f\x1c\x1f\x1e\x1f\x1e\x1f\x1f\x1e\x1f\x1e\x1f" drop + c@ ;
: x 13 1 do i d/m . loop ;
x 31 28 31 30 31 30 31 31 30 31 30 31 ok

--
Gerry

Re: A useful program, watdoido

<2024Feb1.093235@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26060&group=comp.lang.forth#26060

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 01 Feb 2024 08:32:35 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 89
Message-ID: <2024Feb1.093235@mips.complang.tuwien.ac.at>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <2024Jan31.105910@mips.complang.tuwien.ac.at> <upfjl6$1vmfh$1@dont-email.me>
Injection-Info: dont-email.me; posting-host="f54ff99fffdfa97baf3183cf01df2f39";
logging-data="2104425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/l74lXGJ2CxNSN24GY8k6Q"
Cancel-Lock: sha1:MighSZ/s3vSvkIjQ/5H+Ek+p/80=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 1 Feb 2024 08:32 UTC

Gerry Jackson <do-not-use@swldwa.uk> writes:
>On 31/01/2024 09:59, Anton Ertl wrote:
>> minforth@gmx.net (minforth) writes:
>>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
....
>How does this simple lookup solution compare?
>
>: d/m s\" 0\x1f\x1c\x1f\x1e\x1f\x1e\x1f\x1f\x1e\x1f\x1e\x1f" drop + c@ ;
>: x 13 1 do i d/m . loop ;
>x 31 28 31 30 31 30 31 31 30 31 30 31 ok

In Gforth, very well:

days/month d/m
lit 1->2 lit+ 1->1
#15662003 $7F58DC846E10
mov r15,$08[rbx] add r8,$08[rbx]
swap 2->1 c@ 1->1
mov $00[r13],r15 movzx r8d,byte PTR [r8]
sub r13,$08 ;s 1->1
1- 1->1 mov rbx,[r14]
sub r8,$01 add r14,$08
2* 1->1 mov rax,[rbx]
add r8,r8 jmp eax
rshift 1->1
mov rax,$08[r13]
mov ecx,r8d
add r13,$08
shr rax,CL
mov r8,rax
lit and 1->1
#3
and
add rbx,$48
and r8,-$10[rbx]
lit 1->2
#28
mov r15,$08[rbx]
or 2->1
or r8,r15
;s 1->1
mov rbx,[r14]
add r14,$08
mov rax,[rbx]
jmp eax

The 12 bytes of data vanishes against the reduced threaded-code and
native-code size.

For the other systems:

days/month
iforth lxf SwiftForth x64 vfx64
pop rbx dec ebx -8 [RBP] RBP LEA DEC RBX
lea rbx, [rbx -1 +] shl ebx, 1h EEFBB3 # 0 [RBP] MOV SHL RBX, #1
lea rbx, [rbx*2 0 +] mov eax, #EEFBB3h RBX DEC MOV RCX, RBX
mov rcx, rbx mov ecx, ebx RBX SHL MOV EBX, #00EEFBB3
mov rbx, $00EEFBB3 d# shr eax, cl RBX RCX MOV SHR RBX, CL
shr rbx, cl and eax, #3h 0 [RBP] RBX MOV AND RBX, #03
and rbx, 3 b# or eax, #1Ch 8 [RBP] RBP LEA OR RBX, #1C
or rbx, #28 b# mov ebx, eax RBX CL SHR RET/NEXT
push rbx ret near 3 # RBX AND
; 1C # RBX OR
RET

iforth SwiftForth x64 vfx64
pop rbx 40664E ( (S") ) CALL CALL 004256C0 (S") "0"
movzx rdi, [rbx $... +] "0" MOV RBX, [RBP]
push rdi 0 [RBP] RBX MOV ADD RBX, [RBP+08]
8 [RBP] RBP LEA MOVZX RBX, Byte 0 [RBX]
0 [RBP] RBX ADD LEA RBP, [RBP+10]
8 [RBP] RBP LEA RET/NEXT
0 [RBX] RBX MOVZX
RET

Pasting into lxf does not work, and my echo-based workaround does not
work in this example, either.

Your solution works great in Gforth and iForth, but S\" (and S") is
not that great in SwiftForth and VFX. Better use CREATE for the
table.

- 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 2023: https://euro.theforth.net/2023

Re: A useful program, watdoido

<nnd$08f96222$3b8faeb9@ceaa621099c58433>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26062&group=comp.lang.forth#26062

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <87zfwnwxlb.fsf@nightsong.com> <20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
From: albert@spenarnc.xs4all.nl
Subject: Re: A useful program, watdoido
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$08f96222$3b8faeb9@ceaa621099c58433>
Organization: KPN B.V.
Date: Thu, 01 Feb 2024 12:24:46 +0100
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feed.abavia.com!abe005.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 59
Injection-Date: Thu, 01 Feb 2024 12:24:46 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: albert@spenarnc.xs4all.nl - Thu, 1 Feb 2024 11:24 UTC

In article <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>,
minforth <minforth@gmx.net> wrote:
>Kerr-Mudd, John wrote:
>
>> On Mon, 29 Jan 2024 15:04:16 -0800
>> Paul Rubin <no.email@nospam.invalid> wrote:
>
>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>> > : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>>>
>>> ;-)
>
>> BTDT in asm
>> leap years are a pain.
>
>ASM might be better, but probably not worth the pain.
>
>Even my dumb compiler (TOS cached) already translates this to:
>
>┌────────────────────────┐
>│ MinForth V3.6 - 64 bit │
>└────────────────────────┘
>Stacks: d:1024 r:512 f:128
>Unused: 199M
># see days/month
>C DAYS/MONTH <799>
>0000000000406242 <mf_DAYSslashMONTH>:
> 406242: 4c 89 e0 mov %r12,%rax
> 406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
> 406250: 49 89 c4 mov %rax,%r12
> 406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
> 406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
> 40625e: 4d 89 27 mov %r12,(%r15)
> 406261: 41 bc 03 00 00 00 mov $0x3,%r12d
> 406267: 49 8b 07 mov (%r15),%rax
> 40626a: 83 e0 03 and $0x3,%eax
> 40626d: 49 89 07 mov %rax,(%r15)
> 406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
> 406276: 49 89 c4 mov %rax,%r12
> 406279: 49 83 cc 1c or $0x1c,%r12
> 40627d: c3 retq

There is a guy names Smith (smith and Jones) who does a Forth in Hex/
machinelanguage. He looks up individual instructions in the Pentium
manuals, the way Chuck Moore does it.
It is a pretty complete Forth.

https://dacvs.neocities.org/SF/

(I found it at Reddit. There is interesting stuff there.)

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -

Re: A useful program, watdoido

<nnd$4971326f$757e83ff@ceaa621099c58433>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26063&group=comp.lang.forth#26063

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <2024Jan31.105910@mips.complang.tuwien.ac.at> <upfjl6$1vmfh$1@dont-email.me>
From: albert@spenarnc.xs4all.nl
Subject: Re: A useful program, watdoido
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$4971326f$757e83ff@ceaa621099c58433>
Organization: KPN B.V.
Date: Thu, 01 Feb 2024 12:27:52 +0100
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.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: 100
Injection-Date: Thu, 01 Feb 2024 12:27:52 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 5005
 by: albert@spenarnc.xs4all.nl - Thu, 1 Feb 2024 11:27 UTC

In article <upfjl6$1vmfh$1@dont-email.me>,
Gerry Jackson <do-not-use@swldwa.uk> wrote:
>On 31/01/2024 09:59, Anton Ertl wrote:
>> minforth@gmx.net (minforth) writes:
>>>>> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>>>>> : days/month 15662003 swap 1- 2* rshift 3 and 28 or ;
>> ...
>>> Even my dumb compiler (TOS cached) already translates this to:
>> ...
>>> 0000000000406242 <mf_DAYSslashMONTH>:
>>> 406242: 4c 89 e0 mov %r12,%rax
>>> 406245: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
>>> 40624b: 48 8d 44 00 fe lea -0x2(%rax,%rax,1),%rax
>>> 406250: 49 89 c4 mov %rax,%r12
>>> 406253: 41 bc b3 fb ee 00 mov $0xeefbb3,%r12d
>>> 406259: c4 42 fb f7 e4 shrx %rax,%r12,%r12
>>> 40625e: 4d 89 27 mov %r12,(%r15)
>>> 406261: 41 bc 03 00 00 00 mov $0x3,%r12d
>>> 406267: 49 8b 07 mov (%r15),%rax
>>> 40626a: 83 e0 03 and $0x3,%eax
>>> 40626d: 49 89 07 mov %rax,(%r15)
>>> 406270: 41 bc 1c 00 00 00 mov $0x1c,%r12d
>>> 406276: 49 89 c4 mov %rax,%r12
>>> 406279: 49 83 cc 1c or $0x1c,%r12
>>> 40627d: c3 retq
>>
>> Yes, this is a case (straight-line code) where existing Forth systems
>> do well. Let's see:
>>
>> gforth-fast (development):
>> $7FA5FDC99158 lit 1->2
>> $7FA5FDC99160 #15662003
>> 7FA5FD93F812: mov r15,$08[rbx]
>> $7FA5FDC99168 swap 2->1
>> 7FA5FD93F816: mov $00[r13],r15
>> 7FA5FD93F81A: sub r13,$08
>> $7FA5FDC99170 1- 1->1
>> 7FA5FD93F81E: sub r8,$01
>> $7FA5FDC99178 2* 1->1
>> 7FA5FD93F822: add r8,r8
>> $7FA5FDC99180 rshift 1->1
>> 7FA5FD93F825: mov rax,$08[r13]
>> 7FA5FD93F829: mov ecx,r8d
>> 7FA5FD93F82C: add r13,$08
>> 7FA5FD93F830: shr rax,CL
>> 7FA5FD93F833: mov r8,rax
>> $7FA5FDC99188 lit and 1->1
>> $7FA5FDC99190 #3
>> $7FA5FDC99198 and
>> 7FA5FD93F836: add rbx,$48
>> 7FA5FD93F83A: and r8,-$10[rbx]
>> $7FA5FDC991A0 lit 1->2
>> $7FA5FDC991A8 #28
>> 7FA5FD93F83E: mov r15,$08[rbx]
>> $7FA5FDC991B0 or 2->1
>> 7FA5FD93F842: or r8,r15
>> $7FA5FDC991B8 ;s 1->1
>> 7FA5FD93F845: mov rbx,[r14]
>> 7FA5FD93F848: add r14,$08
>> 7FA5FD93F84C: mov rax,[rbx]
>> 7FA5FD93F84F: jmp eax
>>
>> iforth lxf SwiftForth x64 vfx64
>> pop rbx dec ebx -8 [RBP] RBP LEA DEC RBX
>> lea rbx, [rbx -1 +] shl ebx, 1h EEFBB3 # 0 [RBP] MOV SHL RBX, #1
>> lea rbx, [rbx*2 0 +] mov eax, #EEFBB3h RBX DEC MOV RCX, RBX
>> mov rcx, rbx mov ecx, ebx RBX SHL MOV EBX, #00EEFBB3
>> mov rbx, $00EEFBB3 d# shr eax, cl RBX RCX MOV SHR RBX, CL
>> shr rbx, cl and eax, #3h 0 [RBP] RBX MOV AND RBX, #03
>> and rbx, 3 b# or eax, #1Ch 8 [RBP] RBP LEA OR RBX, #1C
>> or rbx, #28 b# mov ebx, eax RBX CL SHR RET/NEXT
>> push rbx ret near 3 # RBX AND
>> ; 1C # RBX OR
>> RET
>>
>> - anton
>>
>
>How does this simple lookup solution compare?
>
>: d/m s\" 0\x1f\x1c\x1f\x1e\x1f\x1e\x1f\x1f\x1e\x1f\x1e\x1f" drop + c@ ;
>: x 13 1 do i d/m . loop ;
>x 31 28 31 30 31 30 31 31 30 31 30 31 ok

Four year period is better:
2 : | OVER , + ; : 5m 31 | 30 | 31 | 30 | 31 | ;
3 DATA TABLE ( start of month within leap period) -1
4 31 | 28 | 5m 5m 31 | 28 | 5m 5m 31 | 29 | 5m 5m
5 31 | 28 | 5m 5m , : T[] CELLS TABLE + @ ;

>
>--
>Gerry
>
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -

Re: A useful program, watdoido

<06908604d673bb6362db67f3492b310e@www.novabbs.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26067&group=comp.lang.forth#26067

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!.POSTED!not-for-mail
From: melahi_ahmed@yahoo.fr (ahmed)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 1 Feb 2024 13:48:18 +0000
Organization: novaBBS
Message-ID: <06908604d673bb6362db67f3492b310e@www.novabbs.com>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <2024Jan31.105910@mips.complang.tuwien.ac.at> <upfjl6$1vmfh$1@dont-email.me> <nnd$4971326f$757e83ff@ceaa621099c58433>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="1314793"; mail-complaints-to="usenet@i2pn2.org";
posting-account="t+lO0yBNO1zGxasPvGSZV1BRu71QKx+JE37DnW+83jQ";
User-Agent: Rocksolid Light
X-Spam-Checker-Version: SpamAssassin 4.0.0
X-Rslight-Posting-User: a55529988cdb6fa7b5e36631aef8884238b8448a
X-Rslight-Site: $2y$10$Vf0DOQkOaEZ9cCo.WtQIVujgJ0UogPU1izCNOeQyI3/1PfNPh1JRW
 by: ahmed - Thu, 1 Feb 2024 13:48 UTC

Hi,

for leap year:
: l_d/m 15662007 swap 1- 2* rshift 3 and 28 or ;

for other years:
: __d/m 15662003 swap 1- 2* rshift 3 and 28 or ; ( this is already given by H. Bezemer)

in fact:
15662003 written in base 4 gives: 323233232303 where the digits are what to add to 28 to get the days per month (beginning from the right).
15662007 written in base 4 gives: 323233232313 where the digits are what to add to 28 to get the days per month (beginning from the right).

that is what I remarked!

Bye

Re: A useful program, watdoido

<2024Feb1.173248@mips.complang.tuwien.ac.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26070&group=comp.lang.forth#26070

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Thu, 01 Feb 2024 16:32:48 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 30
Message-ID: <2024Feb1.173248@mips.complang.tuwien.ac.at>
References: <nnd$688f6514$2847ddd2@e099b08a19891604> <07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com> <2024Jan31.105910@mips.complang.tuwien.ac.at> <upfjl6$1vmfh$1@dont-email.me> <nnd$4971326f$757e83ff@ceaa621099c58433> <06908604d673bb6362db67f3492b310e@www.novabbs.com>
Injection-Info: dont-email.me; posting-host="f54ff99fffdfa97baf3183cf01df2f39";
logging-data="2265756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+zwfqtKs8p3RPegziG4ep"
Cancel-Lock: sha1:Ae39E7PPzu4rS29TtnB1XCYEgs4=
X-newsreader: xrn 10.11
 by: Anton Ertl - Thu, 1 Feb 2024 16:32 UTC

melahi_ahmed@yahoo.fr (ahmed) writes:
>Hi,
>
>for leap year:
>: l_d/m 15662007 swap 1- 2* rshift 3 and 28 or ;
>
>for other years:
>: __d/m 15662003 swap 1- 2* rshift 3 and 28 or ; ( this is already given by H. Bezemer)
>
>in fact:
> 15662003 written in base 4 gives: 323233232303 where the digits are what to add to 28 to get the days per month (beginning from the right).

Given that Forth can do base 4, this leads to a more readable variant:

: __d/m [ 4 base ! ] 323233232303 [ decimal ] swap 1- 2* rshift 3 and 28 or ;

Or we can get rid of the 1- by appending another digit. And let's
only introduce the constant when we have to, and use "+" instead of
"or" for the addition:

: __d/m 2* [ 4 base ! ] 3232332323030 [ decimal ] swap rshift 3 and 28 + ;

Or just do a byte lookup as suggested by Gerry Jackson.

- 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 2023: https://euro.theforth.net/2023

Re: A useful program, watdoido

<upi6jn$2gjdu$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=26074&group=comp.lang.forth#26074

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!nntp.comgw.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dxforth@gmail.com (dxf)
Newsgroups: comp.lang.forth
Subject: Re: A useful program, watdoido
Date: Fri, 2 Feb 2024 18:45:59 +1100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <upi6jn$2gjdu$1@dont-email.me>
References: <nnd$688f6514$2847ddd2@e099b08a19891604>
<8c3f3a01-da9b-4b2a-a89c-cfe050edf417n@googlegroups.com>
<87zfwnwxlb.fsf@nightsong.com>
<20240130111251.79cc1c8e876a8b333cdd99d6@127.0.0.1>
<07897c331ad14cc94cf96ecd1a50d97b@www.novabbs.com>
<2024Jan31.105910@mips.complang.tuwien.ac.at> <upfjl6$1vmfh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 2 Feb 2024 07:45:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0c4e87282ed3d1d91cf7d9774da8a41e";
logging-data="2641342"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rYPN+XZlq0PTmKY61rg8s"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:dsGqSmAIuXIfn9GNBEIoyfUdxnM=
Content-Language: en-GB
In-Reply-To: <upfjl6$1vmfh$1@dont-email.me>
 by: dxf - Fri, 2 Feb 2024 07:45 UTC

On 1/02/2024 7:10 pm, Gerry Jackson wrote:
> ...
> How does this simple lookup solution compare?
>
> : d/m s\" 0\x1f\x1c\x1f\x1e\x1f\x1e\x1f\x1f\x1e\x1f\x1e\x1f" drop + c@ ;
> : x 13 1 do i d/m . loop ;
> x 31 28 31 30 31 30 31 31 30 31 30 31  ok

It's a neat one-line solution with little obfuscation suitable for a 16-bit
forth (and I imagine any other).

In DX-Forth it can be defined:

:noname + c@ ; build D/M ( m -- d ) ," \1f\1c\1f\1e\1f\1e\1f\1f\1e\1f\1e\1f"

which is two bytes less and theoretically faster.

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor