Searching \ for 'Back to Basics (stamp)' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=basic
Search entire site for: 'Back to Basics (stamp)'.

Truncated match.
PICList Thread
'Back to Basics (stamp)'
1999\11\10@183424 by Mike M

flavicon
face
Ok i know how stamps work now..i understand the entire principal but getting it
to work is a different story.  the thing i still dont get is ok they compile the
ir code and in their code they want to jump to a label now how would i execute t
hat in my code  like a basic stamp would.  how will i know where the label is st
ored in the eeprom?  so that when my code pulls out the hex numbers out of the e
eprom and executes them???   i know someone has tried to build their own stamp b
efore dont pretend like u havent : )


MikE

Send someone a cool Dynamitemail flashcard greeting!! And get rewarded.
GO AHEAD! http://cards.dynamitemail.com/index.php3?rid=fc-41

1999\11\10@193256 by Tony Nixon

flavicon
picon face
Mike M wrote:
>
> Ok i know how stamps work now..i understand the entire principal but getting i
t to work is
> a different story.  the thing i still dont get is ok they compile their code a
nd in their
> code they want to jump to a label now how would i execute that in my code  lik
e a basic
> stamp would.  how will i know where the label is stored in the eeprom?  so tha
t when my
> code pulls out the hex numbers out of the eeprom and executes them???

> i know someone has tried to build their own stamp before dont pretend like u h
avent : )

oooooh!  Why, what will happen. Maybe I'll get stampeded :-)

Seriously, The answer is pretty 'basic'. ;-)

Really seriously...Use a lookup table.

The PC software is responsible for creating the tokens from the basic
source and hopefully cooperates with the Stamp while loading them into
the external EEPROM.

This won't be exactly how 'they' did it, but it may be similar.

I_goto has a token of 0 followed by a token(s) with a value of the new
instruction address.
I_Pulsout has a token of 1 followed by any token values that are needed
to process the instruction.
I_Pulsin has a token of 2 followed by any token values that are needed
to process the instruction.
Etc
Etc

The EEPROM_Read subroutine reads data from the external EEPROM and maybe
increments and keeps tabs on the Instruction_Index pointer which may be
more than 8 bits wide.

Basic_Loop  call EEPROM_Read
           addwf pcl
           goto I_goto
           goto I_pulsout
           goto I_pulsin
           etc
           etc

I_goto     call EEPROM_Read            ; returns new token address
          movwf Instruction_IndexL    ; set new instruction address (L)
          ; if Instruction_Index > 8 bits
          call EEPROM_Read            ; returns new token address
          movwf Instruction_IndexH    ; set new instruction address (H)
          goto Basic_Loop

I_Pulsout  ; execute I_Pulsout stuff
          goto Basic_Loop


I_Pulsin   ; execute I_Pulsin stuff
          goto Basic_Loop


This gets more complicated if you need to worry about ROM page
boundaries and the PCLATH.

--
Best regards

Tony

http://www.picnpoke.com
Email spam_OUTsalesTakeThisOuTspampicnpoke.com

1999\11\10@200847 by Keith Causey

picon face
Hey Mike, The program that a BASIC Stamp executes is called "threaded code".
In order to get it to work you need a tool box of routines that can be
called in a sequence determined by token words in the external memory (since
it is not possible to write the PIC's native code on the fly). The code in
the external eeprom is analogous to the code inside the stamp; just on a
higher level. In order to get that code to execute you need, in addition to
the tool box of routines I mentioned earlier (which can be considered to be
sort of virtual or hyper instruction set) a virtual machine. This virtual
machine will have a register that will function as an instruction pointer.
One of the first things that your program must do is set this virtual
instruction pointer to the address of the first instruction word in your
eeprom. This must be done before you execute any code otherwise you will
have no idea where you are. A jump is accomplished by having a hyper
instruction that reads the next word, a literal value as opposed to a hyper
instruction, and then writes that literal into the hyper instruction
pointer. That way the next hyper instruction that will be executed will be
the one at the address indicated by the literal. IMHO a more elegant form of
this sort of programming that will not only allow you to store flexable code
in an external memory space but "extend" that instruction set to any number
of hyper instructions without reprogramming the kernel is the "indirect
threadad code" model like Forth. This is beyond the scope of a judiciously
brief posting. You may email me personally for details. Good luck - Keith
Causey .....ffightKILLspamspam@spam@geocities.com

> Mike M wrote:
> >
> > Ok i know how stamps work now..i understand the entire principal but
getting it to work is
> > a different story.  the thing i still dont get is ok they compile their
code and in their
> > code they want to jump to a label now how would i execute that in my
code  like a basic
> > stamp would.  how will i know where the label is stored in the eeprom?
so that when my
> > code pulls out the hex numbers out of the eeprom and executes them???
>
> > i know someone has tried to build their own stamp before dont pretend
like u havent : )
{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...