![]() |
|
|
|
|
|
|
2
20th November 14:50
External User
Posts: 1
|
You're on the right track, but there's no point in restricting yourself
unnecessarily. No point in writing more words twice than is necessary; some of these words are easier to do in code than high level anyway, particularly since you say you're very familiar with PIC code. Following is a rough list of the low-level code primitives we do in code: * Structure words (run-time for DO, LOOP, IF, etc.) * CREATE run-time * 15 data stack primitives * 9 R-stack primitives (including I & J) * Logic: AND OR XOR INVERT * 11 Arithmetic primitives (including some optimizations like 1+ and 2* which have native instruction support) * Misc: ALIGNED LSHIFT RSHIFT * 12 comparison operators * 5 memory access words (@ ! etc.) * EXECUTE On an 8051 these comprise about 1K (not counting heads, of course, since we keep heads in the host). We've evolved this standard set over many years, so doing the list for a new processor is pretty automatic. There are some more code words in our systems, including support for the multitasker, clock, I/O, etc., but I'm not including them as you're asking about kernel stuff. That really depends on the instruction set for the processor and the "culture" using that processor (that is, what do most PIC programmers do?). This is why ANS is neutral on the issue. Strive for whatever makes the code cleanest. Also, take care to allocate your registers in such a way as to make your code simple and clean. Pick registers to use for S and R (stack pointers), write a few primitives, and see if a different choice would simplify. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310-491-3356 5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454 Hawthorne, CA 90250 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ================================================== |
|
|
3
20th November 14:50
External User
Posts: 1
|
I really recommend for you to switch to the PIC 18Fxxxx series.
It is much better suited for hosting a forth VM for a incrementeal programming style. It features selfprogramming flash in 64 byte blocks, and the program memory can easily be read via a pointer register. It has three ram pointer registers and a readable and writable 16 bit wide, 31 cells deep, HW return stack. Also you get enough memory (ram 1.5 - 4 kbytes, flash 16 -128 kbytes, eeprom 256 - 1024 bytes ). The 18F also comes in convienient DIP packages with the nice PIC peripherals. I have also looked at the PIC24 series but it has a flash block erase size of 1536 bytes which is not convinient for incremental writes. You would need to waste 1536 bytes of ram for holding data during the flash erase procedure. Mikael -- http://www.kolumbus.fi/oh2aun - FlashForth |
|
|
5
20th November 14:51
External User
Posts: 1
|
You're on the right track, but there's no point in restricting yourself
unnecessarily. No point in writing more words twice than is necessary; some of these words are easier to do in code than high level anyway, particularly since you say you're very familiar with PIC code. Following is a rough list of the low-level code primitives we do in code: * Structure words (run-time for DO, LOOP, IF, etc.) * CREATE run-time * 15 data stack primitives * 9 R-stack primitives (including I & J) * Logic: AND OR XOR INVERT * 11 Arithmetic primitives (including some optimizations like 1+ and 2* which have native instruction support) * Misc: ALIGNED LSHIFT RSHIFT * 12 comparison operators * 5 memory access words (@ ! etc.) * EXECUTE On an 8051 these comprise about 1K (not counting heads, of course, since we keep heads in the host). We've evolved this standard set over many years, so doing the list for a new processor is pretty automatic. There are some more code words in our systems, including support for the multitasker, clock, I/O, etc., but I'm not including them as you're asking about kernel stuff. That really depends on the instruction set for the processor and the "culture" using that processor (that is, what do most PIC programmers do?). This is why ANS is neutral on the issue. Strive for whatever makes the code cleanest. Also, take care to allocate your registers in such a way as to make your code simple and clean. Pick registers to use for S and R (stack pointers), write a few primitives, and see if a different choice would simplify. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310-491-3356 5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454 Hawthorne, CA 90250 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ================================================== |
|
|
7
20th November 14:51
External User
Posts: 1
|
I really recommend for you to switch to the PIC 18Fxxxx series.
It is much better suited for hosting a forth VM for a incrementeal programming style. It features selfprogramming flash in 64 byte blocks, and the program memory can easily be read via a pointer register. It has three ram pointer registers and a readable and writable 16 bit wide, 31 cells deep, HW return stack. Also you get enough memory (ram 1.5 - 4 kbytes, flash 16 -128 kbytes, eeprom 256 - 1024 bytes ). The 18F also comes in convienient DIP packages with the nice PIC peripherals. I have also looked at the PIC24 series but it has a flash block erase size of 1536 bytes which is not convinient for incremental writes. You would need to waste 1536 bytes of ram for holding data during the flash erase procedure. Mikael -- http://www.kolumbus.fi/oh2aun - FlashForth |
|
|
9
20th November 14:51
External User
Posts: 1
|
I spent last winter doing just that. The result is FlashForth.
You can find it at www.kolumbus.fi/oh2aun Always nice to leave a mark, :-) I was considering doing a self hosted PIC forth a few years back, but really the PIC18F made it possible. There are other better chips, but for hobbyists the PICs are quite optimal. Mikael |
|