TAQOZ - Tachyon Forth for the P2 BOOT ROM

1272829303133»

Comments

  • no! no distraction! no, no, no! Not in those times ;-)
  • Hello @Peter Jakacki ,

    first of all many thanks for your work on TAQOZ - taking profit of the current forced 'holydays' I finally had time to dig into Forth and to carry on a project of mine waiting for five or six years now.
    Playing with the P2Eval is really joyful, waiting for your P2D2 to be shipped to ErNa. The project reads 4x serials, logs all the data to a uSD, make some calculations and spits out numbers via serial through radio and BT. Next step is to add more sensors via I2C and as soon as I have the P2D2 to take profit of the RTC as well. And, of course, a display is likely to be added, too :)

    I had been trapped in a nasty 'bug' due to the fact TaqOz is using a shared register amongst COGs for the SWITCH statement. It happened that one COG was changing the SWITCH value and therefore they went havoc, sometime one, sometime the other - not something immediate for me to trace! It took a while to discover it out, and when I realized what was happening I finally dug into your code. In order to avoid the trap, I finally changed TaqOz source code as follows:
    Original:
    *** declaration
    uswitch         res 4           ' target parameter used in CASE structures
    *** hubexec code
    ' SWITCH ( val -- )
    _SWITCH word    rg+uswitch,STOREX+ex
    
    ' SWITCH@ ( -- val )
    SWFETCH word    rg+uswitch,FETCHX+ex
    
    Patched:
    *** declaration
    cswitch     long    0   
    *** COG code
    _SWITCH     mov     cswitch,a
                jmp     #DROP
                
    SWFETCH     mov     X, cswitch
                jmp     #PUSHX
    

    This is of course a quick'n dirty one, but I think it's good to point it out so to avoid others to fall into the same trap. If you have better solutions, they will of course be very welcome. And thank you again for letting me into Forth - that's really something absolutely powerful to be used with micros!!!
  • FYI I am compiling TaqOZ from source with FlexGui on Windows after some mods to labels and the like. BTW, I also modified the TaqOZ I2C driver to support clock stretching since I had a device that needed that.
    ORIGINAL:
    I2C.CLOCK	waitx	i2cdly
    		drvh	sclpin
    		waitx	i2cdly
    		testp	sdapin wc
    		waitx	i2cdly
    		drvl	sclpin
    	_ret_	waitx	i2cdly
    
    MODIFIED
    I2C_CLOCK	waitx	i2cdly
    		flth	sclpin
    	        waitx	i2cdly
    .strtch         testp   sclpin wc
            if_nc   jmp     #.strtch
    		testp	sdapin wc
    		waitx	i2cdly
    		drvl	sclpin
    	_ret_	waitx	i2cdly
    
    I don't know if that's entirely correct, but works for me. The label cannot contain dot(s) because it is not accepted by flexgui due to SPIN2 specs.
  • Peter JakackiPeter Jakacki Posts: 9,087
    edited 2020-05-08 - 06:04:57
    jurop wrote: »
    Hello @Peter Jakacki ,

    first of all many thanks for your work on TAQOZ - taking profit of the current forced 'holydays' I finally had time to dig into Forth and to carry on a project of mine waiting for five or six years now.
    Playing with the P2Eval is really joyful, waiting for your P2D2 to be shipped to ErNa. The project reads 4x serials, logs all the data to a uSD, make some calculations and spits out numbers via serial through radio and BT. Next step is to add more sensors via I2C and as soon as I have the P2D2 to take profit of the RTC as well. And, of course, a display is likely to be added, too :)

    I had been trapped in a nasty 'bug' due to the fact TaqOz is using a shared register amongst COGs for the SWITCH statement. It happened that one COG was changing the SWITCH value and therefore they went havoc, sometime one, sometime the other - not something immediate for me to trace! It took a while to discover it out, and when I realized what was happening I finally dug into your code. In order to avoid the trap, I finally changed TaqOz source code as follows:
    Original:
    *** declaration
    uswitch         res 4           ' target parameter used in CASE structures
    *** hubexec code
    ' SWITCH ( val -- )
    _SWITCH word    rg+uswitch,STOREX+ex
    
    ' SWITCH@ ( -- val )
    SWFETCH word    rg+uswitch,FETCHX+ex
    
    Patched:
    *** declaration
    cswitch     long    0   
    *** COG code
    _SWITCH     mov     cswitch,a
                jmp     #DROP
                
    SWFETCH     mov     X, cswitch
                jmp     #PUSHX
    

    This is of course a quick'n dirty one, but I think it's good to point it out so to avoid others to fall into the same trap. If you have better solutions, they will of course be very welcome. And thank you again for letting me into Forth - that's really something absolutely powerful to be used with micros!!!

    I haven't had a good look at your post but since rg+switch is actually a cog dependent hub register, it depends upon whether a cog has setup it's own register area in hub. The default is at $200 but $300 is free and you could probably put another set at $380 since it is only the console task that needs more room. Otherwise just allocate some data memory and then assign it like this in the cog's startup code.
    128 bytes myregs
    
    pub SETUP_COG
    $200 myregs 128 CMOVE --- maybe make a copy of the main cog's current calues.
    myregs 1 COG! --- setup this cog to use myregs for local registers
    
  • Peter JakackiPeter Jakacki Posts: 9,087
    edited 2020-05-08 - 06:06:13
    TAQOZ 2v5 as it currently is with everything including the kitchen sink loaded onto this binary. If you run RECLAIM you can reclaim around 4k from the dictionary although anything in EXTEND has already been reclaimed but 4k is neither here nor there at present.

    btw, I have had a chance to compare TAQOZ to Mecrisp Forth on the ARM and while Matthias has done a wonderful job (and kudos to the guy) of maintaining this on all the different platforms, and there are a lot, I find that there are so many features built into TAQOZ that I've been spoilt. Even just being able to send or paste source code at high speed without any kind of delays is a luxury I now appreciate even more. On my little ARM chip I have to paste code with 1ms character delays and 100ms line delays and it is painfully slow and it is hard to see errors. Yes, I will write buffered interrupt drivers for it but you have to decide if it is "compiletoflash" worthy beforehand whereas TAQOZ just loads to RAM (See, no Flash, no problems). Besides, TAQOZ is really compact without any problems with speed, especially on the P2.

    TAQOZ can now have code that exceeds the 64k 16-bit address limit and the memory map has been remangled to suit so that there is no adjustment needed when the first 64k "page" is full. I just need help filling it now.

    Console boot report:
    KERNEL            Parallax P2  *TAQOZ* Extensible Firmware  V2.5 'CHIP' 300MHz 200504-1430
    MODULES:
      *SPLAT*       SPLAT - Serial Propeller Logic Analyzer Terminal  200417-0000 
      *SIM*         A SIMULATOR FOR THE 65C02 - 200217.0000 
      *PLEXLED*     CharliePlexing LED device driver 190714.0000
      *PS2*         PS/2 KEYBOARD 
      *MORSE*       Morse code keyer 200126-0000 
      *CLKGEN*      Si5351 Clock generator 190800-0000
      *C2*          C2 Debug Interface for Silabs Microcontrollers - 200424.0000 
      *EASYNET*     WIZnet NETWORK SERVERS 160707.1500 
      *W5500*       WIZNET W5500 driver for TAQOZ V1.0 191007 
      *LIFE*        Conway's Game of Life for TAQOZ in the P2 ROM V1.0 190226.0000 
      *MANDELBROT*  MANDELBROT VGA DEMO 190800-0000 
      *TEXT*        VGA BMP TEXT 190800-0000
      *BMV*         BMV VIDEO PLAYER 190800-0000
      *WAVE*        WAVE AUDIO FILE PLAYER 190800-0000
      *BMP*         BMP FILE VIEWER 190800-0000
      *TIM*         TAQOZ INTERACTIVE MEDIA - AUDIO, TEXT, IMAGE & VIDEO DRIVERS 200403-1200 
      *TIA*         TAQOZ INTERACTIVE ASSEMBLER for the PARALLAX P2 - 200327-2300
      *SPIRAM*      LY68L6400 8MB SPI RAM ACCESS 191020-0000
      *DECOMPILER*  A decompiler for TAQOZ 190825-0000
      *RTC*         RV-3028 RTC DATE and TIME 190800-0000
      *DISK*        SD DISK REPORTING & FORMATTING TOOLS 190800-0000
      *EASYFILE*    SD CARD and FAT32 with VIRTUAL MEMORY  190800-0000
      *SMARTPINS*   SMARTPIN FUNCTIONS and drive modes 190800-0000
      *P2CLOCK*     P2 CLOCK CONTROL 190800-0000
      *ANSI*        ANSI TERMINAL SUPPORT 200410-0000
      *EXTEND*      Primary kernel extensions 200426-1000
      *SPIFLASH*
    MEMORY MAP
      CODE:         0D87A  55,418 bytes
      WORDS:        1AFCC  20,366 bytes
      DATA:         7E26D  621 bytes
      ROOM:                55,122 bytes
    HARDWARE
      PCB           P2      (P2D2)
      CLOCK IN      20MHZ
    DEVICES
      SD CARD       63 GB  SANDISK   SD SC64G REV$80 #35190404 DATE:2018 /10
      SPI FLASH     16MB WINBOND $EF40_1800 #4837448895114529879
    I2C DEVICES
      $A4           RV-3028 RTC
      $C4           Si5351A CLOCK GEN
                    2020/05/08 FRI 15:47:47
    -------------------------------------------------------------------------------
    TAQOZ#
    


Sign In or Register to comment.