Thread: [Flashforth-devel] FF and PIC processors
Brought to you by:
oh2aun
From: Pete Z. <pza...@pz...> - 2013-06-08 15:58:24
|
Hi Peter, Not sure I am able to see your new version yet. Only found a few spelling typos in the original. Here are 2 words I find very helpful exploring the usefulness of FlashForth and PIC18 microcontrollers: : .mem ( -- ) \ print current memory locations base @ hex cr ." flash " flash here #4 u.r cr ." eeprom " eeprom here #4 u.r cr ." ram " ram here #4 u.r base ! ; : c?% ( addr -- ) \ print byte contents at addr in binary 2 spaces base @ swap c@ 8 bin u.r base ! ; c?% is useful to look at SFRs. .mem is useful to examine further what Mikael was saying about FORGET vs EMPTY . Side note: I still prefer the original FORTH word COLD to Mikael's EMPTY. Don't leave out DUMP, especially when learning to create arrays and jump tables. Pete Pete Zawasky PZEF Co. 361 Mills RD Oriental, NC 28571 www.pzef.net pza...@pz... 1-252-249-3393 (voice and fax) 1-252-670-6940 (cell) |
From: Peter J. <p.j...@uq...> - 2013-06-08 17:53:56
|
Peter, I checked by downloading the file after I put it in place so my guess is that your browser is offering up a cached copy. To get around the browser being too smart, I've made a copy of the same file to eoff-2013-jun-08.pdf. That should appear new to your browser. I'll play with the words you sent below. Being fairly new to Forth, I am still being surprised by how neat these little utility words are. Is there a collection of such things that is generally available? I'm also still learning how much there is to cover in a tutorial. Although I have been trying to limit the document to about 20 pages (so it's not so daunting for the students) I'm open to being more inclusive for this document or for a follow-on document. As for dump, I was going to include it but I didn't get it to work as I expected marker -play ok<$,ram> $ff93 3 dump ok<$,ram> create a-array 3 , 2 , 1 , 0 , ok<$,ram> a-array 8 dump ok<$,ram> a-array @ . 3 ok<$,ram> I'm probably just doing it wrong but I also had trouble finding the words mod /mod */ */mod for the single signed numbers. Any hints? Peter J. ________________________________________ From: Pete Zawasky [pza...@pz...] Sent: Sunday, June 09, 2013 1:58 AM To: FF mailing list Subject: [Flashforth-devel] FF and PIC processors Hi Peter, Not sure I am able to see your new version yet. Only found a few spelling typos in the original. Here are 2 words I find very helpful exploring the usefulness of FlashForth and PIC18 microcontrollers: : .mem ( -- ) \ print current memory locations base @ hex cr ." flash " flash here #4 u.r cr ." eeprom " eeprom here #4 u.r cr ." ram " ram here #4 u.r base ! ; : c?% ( addr -- ) \ print byte contents at addr in binary 2 spaces base @ swap c@ 8 bin u.r base ! ; c?% is useful to look at SFRs. .mem is useful to examine further what Mikael was saying about FORGET vs EMPTY . Side note: I still prefer the original FORTH word COLD to Mikael's EMPTY. Don't leave out DUMP, especially when learning to create arrays and jump tables. Pete Pete Zawasky PZEF Co. 361 Mills RD Oriental, NC 28571 www.pzef.net pza...@pz... 1-252-249-3393 (voice and fax) 1-252-670-6940 (cell) ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Flashforth-devel mailing list Fla...@li... https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Pete Z. <pza...@pz...> - 2013-06-09 01:18:06
|
Hi Peter, 1. DUMP in FF3.8 requires lengths in multiples of $10. e.g. here $0f dump nothing printed. here $10 dump for 1 line of print. 2. For the math words, look at Mikael's file 'math.txt' Double and mixed math words -------------------------------------------------------------------------------- math.txt --------- */ ( n1 n2 n3 -- quotient ) */mod swap drop Multiply n1 and n2 then divide by n3. 32 bit intermediate result. */mod ( n1 n2 n3 -- rem quot ) Multiply n1 and n2 then divide by n3. 32-bit intermediate result. /mod ( n1 n2 -- rem quot ) 16/16 -> 16-bit signed division. fm/mod (d n -- rem quot ) Floored 32/16 -> 16-bit division. m* ( n n -- d ) Signed 16*16->32 multiply. mod ( n1 n2 -- remainder ) Remainder of n1 divided by n2. sm/rem ( d n -- rem quot ) Symmetric 32/16 -> 16 bit division. 3. Most people who have used FORTH for a while will have a "toolkit" of words they developed over time and particular applications. Here is mine for FF 3.8 Utility words -------------------------------------------------------------------------------- util38.txt --------- forget <name> ( -- ) Forget name. .mem ( -- ) HEX print of current memory locations; FLASH, EEPROM, RAM. <= ( n1 n2 -- flag ) Leave true flag if n1 less than or equal to n2. ?dup ( x -- 0 | x x ) Conditionally duplicate the top item on the stack, if its value is non-zero. blanks ( c-addr u -- ) Fill u bytes with $20 starting at c-addr. fill ( c-addr u c -- ) Fill u bytes with c starting at c-addr. erase ( c-addr u -- ) Fill u bytes with $00 starting at c-addr. pick ( xu ... x0 u -- xu ... x0 xu ) Place a copy of the nthstack entry on top of the stack. 0 pick is equivalent to dup. ? ( addr -- ) Print unsigned contents at addr in the current base. c? ( addr -- ) Print byte contents at addr in the current base. c?% ( addr -- ) Print byte contents at addr in binary. array ( n -- ) Compile a word which creates n cell indexed arrays. compile-time n array <name> where n is size of array run-time i <name> where i is the array index and i is zero based (0...n) carray ( n -- ) Compile a word which creates n indexed character arrays. compile-time n carray <name> where n is size of array run-time i <name> where i is the array index and i is zero based (0...n) I will try to send you this file, but I may have to send it directly to you, not through SourceForge. Pete Pete Zawasky PZEF Co. 361 Mills RD Oriental, NC 28571 www.pzef.net pza...@pz... 1-252-249-3393 (voice and fax) 1-252-670-6940 (cell) On 6/8/2013 1:53 PM, Peter Jacobs wrote: > Peter, > > I checked by downloading the file after I put it in place so my guess is that your browser is offering up a cached copy. To get around the browser being too smart, I've made a copy of the same file to eoff-2013-jun-08.pdf. That should appear new to your browser. > > I'll play with the words you sent below. Being fairly new to Forth, I am still being surprised by how neat these little utility words are. Is there a collection of such things that is generally available? > > I'm also still learning how much there is to cover in a tutorial. Although I have been trying to limit the document to about 20 pages (so it's not so daunting for the students) I'm open to being more inclusive for this document or for a follow-on document. > > As for dump, I was going to include it but I didn't get it to work as I expected > marker -play ok<$,ram> > $ff93 3 dump ok<$,ram> > create a-array 3 , 2 , 1 , 0 , ok<$,ram> > a-array 8 dump ok<$,ram> > a-array @ . 3 ok<$,ram> > I'm probably just doing it wrong but I also had trouble finding the words mod /mod */ */mod for the single signed numbers. Any hints? > > Peter J. > > |
From: Pete Z. <pza...@pz...> - 2013-06-10 12:38:04
|
Hi Lowell, Nice of you to offer....It would be nice if we had a place for FlashForthers to easily post snippets of code to share. In the mean time, at least we have the forum and discussion areas Mikael has provided us here on SourceForge. Pete On 6/8/2013 10:02 PM, Lowell wrote: > If anyone is interested, my versions of arrays include an array length > element and when I access the array I coerce the return value to come > from the array. That way, if you are using the array for a jump > table, you can't accidently jump to an illegal location by using a bad > index. I use this for finite state machines. > |
From: <mik...@pp...> - 2013-06-10 14:04:28
|
You could try to edit the FF wiki on sourceforge. I think all SF members have edit rights. That would be a goof place to have code examples. BR Mikael ----Original Message---- From: pza...@pz... Date: Jun 10, 2013 15:38 To: "FF mailing list"<fla...@li...> Subj: Re: [Flashforth-devel] FF and PIC processors Hi Lowell, Nice of you to offer....It would be nice if we had a place for FlashForthers to easily post snippets of code to share. In the mean time, at least we have the forum and discussion areas Mikael has provided us here on SourceForge. Pete On 6/8/2013 10:02 PM, Lowell wrote: > If anyone is interested, my versions of arrays include an array length > element and when I access the array I coerce the return value to come > from the array. That way, if you are using the array for a jump > table, you can't accidently jump to an illegal location by using a bad > index. I use this for finite state machines. > ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Flashforth-devel mailing list Fla...@li... https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Pete Z. <pza...@pz...> - 2013-06-10 15:50:50
|
Hi Mikael, I was hoping you would comment...... Sounds like a very good idea to check out. Pete On 6/10/2013 10:04 AM, mik...@pp... wrote: > You could try to edit the FF wiki on sourceforge. > > I think all SF members have edit rights. > > That would be a goof place to have code examples. > > BR Mikael > > ----Original Message---- > From: pza...@pz... > Date: Jun 10, 2013 15:38 > To: "FF mailing list"<fla...@li...> > Subj: Re: [Flashforth-devel] FF and PIC processors > > Hi Lowell, > > Nice of you to offer....It would be nice if we had a place for > FlashForthers to easily post snippets of code to share. > In the mean time, at least we have the forum and discussion areas Mikael > has provided us here on SourceForge. > > Pete > > > On 6/8/2013 10:02 PM, Lowell wrote: >> If anyone is interested, my versions of arrays include an array length >> element and when I access the array I coerce the return value to come >> from the array. That way, if you are using the array for a jump >> table, you can't accidently jump to an illegal location by using a bad >> index. I use this for finite state machines. >> > |