Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #37317
| From | "Rod Pemberton" <buzz@notnotnontnooatno.cmm> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack |
| Date | 2015-03-16 18:57 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <op.xvl4qlb5v6dtjm@localhost> (permalink) |
| References | <21045760-f834-4d9c-9bb0-d13f2c1ff3b4@googlegroups.com> |
On Mon, 16 Mar 2015 12:30:34 -0400, <mfanyikazi@gmail.com> wrote: > I have a forth programming problem that is messing up my week , I am > trying to port eforth's multitasker into a Forth CPU that has a hardware > data and return stack. I don't know how to save and restore the stack > pointers when the CPU uses hardware stacks. > > If anyone has a link or some documentation on how this can be done , or > alternative Forth words to RP@ RP! SP@ SP! that allows the emulation of > a context switching mechanism with forth please share , I will be much > grateful to learn from you. Where present, RP and SP return the address of the memory location where the pointers to the return stack and data stack are stored. So, RP@ and SP@ should return the stack pointers themselves and place them onto the data stack. Of course, RP and SP are implemented in registers on most implementations and therefore don't have an address. This is usually why RP and SP aren't present in most Forth systems. Do RP@ RP! SP@ SP! work correctly for this eForth? a) If so, you just need to execute RP@ and SP@ and then ! them into some defined VARIABLEs or perhaps even into ALLOTed dictionary space. When the context switch is finished, you @ the variables and use RP! and SP! to restore them. If you're doing multiple context switches, you'll need multiple sets of two variables, i.e., an array, or perhaps a stack. b) If not, then you'll need to implement RP@ RP! SP@ SP! as "primitives" (or low-level words), likely using assembly. The hardware stack pointers for the data and return stack should or could be stored in registers. So, you'd need assembly code to push or pop both registers used for RP and SP to or from the data stack. You'll need to understand the code for eForth here as well as the assembly for the Forth CPU that you're using. Rod Pemberton
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack mfanyikazi@gmail.com - 2015-03-16 09:30 -0700
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack jenfhaomndgfwutc@murmic.plus.com - 2015-03-16 17:13 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack mfanyikazi@gmail.com - 2015-03-17 02:40 -0700
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> - 2015-03-18 01:53 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack rickman <gnuarm@gmail.com> - 2015-03-17 23:21 -0400
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-16 22:24 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack rickman <gnuarm@gmail.com> - 2015-03-17 14:01 -0400
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack JUERGEN <epldfpga@aol.com> - 2015-03-17 11:59 -0700
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack rickman <gnuarm@gmail.com> - 2015-03-17 16:28 -0400
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-18 15:30 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-18 22:12 +0100
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-03-16 18:57 -0400
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack mfanyikazi@gmail.com - 2015-03-17 02:52 -0700
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-03-17 18:03 -0400
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-18 14:39 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack mfanyikazi@gmail.com - 2015-03-17 02:58 -0700
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-17 16:48 +0000
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack Lars Brinkhoff <lars.spam@nocrew.org> - 2015-03-18 12:16 +0100
Re: Is it possible to have the following words (RP@ RP! SP@ SP!) on hardware data and return stack Lars Brinkhoff <lars.spam@nocrew.org> - 2015-03-18 12:43 +0100
csiph-web