Skip to main content
Visitor II
July 20, 2010
Question

FORTH for STM8S-Discovery

  • July 20, 2010
  • 13 replies
  • 2875 views
Posted on July 20, 2010 at 07:08

Here is a FORTH interpreter-compiler for Discovery Board.  It is in the form of an assembly file stm8ef.asm.  You can assemble it on STVD and download it to Discovery.  You need a UART connection to Hyperterminal on PC to interact with STM8S microcontroller.

If you are lucky enough, or persist enough to get it going, the whole Hyperterminal project will be reduced to 6 lines of FORTH code:

 1 500F C! ; turn off LED

 0 500F C! ; turn on LED

 3E 50F3 C! ; turn on 1 KHz beep

 7E 50F3 C! ; turn on 2 KHz beep

 FE 50F3 C! ; turn on 4 KHz beep

 1E 50F3 C! ; turn off beep

This is how microcontrollers are to be used.

Good luck,

Ting. 
    This topic has been closed for replies.

    13 replies

    Visitor II
    December 7, 2010
    Posted on December 07, 2010 at 13:52

    Hi Ting,

    I just found a little trouble in the UART's configuration 

    UARTCR1 is set to 0x06 instead of 0x00 for a 8data bits, no parity as configuration.

    It works well if people don't forget to execute HEX word first ;)

    Nice job, I need to save my new words in flash now ;)

    Regards

    Slim

    Visitor II
    December 31, 2017

    Posted on December 31, 2017 at 18:21

     aouinet.slim wrote:

    Nice job, I need to save my new words in flash now

    Just for the records: that bit was solved about 6 years later.

    Check out https://github.com/TG9541/stm8ef

    Super User
    December 7, 2010
    Posted on December 07, 2010 at 23:53

    ''You need a UART connection to Hyperterminal''

     

     

    I'm sure you don't need Hyperterminal - any terminal will do!
    Visitor II
    December 16, 2010
    Posted on December 16, 2010 at 16:23

        I've bought several stm8s discovery board to play under stm8s eForth.developped by Dr. Ting. I've designed my own assembler to facilate the programming. See if you are interested in this kind of assembler--- High Level Algebraic Assembler (HLAA). I need someone to use it to see if it's usefullness.

    The whole assembler/disassembler/decompiler/compiler are all included in one package with free of charge. Have fun with Forth and HLAA.         holi

    ps. stm8s47.f  can be found in the website of ARMForth.
    Visitor II
    December 17, 2010
    Posted on December 17, 2010 at 03:52

    the folder for eForth related files is stm8s-Discovery on:

    http://tech.groups.yahoo.com/group/armForth/files/

    Super User
    December 21, 2010
    Posted on December 21, 2010 at 23:48

    ''I need someone to use it to see if it's usefullness''

     

    I guess Obiwan Kenobi might like it...?
    Visitor II
    December 24, 2010
    Posted on December 24, 2010 at 08:46

    May I ask who is Obiwan Kenobi?  Maybe I can get in contact with him to show how the usefullness of what I've developed if he knows forth or so as to say. I've had several followers to help me to test or verify the code. But still I need more people helping the test.

    Super User
    December 24, 2010
    Posted on December 24, 2010 at 16:26

    http://en.wikipedia.org/wiki/Obi-Wan_Kenobi

    Sorry - it was a joke: ''may the FORTH be with you''

    Visitor II
    December 29, 2010
    Posted on December 29, 2010 at 02:37

     I can feel it.

     

    But if you look at it seriously, you'll find it's a great breakthrough of the assembler you've ever seen in your life. It's a completely different story you'll see.

    stm8s65.f  is  the main file to download.

    Visitor II
    December 30, 2010
    Posted on December 30, 2010 at 01:29

    You could download the whole system from:

    http://tech.groups.yahoo.com/group/armForth/files/

    the folder file is  stm8s-discovery.

    http://tech.groups.yahoo.com/group/armForth/files/

    Visitor II
    January 4, 2011
    Posted on January 04, 2011 at 09:00

    What do you think of this kind of assembler? ( HLAA )

    Does it appeal to you?

    It's also universal for other cpus include ARM, 8051....

                                   8:  init.stm8s

      (  0357  AE 07 CF       )                                 X=7CF

      (  035A  94             )                                 SP=X

      (  035B  BF 24          )                                 r24=X

      (  035D  AE 07 80       )                                 X=780

      (  0360  BF 22          )                                 r22=X

      (  0362  35 01 50 11    )                                 r5011=1

      (  0366  35 03 50 12    )                                 r5012=3

      (  036A  35 01 50 13    )                                 r5013=1

      (  036E  72 12 50 C5    )                                 r50C5.1=1

      (  0372  35 B4 50 C4    )                                 r50C4=0B4

      (  0376  72 07 50 C5 FB )                 0376            r50C5.3=0?

      (  037B  72 17 50 C5    )                                 r50C5.3=0

      (  037F  35 02 52 43    )                                 r5243=2

      (  0383  35 68 52 42    )                                 r5242=68

      (  0387  35 00 52 44    )                                 r5244=0

      (  038B  35 00 52 46    )                                 r5246=0

      (  038F  35 0C 52 45    )                                 r5245=0C

      (  0393  81             )                                 RET