Message from discussion why forth over lisp?
From: Albert van der Horst <alb...@spenarnc.xs4all.nl>
Subject: Re: why forth over lisp?
Date: 22 Aug 2010 13:23:31 GMT
Organization: Dutch Forth Workshop
References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <is2dnUzVYZBqhu3RnZ2dnUVZ_smdnZ2d@supernews.com>
In article <is2dnUzVYZBqhu3RnZ2dnUVZ_smdn...@supernews.com>,
Elizabeth D Rather <erat...@forth.com> wrote:
>On 8/21/10 5:45 AM, Paul N wrote:
>> On 21 Aug, 08:17, Standish P<stnd...@gmail.com> wrote:
>>> On Aug 14, 9:31 am, Brad Cantrell<cantre...@gmail.com> wrote:
>>>> I hate asking this question, but so far Ive read Leo Brodie's
>>>> "Starting Forth" and a few other Forth tutorials and they all mention
>>>> how Forth has very low level access to hardware that other languages
>>>> dont have and how it is a operating system unto itself, but Im having
>>>> trouble seeing this.
>>>> And also I dont see how Forth has any lower access than any other
>>>> language like C. All these languages simply make OS system calls or
>>>> interface with system libraries. Im sorry for asking this, but could
>>>> anyone tell me what Im missing here?
>>> Forth is nothing but structured assembly.
>>> One can write all the programming paradigms in assembly.
>> As I understand it, C has no equivalent of the "in" and "out"
>> instructions of the Z80 processor, so on a Z80 system it could
>> directly access any memory-mapped peripherals but not any of the (more
>> common) I/O mapped peripherals. The ZX Spectrum had IN and OUT
>> commands that could do this. I don't know whether Forth offers such
>> features or not.
>Yes, Forth's @ ("fetch") and ! ("store") instructions can read and write
>memory-mapped I/O ports. There are variants of @ and ! for the most
>common sizes of data or port (8-bit, 16-bit, etc.). For platforms
>without naturally memory-mapped I/O it's common to find P@ and P! (Port
>fetch and store) commands, and for portability they are often available
>as alternative names to their standard equivalents (most commonly C@ and
>C! for 8-bit access).
It is interesting what happens if they are not there.
A Forther will type (or start his program with)
CODE P! POP|X, DX| POP|X, AX| OUT|D, X'| NEXT, END-CODE
and get it over with.
More than anything this sets Forth programmers apart :
they actually have the confidence to do this
they actually have the expertise to do this
they actually do this
[Disclaimer: code shown is ciforth's postit-fixup assembler.
Actual code differs among Forth compilers.]
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst