Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #60163

Re: Forth Implementations advantages and disadvantages.

From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Forth Implementations advantages and disadvantages.
Date 2017-06-01 16:32 -0400
Organization A noiseless patient Spider
Message-ID <ogptec$j66$4@dont-email.me> (permalink)
References (9 earlier) <930cc033-885e-4a45-945e-f202af41f0b5@googlegroups.com> <ogpf3i$ea6$1@dont-email.me> <ogpge1$i5t$3@dont-email.me> <ogpjpd$mr$1@dont-email.me> <ogpsud$j66$1@dont-email.me>

Show all headers | View raw


rickman wrote on 6/1/2017 4:23 PM:
> Cecil Bayona wrote on 6/1/2017 1:47 PM:
>> On 6/1/2017 11:50 AM, rickman wrote:
>>> Cecil Bayona wrote on 6/1/2017 12:27 PM:
>>>> On 5/28/2017 8:25 PM, hughaguilar96@gmail.com wrote:
>>>>> On Sunday, May 28, 2017 at 2:45:19 PM UTC-7, hughag...@gmail.com wrote:
>>>>>> On Sunday, May 28, 2017 at 9:22:57 AM UTC-7, Cecil - k5nwa wrote:
>>>>>>> On 5/28/2017 12:10 AM, hughaguilar96@gmail.com wrote:
>>>>>>>> I just came up with this for a PDP11 STC off the top of my head, but it
>>>>>>>> seems like it might work:
>>>>>>>>
>>>>>>>> R0 general-purpose
>>>>>>>> R1 general-purpose
>>>>>>>> R2 top-of-stack
>>>>>>>> R3 local-frame pointer
>>>>>>>> R4 data-stack pointer
>>>>>>>> R5 double-stack pointer
>>>>>>>> R6 return-stack pointer
>>>>>>>> R7 program counter
>>>>>>> ...
>>>>>>> Thanks for reminding me about PAC (Portable Assembler Code), it changes
>>>>>>> the whole trajectory of the project, if PAC  can generate efficient code
>>>>>>> then it would be an ideal setup for this and other projects. In any case
>>>>>>> it is bound to be faster than using C.
>>>>>> ...
>>>>>> The MSP430 has 16 registers total. I would still use the PDP11 as your
>>>>>> assembly-language as I described above. You can, however, have the
>>>>>> main-program use some of the registers, and ISRs use the other registers.
>>>>>> This means that ISRs don't have to save and restore registers (assuming
>>>>>> that ISRs can't be interrupted). This should boost the speed of your
>>>>>> system considerably, as a lot of micro-controller programs spend up to
>>>>>> 50% of their time servicing interrupts. You will have to write your
>>>>>> compiler in such a way that it is able to use the correct set of
>>>>>> registers as R0..R7 depending upon whether it is compiling a colon word
>>>>>> to be used in the main-program or is compiling an ISR. This should be
>>>>>> easy. Put the functions that can be used by the main-program in one
>>>>>> vocabulary and the functions that can be used by ISRs in another
>>>>>> vocabulary, so there is no confusion if they have the same names.
>>>>>
>>>>> The more that I think about it, the more I like the PDP11 as your
>>>>> portable-assembly-language.
>>>>>
>>>>> 1.) The 8 registers of the PDP11 are adequate for a reasonable Forth
>>>>> implementation (as shown above in the register-dedication table I
>>>>> provided). You do have two general-purpose registers, so you can do
>>>>> code-optimization in which you hold values in general-purpose registers
>>>>> temporarily rather than push them to the data-stack (VFX does code
>>>>> optimization on the 32-bit x86 that has only one more register than the
>>>>> PDP11 has).
>>>>>
>>>>> 2.) On modern processors that have 16 registers (such as the MSP430), you
>>>>> can divide the registers into two banks for the main-program and the ISRs
>>>>> to significantly speed up ISRs while still allowing ISRs to be written in
>>>>> Forth. Your ISRs can't be interrupted though, because there is only one
>>>>> bank of registers available. On the PIC24 you can also have fast ISRs
>>>>> written in assembly-language that only use the lower four registers and
>>>>> are able to interrupt the lower-priority ISRs that are written in Forth.
>>>>>
>>>>> 3.) There are HDL implementations of the PDP11 already available, so if
>>>>> you want an FPGA you can use one of these as a starting point. Considering
>>>>> that you (and I) have little or no experience with HDL, it seems more
>>>>> realistic to start with an existing implementation rather than start from
>>>>> scratch.
>>>>>
>>>>> 4.) There is software available for the PDP11, such as RT11, that could
>>>>> still be useful. Your assembler should be compatible with whatever
>>>>> assembler was used to assemble the RT11 code, except that your assembler
>>>>> generates code for the MSP430, PIC24, etc.. So, if the source-code to RT11
>>>>> is available (I assume it is), you could run RT11 on an MSP430 or PIC24 or
>>>>> whatever. It will be just like a George Romero movie: the dead will rise
>>>>> and walk again!
>>>>>
>>>>
>>>> I downloaded some PDP11 programming manuals and read them over several days
>>>> and come to the conclusion the the PDP11 is not a good choice because is
>>>> has
>>>> features that a lot of modern 16 bit device do not possess mostly in the
>>>> area of addressing modes, but also unique instructions.
>>>>
>>>> The process also impressed me why I used to love the PDP11 when I first
>>>> started working with computers, my first computer I worked with was the
>>>> PDP8e and the PDP11 was such a refreshing improvement, now the 64KB direct
>>>> addressing limit is a pain.
>>>>
>>>>  Right off the bat on the PDP11 all registers are equal so any register has
>>>> all addressing modes, that is inefficient to implement in modern CPUs. The
>>>> PDP11 also has independent addressing for each of two operands so for
>>>> example an ADD instruction can have both sources to use indexed modes  for
>>>> the data for memory to memory operation while most modern CPUs uses a
>>>> register as one of the sources/destination and the other one can be indexed
>>>> but not both so in some cases it takes two instructions to do the same as
>>>> one PDP11 instruction, not the end of the world but it makes things more
>>>> complicated.
>>>>
>>>> So the choices are;
>>>>
>>>> 1, To map one instruction to many in some cases and use the PDP11
>>>> instruction set.
>>>> 2. Use a more limited CPU like the MSP430 as a guide to the instructions
>>>> instead.
>>>> 3. Just invent my own mnemonics like the Go language that maps closely to
>>>> existing CPUs.
>>>
>>> How is this distinguished from writing words in Forth?
>>
>> At some point the Forth is created by creating set of primitives word, one
>> creates Forth primitives from assembler or High level language. Even a Meta
>> compiler at some level needs words written in assembler.
>
> You keep walking all around the point where you clearly see what is going
> on.  I don't understand why you can't see it.  Yes, some assembly will
> always be required.  That is true for *EVERY* approach you define. Inventing
> an intermediate language that looks vaguely like an assembly language is no
> different than just writing a few core words in Forth.  Both ways you have
> to write some code that generates code for your target machine.

Opps, that should have been a "few core words in assembly language".

-- 

Rick C

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-26 14:49 -0500
  Re: Forth Implementations advantages and disadvantages. minforth@arcor.de - 2017-05-26 13:17 -0700
    Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-26 17:53 -0500
      Re: Forth Implementations advantages and disadvantages. Raimond Dragomir <raimond.dragomir@gmail.com> - 2017-05-26 22:31 -0700
        Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 00:57 -0500
  Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 01:09 -0400
    Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 00:59 -0500
      Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 02:09 -0400
        Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 09:35 -0500
          Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 12:22 -0400
            Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 11:53 -0500
              Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 13:13 -0400
              Re: Forth Implementations advantages and disadvantages. David Schultz <abuse@127.0.0.1> - 2017-05-27 12:24 -0500
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 13:13 -0500
                Re: Forth Implementations advantages and disadvantages. David Schultz <abuse@127.0.0.1> - 2017-05-27 13:33 -0500
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 14:53 -0400
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 14:44 -0500
                Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-28 10:09 +0200
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-28 12:57 -0400
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 12:14 -0500
                Re: Forth Implementations advantages and disadvantages. Paul Rubin <no.email@nospam.invalid> - 2017-05-28 16:11 -0700
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-29 02:11 -0400
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 01:54 -0500
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-29 03:22 -0400
    Re: Forth Implementations advantages and disadvantages. Joel Rees <joel.rees@gmail.com> - 2017-05-28 15:46 -0700
  Re: Forth Implementations advantages and disadvantages. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-27 01:23 -0500
    Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 09:29 -0500
      Re: Forth Implementations advantages and disadvantages. Paul Rubin <no.email@nospam.invalid> - 2017-05-27 11:36 -0700
        Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 14:25 -0500
      Re: Forth Implementations advantages and disadvantages. Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2017-05-27 21:58 -0400
    Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-27 11:20 -0700
      Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 15:20 -0400
      Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 14:20 -0500
        Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 18:33 -0400
          Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 18:50 -0500
            Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-27 20:13 -0400
          Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-28 10:23 +0200
            Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 12:26 -0500
              Re: Forth Implementations advantages and disadvantages. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-30 04:22 -0500
                Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-30 11:49 +0200
                Re: Forth Implementations advantages and disadvantages. Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-30 05:07 -0500
                Re: Forth Implementations advantages and disadvantages. Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-30 18:58 +0200
            Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 12:28 -0500
              Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-28 20:14 +0200
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 14:08 -0500
                Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-29 10:52 +0200
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 12:50 -0500
                Re: Forth Implementations advantages and disadvantages. Alex <alex@rivadpm.com> - 2017-05-29 19:06 +0100
        Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-27 20:00 -0700
          Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-27 22:29 -0500
            Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-27 22:10 -0700
              Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 11:22 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-28 14:45 -0700
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-28 18:25 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 21:43 -0500
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-06-01 11:27 -0500
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-06-01 12:50 -0400
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-06-01 12:47 -0500
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-06-01 16:23 -0400
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-06-01 16:32 -0400
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-06-01 12:08 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-06-01 21:47 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-06-02 06:34 -0700
                Re: Forth Implementations advantages and disadvantages. foxaudioresearch@gmail.com - 2017-06-02 07:13 -0700
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-06-02 07:57 -0700
                Re: Forth Implementations advantages and disadvantages. albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-06-03 02:17 +0200
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 21:07 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-28 21:48 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 00:52 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-29 09:17 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 12:16 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-29 19:21 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 23:13 -0500
                Re: Forth Implementations advantages and disadvantages. Paul Rubin <no.email@nospam.invalid> - 2017-05-30 01:07 -0700
                Re: Forth Implementations advantages and disadvantages. Alex <alex@rivadpm.com> - 2017-05-30 15:54 +0100
                Re: Forth Implementations advantages and disadvantages. Alex <alex@rivadpm.com> - 2017-05-29 19:02 +0100
                Re: Forth Implementations advantages and disadvantages. Raimond Dragomir <raimond.dragomir@gmail.com> - 2017-05-29 11:06 -0700
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-29 19:29 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 23:01 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-30 14:53 -0700
                Re: Forth Implementations advantages and disadvantages. Paul Rubin <no.email@nospam.invalid> - 2017-05-29 13:59 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 17:03 -0500
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-29 19:37 -0700
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-29 22:52 -0500
            Re: Forth Implementations advantages and disadvantages. Mark Wills <markwills1970@gmail.com> - 2017-05-28 11:49 -0700
              Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 14:12 -0500
              Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-29 02:35 -0400
          Re: Forth Implementations advantages and disadvantages. jim.brakefield@ieee.org - 2017-05-27 21:04 -0700
            Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-27 21:56 -0700
              Re: Forth Implementations advantages and disadvantages. jim.brakefield@ieee.org - 2017-05-28 01:10 -0700
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-28 13:21 -0400
                Re: Forth Implementations advantages and disadvantages. jim.brakefield@ieee.org - 2017-05-28 11:53 -0700
                Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-28 15:09 -0700
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-29 02:40 -0400
                Re: Forth Implementations advantages and disadvantages. jim.brakefield@ieee.org - 2017-05-29 13:10 -0700
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-30 00:57 -0400
          Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-28 02:17 -0400
            Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 11:50 -0500
              Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-28 13:52 -0400
                Re: Forth Implementations advantages and disadvantages. Cecil Bayona <cbayona@cbayona.com> - 2017-05-28 13:47 -0500
                Re: Forth Implementations advantages and disadvantages. rickman <gnuarm@gmail.com> - 2017-05-29 03:19 -0400
              Re: Forth Implementations advantages and disadvantages. hughaguilar96@gmail.com - 2017-05-28 15:40 -0700
  Re: Forth Implementations advantages and disadvantages. Joel Rees <joel.rees@gmail.com> - 2017-05-28 16:31 -0700
    Re: Forth Implementations advantages and disadvantages. Joel Rees <joel.rees@gmail.com> - 2017-05-28 20:17 -0700
      Opinions on a C language header for words? Joel Rees <joel.rees@gmail.com> - 2017-05-28 21:38 -0700

csiph-web