From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <47B5E278.7030107@proweb.co.uk> Date: Fri, 15 Feb 2008 19:05:28 +0000 From: maht User-Agent: Icedove 1.5.0.14pre (X11/20071018) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] Google search of the day References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 5661263c-ead3-11e9-9d60-3106f5b1d025 Forth doesn't use CALL it uses JMP Similar Threaded Interpretive Languages run an inner loop that does this pseudo code : (from Threaded Interpretive Languages: Their Design and Implementation by R. G. Loeliger) COLON: PSH I -> RS WA -> I JMP NEXT SEMI: POP RS -> I NEXT: @I -> WA I += 2 RUN: @WA -> CA WA += 2 CA -> PC RS is the stack PC is the program counter, procedures JMP to NEXT or SEMI when they are done I is the indirection pointer, WA is the word address (the nomenclature for procedure) The 2s are there because this code assumes 16bit addressing, @ is indirection CA is the call address so DUP is a word defined as (it copies the item on the top of the stack back to the top of the stack execute is a type marker, you can also have constant & colon dup: execute POP SP -> A PUSH A -> SP PUSH A -> SP JMP NEXT that's all very well but you then extend the assembler parts with new words made from the WAs (colon is the type marker for this) SEMI is where it JMPs to at the end moddiv: colon divmod swop semi I wrote a TIL in AVR assembler last summer but I've waiting to go on holiday this year so I can write some applications in it now I have a dev board :>