Shop OBEX P1 Docs P2 Docs Learn Events
Tachyon V4 "DAWN" - exploring new worlds - Page 9 — Parallax Forums

Tachyon V4 "DAWN" - exploring new worlds

1679111230

Comments

  • @proplem - sorry about that, I just came across the problem you mentioned. It was a simple auto load utility that is normally commented out but I had moved them around and it tried to load. All fixed and tested now.
    Propeller .:.:--TACHYON--:.:. Forth V4.3 DAWN 430170415.0000
    
    MODULES LOADED: 
    2F8C: EASYFILE.fth        SD card  + FAT32 Virtual Memory Access File System Layer V1.2 170416-0000 
    1A40: EXTEND.fth          Primary extensions to TACHYON+ kernel  - 170307-0930
    
    AUTORUN BOOT
    Loading cog 3 E506 F32     
    *** ROMS ***
    0,848 VGA32x15  
    0,388 HSUART    
    1,900 F32        CODE:$3E98 =15512 bytes   NAME:$54AE =8018 bytes   DATA:$7921 =785 bytes    =5654 bytes free    Data Stack (0)
    
    --------------------------------------------------------------------------------
    ( 0001 $3E98 PBJ )   SD1372 SDPINS
    ( 0002 $3E98 PBJ )   MOUNT
    
    Mounted E2C4.0203-8203.51A8 mkfs.fat WIDGET      FAT32   3,965MB (4,096/cluster)
    ( 0003 $3E98 PBJ )   ls
    
    WIDGET     
    128K    .BIN   256K    .BIN   DEBUG   .ROM   EASYFILE.FTH   EASYNET .FTH   
    ECOLCD  .PDF   EXTEND  .FTH   FAVICON .ICO   FIRMWARE.ROM   FRED    .PNG   
    FSRPCB  .PNG   FSRSCH  .PNG   HELP    .TXT   HOME    .HTM   HTTP404 .HTM   
    IMAGE          IMAGE1         IMAGE2         IMAGE3         IOT5500 .HTM   
    LOGON   .HTM   LOVE    .MP3   P8      .H     P8X32A  .PDF   POPCORN .MP3   
    PREVIOUS.ROM   SDCARD  .FTH   SITE0001.LOG   SITE0002.LOG   SITE0003.LOG   
    SITE0004.LOG   SYSLOG  .TXT   TACHYON .HTM   W5200   .FTH   W5500   .FTH   
    WELCOME .TEL   LOVE    .WAV   POPCORN .WAV   WARPEACE.TXT   COMPACT .FTH   
    SEE     .FTH   
    ( 0004 $3E98 PBJ )
    
  • Hi Peter,
    ah proplems proplems :-))

    I downloaded your sanitized folder (thanks for this) to give iot5500 the next attempt:

    - with defensive settings (115200 baud, 10 ms line delay excepted COMPACT.FTH and EASYNET.FTH)
    - kernel ok
    - extend ok
    - easyfile ok - but ls not working (while v3 is)
    *No Card inserted!* *Card Error* *Card Error*
    
    - nevertheless I patched good old P8.FTH for V4 (ignoring missed PCB and PCB$)
    TACHYON V4
    
    FORGET +P8.fth
    pub +P8.fth        ." P1432 +P8 HARDWARE DEFINITIONS 141118.0000 " ;
    
    --- P1432 +P8 PCB + P1455 IoT5500 ---
    
    
    ( P8X32A PINOUTS )
    
    
    #P1	|< == &WNDO             '' MISO from WIZNET
    #P17    |< == &WNCS             '' WIZNET CS
    #P18    |< == &WNCK             '' WIZNET SPI CLOCK
    #P19    |< == &WNDI             '' MOSI to WIZNET
    #P23    |< == &SFCS             '' Serial flash CS (WINBOND W25Q80 8Mbit Flash)
    #P27    |< == &SDCS             '' SDCARD CS
    #P24    |< == &SDDO             '' Data out from SDCARD
    #P25    |< == &SDCK             '' SDCARD clocks (Shared with SCL) 
    #P26    |< == &SDDI             '' Data to SDCARD (Shared with SDA)
    #P16	|< == &WINT
    
    &SDCS >| #24 SHL &SDDO >| 16 SHL OR &SDDI >| 8 SHL OR &SDCK >| OR        == SDC
    &SFCS >| #24 SHL &SDDO >| 16 SHL OR &SDDI >| 8 SHL OR &SDCK >| OR        == SDD
    
    
    pub LANLED			#P21 SWAP IF LOW ELSE FLOAT THEN ;
    pub SDBSYLED			#P22 SWAP IF LOW ELSE FLOAT THEN ;
    pub WRESET ( on/off -- )	#P0 SWAP IF LOW ELSE HIGH THEN  ;
    pub WPWRDN ( on/off -- )	DROP ;
    
    
    
    ( PCB DEFINITIONS )
    \ Do what we need to do to init the hardware on this pcb
    pub !PCB
    	&WNCS OUTSET
    	&SFCS OUTSET
    	&SDCS OUTSET
    	;
        
    \ " P1432 +P8"  PCB$ $!
    \ #1432 TO PCB
    
    END
    
    - pasting COMPACT.FTH with 50 ms line delay ok
    - pasting EASYNET with up to 100 ms line delay but no success
    - see attached build.log
    - and a snippet from the makefile
    # ---
    # --- iot5500
    # ---
    .PHONY: iot5500
    iot5500: SINGLESTEP=1
    iot5500: nldly=10
    iot5500: DEFxxMHz=DEF96MHz
    iot5500:
    	$(MAKE) -e kernel
    	$(MAKE) -e EXTEND.FTH.dl
    	$(MAKE) -e P8.FTH.dl
    	$(MAKE) -e EASYFILE.FTH.dl
    	$(MAKE) COMPACT.FTH.dl
    	$(MAKE) -e COMPACT
    	$(MAKE) -e BACKUP
    	$(MAKE) EASYNET.FTH.dl
    
    
    COMPACT.FTH.dl: nldly=50
    EASYNET.FTH.dl: nldly=100
    

    I think we/you are not so far away although this costs hours and hours but I couldn't give up.
    BTW I have symbolic links on your original files so the names are different.

    Thanks a lot,
    proplem
  • Arggh - I saw your last post too late. No problem will try instantly ...
  • Things are going better now. The build runs without errors but there are still problems:
    - sdcard access isn't working
    ( 1409 $5510  ok )   ls
     *No Card inserted!* *Card Error* *Card Error* 
    ( 1410 $5510  ok )
    
    - EASYNET needs SDCARD access and goes wild
    ( 0001 $5510  ok )   EASYNET
    
    MODULES LOADED: 
    48F2: EASYNET.fth         WIZNET NETWORK SERVERS 161216.1900 
    4046: W5500.fth           WIZNET W5500 driver 170417.0000 
    
    AUTORUN 
    Loading cog 3 E506 F32     
    *** ROMS ***
    0,848 VGA32x15  
    0,388 HSUART    
    1,900 F32       
    0,196 MONO16    
    1,900 F32       
     CODE:$5510 =21264 bytes   NAME:$6678 =3464 bytes   DATA:$7A14 =1028 bytes    =4456 by)
    
    *Card Error* 
    *** Tachyon Forth EASYNET Network Servers and EASYFILE File Server *** 
    
     ... ready! 
    
    NETWORK STATUS:
    LINK DOWN
    HARDWARE: WIZnet W5500 V0
    SRC IP    000.000.000.000
    MASK      000.000.000.000
    GATEWAY   000.000.000.000
    MAC       00.00.00.00.00.00.
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    
    * WEB, FTP, and TELNET servers running * 
    ( 0002 $5510  ok )   
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    

    - attention: this ^^^^ is not yet ethernet connected just a quick test
    - sdcard worked yesterday on V3, hmmm

    Have to go to bed - good night,
    proplem
  • @proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8. So once you enter SD8 SDPINS that will lock the hardware setup in EEPROM, that's all you have to do. Since these predefined constants do not take up any code space they are convenient as they can be removed during a RECLAIM if so desired.
    PRIVATE
    &27.24.26.25	== SD8
    &04.09.05.08	== SD1656
    &26.27.29.28	== SD1372
    &24.27.26.25	== SD1144
    &27.24.26.25	== SD1419
    

    In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime. I see though that I haven't fully setup EASYNET in the same manner but I will fix that up shortly. Expect to be able to enter:
    &13.12.15.14 WIZPINS ( &ce.miso.mosi.sck )
    
    to configure as necessary.



  • @proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8. So once you enter SD8 SDPINS that will lock the hardware setup in EEPROM, that's all you have to do. Since these predefined constants do not take up any code space they are convenient as they can be removed during a RECLAIM if so desired.
    PRIVATE
    &27.24.26.25	== SD8
    &04.09.05.08	== SD1656
    &26.27.29.28	== SD1372
    &24.27.26.25	== SD1144
    &27.24.26.25	== SD1419
    

    In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime. I see though that I haven't fully setup EASYNET in the same manner but I will fix that up shortly. Expect to be able to enter:
    &13.12.15.14 WIZPINS ( &ce.miso.mosi.sck )
    
    to configure as necessary.

    @Peter - sorry for responding delayed with bad news. IoT5500 is still rejecting cooperation:

    I build it like this:
    - 115200 baud, 10 ms line delay
    - bstc kernel
    - EXTEND.FTH
    - EASYFILE.FTH
    - COMPACT.FTH (50 ms line delay)
    - execute: COMPACT
    - execute: BACKUP
    - EASYNET.FTH (50 ms line delay)
    - execute: SD8 SDPINS
    

    The build as itself is successful (no errors reported) but still I'cant access the SD card via "ls". Also WIZPINS is not yet implemented as you already mentioned but I tried to be sure.
  • @proplem - Just make sure which pins are used for the interface and code them in decimal bytes (IP notation) in the same manner as it is for +P8 module -
    &27.24.26.25
    So these port numbers are in the order of left to right as CE, MISO, MOSI, and CLK as I'm guessing that perhaps your hardware is different. But normally the card and file system is mounted before use anyway with MOUNT but you could also just try !SD and look at the result which should be non-zero. If it is zero then it failed to even initialize the card so check with another card or board etc.

    CE is the chip enable (without a pullup)
    MISO is the "master in, slave out" so that means the read data from the card
    MOSI is the data and commands to the card
    CLK of course is the clock pin.

    You're right, I haven't done WIZPINS yet, but that should be straightforward. There was a very small bug in the 4.3 kernel that was causing a problem in EASYNET so just make sure you use the latest updates too, not that this would cause any of the problems you are describing though.
  • @proplem - These files are setup so that they don't need a hardware header file, so in the case of the P8 you can setup the pins with a predefined constant SD8.
    .
    .
    .
    PRIVATE
    &27.24.26.25	== SD8
    &04.09.05.08	== SD1656
    &26.27.29.28	== SD1372
    &24.27.26.25	== SD1144
    &27.24.26.25	== SD1419
    

    In V4 I decided to steer away from hardware headers that needed to be setup before loading the other modules as I want to be able to have generic binary images if necessary combined with the flexibility of configuring hardware at runtime.


    This is a nice touch.

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-21 04:41
    That was very easy to change EASYNET to handle pin configuration at runtime. The format is the same as it is with SDPINS, just use the IP notation prefix & with your fields separated by a decimal point.
    I have my standard default set at compile time but otherwise just use WIZPINS (in uppercase) to lock this into EEPROM.
    &13.12.15.14 WIZPINS
    

    btw, with wordcode it is easy to revector any word so if for instance you want LEDs to indicate SD card activity then there are dummy words in EASYFILE that you can revector to your LED word. In some cases your word may simply drive an I/O high or low but in other cases for instance I have LEDs connected over a shift register or I2C so they are easily accommodated. If your "vector" has the lsb set then it ends up performing a jump instead of a call which would be useful in revectoring code such as CARD? but optional if you revector SDBUSY for instance as that one is just a dummy word.

    To revector the card detect routine to perform a jump to the vector with 1+ to set the lsb. Default is to sense the card's pullup on CE without any external pullup.
    ' MYCARD? 1+ ' CARD? W!
    

    Startup
    Propeller .:.:--TACHYON--:.:. Forth V4.3 DAWN 430170415.0000
    
    MODULES LOADED: 
    4902: EASYNET.fth         WIZNET NETWORK SERVERS 161216.1900 
    4046: W5500.fth           WIZNET W5500 driver 170421.0000 
    
    AUTORUN 
    Loading cog 3 E506 F32     
    *** ROMS ***
    0,848 VGA32x15  
    0,388 HSUART    
    1,900 F32       
     CODE:$5520 =21280 bytes   NAME:$6688 =3448 bytes   DATA:$7A14 =1028 bytes    =4456 bytes free    Data Stack (0)
    
    --------------------------------------------------------------------------------
    ( 0001 $5520  ok )   EASYNET
    
    MODULES LOADED: 
    4902: EASYNET.fth         WIZNET NETWORK SERVERS 161216.1900 
    4046: W5500.fth           WIZNET W5500 driver 170421.0000 
    
    AUTORUN 
    Loading cog 3 E506 F32     
    *** ROMS ***
    0,848 VGA32x15  
    0,388 HSUART    
    1,900 F32       
     CODE:$5520 =21280 bytes   NAME:$6688 =3448 bytes   DATA:$7A14 =1028 bytes    =4456 bytes free    Data Stack (0)
    
    
    Mounted E2C4.0203-8203.51A8 mkfs.fat WIDGET      FAT32   3,965MB (4,096/cluster)
    *** Tachyon Forth EASYNET Network Servers and EASYFILE File Server *** 
    
     ... ready! 
    
    NETWORK STATUS:
    LINK *UP*
    HARDWARE: WIZnet W5500 V4
    SRC IP    192.168.000.099
    MASK      255.255.255.000
    GATEWAY   192.168.000.001
    MAC       02.FF.C5.69.A3.0E.
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    #1  00:00:13 TCP     21           .    .    .    .    . 00 14 LISTEN       
    #3  00:00:13 TCP  10001 42458     .    .    .    .    . 00 14 LISTEN       
    #4  00:00:13 TCP     80 49570     .    .    .    .    . 05 14 LISTEN       
    
    * WEB, FTP, and TELNET servers running * 
    ( 0002 $5520  ok )   
    SKT HH:MM:SS MODE  PORT  DEST TXRD TXWR RXRD RXWR RXSZ  IR STATUS            IP ADDR
    #4  00:00:13 TCP     80 49570     .    .    .    .    . 04 14 LISTEN       
    Mounted E2C4.0203-8203.51A8 mkfs.fat WIDGET      FAT32   3,965MB (4,096/cluster)
    

    Testing a telnet connection
    peter@peter-workstation ~ $ telnet 192.168.0.99 10001
    Trying 192.168.0.99...
    Connected to 192.168.0.99.
    Escape character is '^]'.
    WELCOME TO THE IoT5500 TELNET SESSION
    Use Forth commands, for help type WORDS
    Try ls or DIR for directory
    Session time is unlimited but all other network ports
    will be blocked until Telnet is disconnected
    
    
    
    ( 0005 $5520  ok )   .S
    
     Data Stack (0)
    ( 0006 $5520  ok )   ??
    
      Propeller .:.:--TACHYON--:.:. Forth V4.3 DAWN 430170415.0000
    
    MODULES LOADED: 
    4902: EASYNET.fth         WIZNET NETWORK SERVERS 161216.1900 
    4046: W5500.fth           WIZNET W5500 driver 170421.0000 
    
    AUTORUN 
    FREQ = 80,000,000 CODE:$5520 =21280 bytes   NAME:$6688 =3448 bytes   DATA:$7A14 =1028 bytes    =4456 bytes free    Data Stack (0)
    ( 0007 $5520  ok )   BYE
    Connection closed by foreign host.
    peter@peter-workstation ~ $
    
    btw, there are more modules than that loaded but the names are in the EEPROM dictionary after a compact so I need to update the reporting to include these too.
  • I just downloaded a fresh copy of V4 from Dropbox and tried to compile it with PropellerIDE (openspin). I got the following error:
    An open-source compiler for Propeller Spin
    Copyright © 2012-2015 Parallax, Inc.
    Compiling /Users/mgreen/Desktop/V4_21-Apr-2017/Tachyon V4.3.spin
    /Users/mgreen/Desktop/V4_21-Apr-2017/Tachyon V4.3.spin(2233:36) : error : Address is out of range
    Line:
    _PLREP mov R1,pblksz ' reload buffer cnt
    Offending Item: pblksz

    Any suggestions?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-21 23:43
    Hi Mike, good to hear from you. I have PropellerIDE installed on my Linux system so I opened 4.3 and compiled it and got a successful build:
    Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
    Compiled for i386 Linux at 08:17:46 on 2009/07/20
    Loading Object Tachyon V4.3
    Program size is 32348 longs
    Compiled 3515 Lines of Code in 0.109 Seconds
    

    However I changed my preferences from BST to OpenSpin and it failed:
    Compiling /mnt/OS/Dropbox/Tachyon/V4/Tachyon V4.3.spin
    
    /mnt/OS/Dropbox/Tachyon/V4/Tachyon V4.3.spin(2233:36) : error : Address is out of range
    Line:
    _PLREP                  mov     R1,pblksz       ' reload buffer cnt
    Offending Item: pblksz
    

    I see the problem, the org statement is missing for this section of code and pblksz ends up effectively out of range at $1F9.
    1678(01F7) EA 01 7C 5C |                         jmp     #_PLREP         ' repeat buffer
    167C(01F8) 00 80 FF FF | bias            long    $FFFF8000               ' biased sign
    1680(01F9) 00 02 00 00 | pblksz          long    512                     ' 512 samples 1K buffer
    
    Just insert " org _RUNMOD" before the _PLAY label where it should be. Obviously I haven't used that for a while :)
    (File is updated on Dropbox)
  • Mike GreenMike Green Posts: 23,101
    edited 2017-04-22 02:54
    With the correction (thanks!) it compiles, but won't load (under MacOS 10.12.5 with the Apple FTDI driver). I have a Linux netbook as well and will try with that. Small programs will load and run successfully with the Mac and PropellerIDE.
  • Mike GreenMike Green Posts: 23,101
    edited 2017-04-22 03:41
    FYI: I can load V4r3 with PropellerIDE on the Linux netbook to my Propeller (one of Bean's Dongles at 5MHz). It did take 2 or 3 tries to be successful. I can load EXTEND with the Mac using CoolTerm at 19200 Baud with 3ms character delay and 80ms line delay. It wouldn't work with no character delay and 50ms line delay.
  • Mike Green wrote: »
    FYI: I can load V4r3 with PropellerIDE on the Linux netbook to my Propeller (one of Bean's Dongles at 5MHz). It did take 2 or 3 tries to be successful. I can load EXTEND with the Mac using CoolTerm at 19200 Baud with 3ms character delay and 80ms line delay. It wouldn't work with no character delay and 50ms line delay.

    Sounds like totally buggy serial coms software to me since I never have any problems at 921600 baud with zero character delay and only 5ms line delay. This is with a standard FT232R chip and minicom in Linux. The same goes for Teraterm running in an old XP on VirtualBox. In fact when you said it takes 2 or 3 tries to be successful from PropellerIDE I would start to suspect hardware problems, perhaps even a ground loop problem. Can you try powering the board from the same laptop just to check if that is any better?
  • @Peter - it's going forward. It seems that I had a problem with my SD card. I now killed the next one :-) I will reformat them later

    There is another issue: How to set IP configuration?
    AFAICS:
    &192.168.2.1 == myGW
    &192.168.2.124 == myIP
    &255.255.255.0 == mySN
    WCOLD could do - but doesn't.

    ifconfig returns:
    LINK DOWN
    HARDWARE: WIZnet W5500 V0
    SRC IP    000.000.000.000
    MASK      000.000.000.000
    GATEWAY   000.000.000.000
    MAC       00.00.00.00.00.00.
    

    BTW is there a word to print dotted decimals a la &123.321.1.2 ?
  • MJBMJB Posts: 1,235
    edited 2017-04-22 08:10
    proplem wrote: »
    @Peter - it's going forward. It seems that I had a problem with my SD card. I now killed the next one :-) I will reformat them later

    There is another issue: How to set IP configuration?
    AFAICS:
    &192.168.2.1 == myGW
    &192.168.2.124 == myIP
    &255.255.255.0 == mySN
    WCOLD could do - but doesn't.

    ifconfig returns:
    LINK DOWN
    HARDWARE: WIZnet W5500 V0
    SRC IP    000.000.000.000
    MASK      000.000.000.000
    GATEWAY   000.000.000.000
    MAC       00.00.00.00.00.00.
    

    BTW is there a word to print dotted decimals a la &123.321.1.2 ?

    @Proplem
    as quoted often: "just check the source" ;-)
    if you can print it with ifconfig then there is the answer ...
    
    pub ifconfig
    	0 sktbuf $40 @COMMON LREAD	\ read in common registers
     	BOLD
    	CR PRINT" NETWORK STATUS:" PLAIN
     	CR PRINT" LINK " 		1 $2E @SKTBUF SET? IF PRINT" *UP*" ELSE PRINT" DOWN" THEN
    	CR PRINT" HARDWARE: " PCB$ PRINT$ PRINT"  using WIZnet W5500 V" $39 @SKTBUF C@ .
     	CR PRINT" SRC IP "	$0F .IP
     	CR PRINT" MASK   "	5 .IP
     	CR PRINT" GATEWAY"	1 .IP
    	CR PRINT" MAC       "	9 @SKTBUF 6 ADO I C@ .BYTE PRINT" ." LOOP
    pub .SOCKETS
    	.SKTHD 8 0 DO I .SKT LOOP CR
    	;
    
    
    
    BOLD does not work inside [ code] ...
    so it is .IP

    EDIT: was too fast again ;-( .IP does not print the & ...

    but a quick search for '&' EMIT showed:
    
    pub .PPNET
    	$33 C@ '&' EMIT >N 2 .DEC
    	$32 C@ '." EMIT 2 .DEC
    	$31 C@ '." EMIT 2 .DEC
    	$30 C@ '." EMIT 2 .DEC
    	SPACE
    	'@' EMIT CLKFREQ $34 @ / 0 PRINTDEC
    	;
    

    so if you remove the last line it should do what you want ...

    EDIT: maybe not exactly ;-(

    try this q&d hack
    pub .&    '&' EMIT  4 FOR  8 ROL DUP  >B . IX 1 > IF '.' EMIT THEN NEXT DROP     ;
    
    propably Peter has a shorter solution ...
  • proplemproplem Posts: 233
    edited 2017-04-22 09:15
    MJB wrote: »
    @Proplem
    as quoted often: "just check the source" ;-)
    if you can print it with ifconfig then there is the answer ...
    
    pub ifconfig
    	0 sktbuf $40 @COMMON LREAD	\ read in common registers
     	BOLD
    	CR PRINT" NETWORK STATUS:" PLAIN
     	CR PRINT" LINK " 		1 $2E @SKTBUF SET? IF PRINT" *UP*" ELSE PRINT" DOWN" THEN
    	CR PRINT" HARDWARE: " PCB$ PRINT$ PRINT"  using WIZnet W5500 V" $39 @SKTBUF C@ .
     	CR PRINT" SRC IP "	$0F .IP
     	CR PRINT" MASK   "	5 .IP
     	CR PRINT" GATEWAY"	1 .IP
    	CR PRINT" MAC       "	9 @SKTBUF 6 ADO I C@ .BYTE PRINT" ." LOOP
    pub .SOCKETS
    	.SKTHD 8 0 DO I .SKT LOOP CR
    	;
    
    
    
    BOLD does not work inside [ code] ...
    so it is .IP

    EDIT: was too fast again ;-( .IP does not print the & ...

    but a quick search for '&' EMIT showed:
    
    pub .PPNET
    	$33 C@ '&' EMIT >N 2 .DEC
    	$32 C@ '." EMIT 2 .DEC
    	$31 C@ '." EMIT 2 .DEC
    	$30 C@ '." EMIT 2 .DEC
    	SPACE
    	'@' EMIT CLKFREQ $34 @ / 0 PRINTDEC
    	;
    

    so if you remove the last line it should do what you want ...

    EDIT: maybe not exactly ;-(

    try this q&d hack
    pub .&    '&' EMIT  4 FOR  8 ROL DUP  >B . IX 1 > IF '.' EMIT THEN NEXT DROP     ;
    
    propably Peter has a shorter solution ...

    @MJB - thanks to your reply. Of course you are right with "check the source". Definitely yes. I want to explain that I'm permanently short in time and therefore I'm very thankful If someone helps me with something I could investigate myself which I'd have to spend a lot more time. I also agree that I would learn better/faster if I would more often read the source. Nevertheless I can not spend more time on tachyon as I'm currently doing. Often I do have pauses of a few weeks in which I forget again half what I learned in the sessions between. So please help me with a short hint if you can but don't spend much time to figure out things that I can do myself. In these cases I appreciate also the advice "check the source" which is sometimes also helpful.

    Best regards,
    proplem

    PS:
    the q&d hack works fine.
  • MJBMJB Posts: 1,235
    proplem wrote: »
    MJB wrote: »
    @Proplem
    as quoted often: "just check the source" ;-)
    if you can print it with ifconfig then there is the answer ...
    
    pub ifconfig
    	0 sktbuf $40 @COMMON LREAD	\ read in common registers
     	BOLD
    	CR PRINT" NETWORK STATUS:" PLAIN
     	CR PRINT" LINK " 		1 $2E @SKTBUF SET? IF PRINT" *UP*" ELSE PRINT" DOWN" THEN
    	CR PRINT" HARDWARE: " PCB$ PRINT$ PRINT"  using WIZnet W5500 V" $39 @SKTBUF C@ .
     	CR PRINT" SRC IP "	$0F .IP
     	CR PRINT" MASK   "	5 .IP
     	CR PRINT" GATEWAY"	1 .IP
    	CR PRINT" MAC       "	9 @SKTBUF 6 ADO I C@ .BYTE PRINT" ." LOOP
    pub .SOCKETS
    	.SKTHD 8 0 DO I .SKT LOOP CR
    	;
    
    
    
    BOLD does not work inside [ code] ...
    so it is .IP

    EDIT: was too fast again ;-( .IP does not print the & ...

    but a quick search for '&' EMIT showed:
    
    pub .PPNET
    	$33 C@ '&' EMIT >N 2 .DEC
    	$32 C@ '." EMIT 2 .DEC
    	$31 C@ '." EMIT 2 .DEC
    	$30 C@ '." EMIT 2 .DEC
    	SPACE
    	'@' EMIT CLKFREQ $34 @ / 0 PRINTDEC
    	;
    

    so if you remove the last line it should do what you want ...

    EDIT: maybe not exactly ;-(

    try this q&d hack
    pub .&    '&' EMIT  4 FOR  8 ROL DUP  >B . IX 1 > IF '.' EMIT THEN NEXT DROP     ;
    
    propably Peter has a shorter solution ...

    @MJB - thanks to your reply. Of course you are right with "check the source". Definitely yes. I want to explain that I'm permanently short in time and therefore I'm very thankful If someone helps me with something I could investigate myself which I'd have to spend a lot more time. I also agree that I would learn better/faster if I would more often read the source. Nevertheless I can not spend more time on tachyon as I'm currently doing. Often I do have pauses of a few weeks in which I forget again half what I learned in the sessions between. So please help me with a short hint if you can but don't spend much time to figure out things that I can do myself. In these cases I appreciate also the advice "check the source" which is sometimes also helpful.

    Best regards,
    proplem

    actually I also have far too little time for Tachyon ... and everything else ;-)
    but sometimes I get curious and want to know myself.
    I have a hard time after I knew Tachyon V1 and V2 quite well to keep up with Peter's fast pace in changing and advancing Tachyon.
    With V4 I have to relearn much of the kernels internals again ...
  • @Peter Jakacki,
    - AFAICS there is no .& in kernel or EXTEND. Maybe you could add MJB's version three posts before?
    - second: there seems no UMOUNT or EJECT to be existing. Wouldn't this be necessary? I'm always unsure changing an sd card during operation and I think it's no good idea to do.
  • MJBMJB Posts: 1,235
    proplem wrote: »
    @Peter Jakacki,
    - AFAICS there is no .& in kernel or EXTEND. Maybe you could add MJB's version three posts before?
    - second: there seems no UMOUNT or EJECT to be existing. Wouldn't this be necessary? I'm always unsure changing an sd card during operation and I think it's no good idea to do.

    if you FLUSH and close the open files then it is safe to eject the SD card.
    Since Peter makes normally no use of the FAT itself, just writing sectors,
    after FLUSH of the actual buffer taking the SD out is safe.
    And the APPEND word scans a file for an empty sector / EOF ($00)
    so there is no need for writing the actual file size all the time.
    If you understand how it works internally, and you use tit right, then you gain some 'peace of mind' ;-) - and can just pull the SD card out any time.
  • Doesn't this work anymore in V43
    " this is a string" 0 STRING str$
    str$ PRINT$
    
    or is something totally weird with my setup?
  • proplem wrote: »
    Doesn't this work anymore in V43
    " this is a string" 0 STRING str$
    str$ PRINT$
    
    or is something totally weird with my setup?

    No, STRING has not been implemented properly yet but that's easily fixed. You may have noticed that I don't use the STRING construct in my V4 Forth code as it was easy enough to just allocate memory but the real reason is that I'm not happy about having two types of strings with no way of telling if one has a preceding max count or not. Now if the string always had a end stop with the 8th bit set then the null terminator could be anywhere in between. But for that to work properly all strings would have to be the same. So I find it easier I think if I make STRING not worry about maximum size, so therefore there is no need for ERASE$ which would wipe the whole string buffer but needed to know the size.

    But STRING is very good for creating a string constant at compile time as these strings can be passed as message etc. So the V4 version may just skip the maximum count internally although we would still specify it so memory can be allocated. We just know it's maximum size from the source, It's a bit like the Propeller chip, it doesn't have something built-in that says it only has 32k RAM, we just know it does from the datasheet.

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-23 17:35
    @proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
    ( 0001 $3002  ok )   " HELLO" 0  STRING A$
    
    ( 0002 $300A  ok )   A$ PRINT$
    HELLO
    ( 0003 $300A  ok )   
    ( 0004 $300A  ok )   " SECRET" 32 STRING PASS$
    
    ( 0005 $302E  ok )   PASS$ PRINT$
    SECRET
    ( 0006 $302E  ok )   " DOUBLESECRET" PASS$ $!   PASS$ PRINT$
    DOUBLESECRET
    ( 0007 $302E  ok )   " 007" PASS$ APPEND$    PASS$ PRINT$
    DOUBLESECRET007
    ( 0008 $302E  ok )   PASS$ 3 RIGHT$ PRINT$
    007
    ( 0009 $302E  ok )   
    
    pub STRING ( str max -- ) IMMEDIATE
    	[C] CREATE
    	HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
    	CALL ( here str max )
    	SWAP LEN$ MAX
    	OVER + 3 + 2 ALIGN uhere W!
    	' VAR SWAP W!
    	;
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-24 04:22
    REVECTOR words in V4 easily

    I mentioned before how wordcode allows us to revector any wordcode definition very easily as all we need to do is write the new vector to the first word of the wordcode. Here is an example of this in action for when we have EASYFILE loaded and we would like an LED connected to indicate that the card is busy. EASYFILE has a dummy function called SDBUSY that normally drops the ON/OFF flag passed to it. Here in this example we define a function to handle the LED being sourced from P0 and then write the address/vector of that to SDBUSY.
    pri BSYLED	0 PIN! ;
    ' BSYLED ' SDBUSY W!
    
    Now whenever you access the SD card the LED on P0 will flash. If you wanted the LED connected to VDD instead of ground then a simple NOT is all that you require in BSYLED before 0 PIN!

    In the case of SDBUSY the default definition was simple and it didn't matter if the new function returned:
    pub SDBUSY  DROP ;
    
    However for most functions or even all functions you can change the vector to a jump instead of a call simply by setting its lsb which is easily done if you add 1.
    ' BSYLED 1+ ' SDBUSY W!
    

    Here is how a jump is done (before and after)
    ( 0087 $421A  ok )   SEE SDBUSY
    
    30E8 BSYLED
    30EA EXIT
    ' BSYLED 1+ ' SDBUSY W!
    ( 0088 $421A  ok )   SEE SDBUSY
    
    30E8 GOTO BSYLED
    30EA EXIT
    

    A more complex example where LEDs are connected over I2C can be found in the SDLEDS.FTH file in the V4 folder.
    EDIT: I have now defined REVECTOR in EXTEND as a standard word with a from/to syntax just like ALIAS etc.
    REVECTOR SDBUSY BSYLED
    
  • Handling module initializations on reset.

    Normally the AUTORUN vector on reset points to BOOT in EXTEND but after loading other modules we have redirect AUTORUN to our own boot routine which then needs to call BOOT. Rather than doing this I have introduced +INIT so that modules may add their INIT vector to the list which is handled by BOOT as the last thing it does. This means that small routines that may need to setup hardware can be included and also the main application autostart can now just be added as a +INIT also. This list does not depend upon the dictionary although a check will be made to make sure that the code pointer HERE is greater than the INIT vector, just in case we run a FORGET and the init vector points to this section.

    So !PCB has been done away with and up to 16 vectors may be added to the list in code memory so it can be backed up.
    ' !LEDS +INIT
    ' !PCB +INIT
    ' MOUNT +INIT
    ' EASYNET +INIT
    
  • @Peter Jakacki - new challenge. ALLOT : I already used that ... hmm
    @proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
    ( 0001 $3002  ok )   " HELLO" 0  STRING A$
    
    ( 0002 $300A  ok )   A$ PRINT$
    HELLO
    ( 0003 $300A  ok )   
    ( 0004 $300A  ok )   " SECRET" 32 STRING PASS$
    
    ( 0005 $302E  ok )   PASS$ PRINT$
    SECRET
    ( 0006 $302E  ok )   " DOUBLESECRET" PASS$ $!   PASS$ PRINT$
    DOUBLESECRET
    ( 0007 $302E  ok )   " 007" PASS$ APPEND$    PASS$ PRINT$
    DOUBLESECRET007
    ( 0008 $302E  ok )   PASS$ 3 RIGHT$ PRINT$
    007
    ( 0009 $302E  ok )   
    
    pub STRING ( str max -- ) IMMEDIATE
    	[C] CREATE
    	HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
    	CALL ( here str max )
    	SWAP LEN$ MAX
    	OVER + 3 + 2 ALIGN uhere W!
    	' VAR SWAP W!
    	;
    

    I want to define a fixed length string buffer say 100 bytes. Hmm. Reading sources ...
    Ok:
    " Hello" $FF STRING txline$
    
    could be replaced by something like:
    $FF BYTES txline$
    
    Now I have to concatenate:
    This
    myruntime @ NUM>STR txline$ APPEND$ 32d txline$ +CHAR
    
    isn't working because NUM>STR is gone with the wind.

    Peter I can't believe that in V4 we have to write our own number to text conversion don't we ;-))

  • MJBMJB Posts: 1,235
    edited 2017-04-24 20:37
    proplem wrote: »
    @Peter Jakacki - new challenge. ALLOT : I already used that ... hmm
    @proplem - I've updated EXTEND with the STRING word that now works just like the old one except it only uses the max count for allocating string space, it doesn't bother saving this parameter before the start of the string like the old one.
    ( 0001 $3002  ok )   " HELLO" 0  STRING A$
    
    ( 0002 $300A  ok )   A$ PRINT$
    HELLO
    ( 0003 $300A  ok )   
    ( 0004 $300A  ok )   " SECRET" 32 STRING PASS$
    
    ( 0005 $302E  ok )   PASS$ PRINT$
    SECRET
    ( 0006 $302E  ok )   " DOUBLESECRET" PASS$ $!   PASS$ PRINT$
    DOUBLESECRET
    ( 0007 $302E  ok )   " 007" PASS$ APPEND$    PASS$ PRINT$
    DOUBLESECRET007
    ( 0008 $302E  ok )   PASS$ 3 RIGHT$ PRINT$
    007
    ( 0009 $302E  ok )   
    
    pub STRING ( str max -- ) IMMEDIATE
    	[C] CREATE
    	HERE DUP DUP @NAMES NFA>BFA W! ALLOCATED
    	CALL ( here str max )
    	SWAP LEN$ MAX
    	OVER + 3 + 2 ALIGN uhere W!
    	' VAR SWAP W!
    	;
    

    I want to define a fixed length string buffer say 100 bytes. Hmm. Reading sources ...
    Ok:
    " Hello" $FF STRING txline$
    
    could be replaced by something like:
    $FF BYTES txline$
    
    Now I have to concatenate:
    This
    myruntime @ NUM>STR txline$ APPEND$ 32d txline$ +CHAR
    
    isn't working because NUM>STR is gone with the wind.

    Peter I can't believe that in V4 we have to write our own number to text conversion don't we ;-))

    you can easily define a string-output-stream by revectoring EMIT to
    BYTE bufptr
    $FF BYTES mystr
    pub EMIT2$ ( char .. ) mystr bufptr + C!  bufptr C++ ;
    pub to$ ' EMIT2$ uemit W! ;
    
    ///  then   
    to$
    ///  now you can use any print routines redirected to your string ... 
    CON /// resets to normal EMIT
    
    I did a generalized version of this for T2, but would need to search for it ...
    but this should do

    the beauty of FORTH / Tachyon :-)
  • Hmmm again, unbelievably that there's this routine from V3, and that it can be used as is in V4:
    16 bytes NUM$
    pub NUM>STR ( num -- str )	<# #S #> NUM$ 16 CMOVE NUM$ ;
    

    Thanks for persisting with this proplem, I know that you have many other things on your plate. However as MJB pointed out there are requirements where the nice and easy to use "automatic targeting" systems won't cut the mustard. If that's all that the "don't mess with it yourself, let me do it all for you" compiler will do then you're stuck with it. But like Luke we can use the "Forth", although he had to be reminded that it was there. When he did it saved his bacon.

    Try the code that MJB posted and since you have the Forth you can even enhance your X-wing fighter as a proper string output device to recognize new lines etc.

    Use the Forth
    829 x 361 - 25K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-25 02:58
    Some recent changes and notes

    I think I need to have a Tachyon blog running where I can make announcements etc...

    Anyway, as I haven't been so sidetracked lately I've been updating various sections of Tachyon which should be a cause, not for dismay, but for joy joy, really.

    Virtual file memory
    A while back I updated EASYFILE to handle virtual file memory as opposed to virtual SD memory. As you know a 32-bit pointer will only read 4GB and many SD cards are larger than that and a problem occurs if a file is on a sector that >4GB, and then the FILE@ and XC@ operators etc cannot work properly. This was fixed in Tachyon for the P2 and only recently I updated EASYFILE with virtual file memory. So even though the old FILE@ and XC@ type words are still there, they are being deprecated in favor of filesystem words such as FSC@ to read a byte from a file etc. Rather than FILE@ I am using FSECT@ to return with the starting sector of the file, since in EASYFILE it assumes (and never fails) to find all file sectors consecutive.

    Immediate words
    Standard Forth also uses a : to start a new definition which from the start I augmented with pub and pri which later did differentiate a definition so that private headers could be automatically removed with RECLAIM. But there were also pub or : words that could have their IMMEDIATE attribute set as these needed to be executed as they were encountered rather than be compiled. Such words as IF ELSE THEN BEGIN AGAIN WHILE REPEAT etc are all such immediate words. But I find IMMEDIATE distracting and unnecessary when we could just as easily substitute the pub or colon for another word which says this should be public and immediate. I've chosen "pre" in keeping with the three letter p words and short for preemptive. So instead of saying:
    pub REVECTOR IMMEDIATE
    
    We can now say
    pre REVECTOR
    

    Some other points have already been mentioned in other posts. I may "blog" these notes into a Tachyon document at least with a table of contents but as always having some help from all you Tachyon users is only of help if you actively edit and add content rather than maybe just commenting on formatting etc. This may mean you will need to sign in to Google to edit a document, but don't be afraid to do so. Remember though that this is more of an on-line document and not really intended to be printed and pretty, just make it functional first. If you have a suggestion then I may not have time to read and fully understand or implement what you are suggesting, so just add it in and like me you will also find that while it serves as a basis for the present, you will find better ways of presenting that information.

    btw - On comp.lang.forth which I infrequently read due to its focus on PCs and the language itself rather than what it is most useful for (getting things done), there was a post about a "Forth Pet" but I think they meant mascot. However I quite like the rebel fighter as a Forth icon with the "Use the Forth" caption. What do you think?

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-04-25 02:50
    Latest V4 startup screen

    I like the way that the init list runs at startup, it is much more versatile than a single AUTORUN vector.
    Tachyon has always displayed system information at startup. Now I am just adding and filling in some more details such as
    initializations, Modules, ROMS, I2C devices, Clock frequency, Forth stats etc.

    V4 also uses single keystroke commands which are most useful for those odd control characters too. There's a summary at the end of this post.
    edit: .& to print in IP notation has been added to EXTEND (different from EASYNET's version as the digits are in big endian order in the Wiznet).

    System before COMPACT which moves dictionary to EEPROM after which almost 12kB is free even with filesystem and buffers etc.
    Propeller .:.:--TACHYON--:.:. Forth V4.3 DAWN 430170415.0000
    
    MODULES LOADED: 
    3274: EASYFILE.fth        SD card  + FAT32 Virtual Memory Access File System Layer V1.2 170424-0000 
    1A80: EXTEND.fth          Primary extensions to TACHYON+ kernel  - 170425-1200
    
    AUTORUN BOOT
    FREQ = 80.0MHz
    *** INITS ***
    INIT#0 326E !RXLED
    INIT#1 3790 MOUNT
    Loading cog 3 E506 F32     
    *** ROMS ***
    0,848 VGA32x15  
    0,388 HSUART    
    1,900 F32       
    *** I2C ***
    40 I/O EXPANDER
    A0 EEPROM
    AE RTC EEPROM
    DE MCP79410
     CODE:$415C =16220 bytes   NAME:$53D4 =8236 bytes   DATA:$7929 =793 bytes    =4728 bytes free    Data Stack (0)
    
    
    --------------------------------------------------------------------------------
    ( 0001 $415C  ok )   ls
    
    WIDGET     
    128K    .BIN   256K    .BIN   DEBUG   .ROM   EASYFILE.FTH   EASYNET .FTH   
    ECOLCD  .PDF   EXTEND  .FTH   FAVICON .ICO   FIRMWARE.ROM   FRED    .PNG   
    FSRPCB  .PNG   FSRSCH  .PNG   HELP    .TXT   HOME    .HTM   HTTP404 .HTM   
    IMAGE          IMAGE1         IMAGE2         IMAGE3         IOT5500 .HTM   
    LOGON   .HTM   LOVE    .MP3   P8      .H     P8X32A  .PDF   POPCORN .MP3   
    PREVIOUS.ROM   SDCARD  .FTH   SITE0001.LOG   SITE0002.LOG   SITE0003.LOG   
    SITE0004.LOG   SYSLOG  .TXT   TACHYON .HTM   W5200   .FTH   W5500   .FTH   
    WELCOME .TEL   LOVE    .WAV   POPCORN .WAV   WARPEACE.TXT   COMPACT .FTH   
    SEE     .FTH   SDLEDS  .FTH   RXLED   .FTH   TEMP    .TXT   LANLED  .FTH   
    FL      .FTH   LIFE    .FTH   SPLAT   .FTH   DRAGON  .JPG   CE1372  .JPG   
    CHARLCD .JPG   HCB4208 .JPG   IOT5500 .JPG   IOT5500H.JPG   IOTPINS .JPG   
    P8CPU   .JPG   PARALLAX.PNG   
    ( 0002 $415C  ok )
    


    Control and shortcut keys
    ^A Abort autorun
    ^B Block dump all of hub RAM
    ^C Reboot
    ^D Debug - list registers etc
    ^E Dump Cog memory
    ^F
    ^G
    ^H backspace
    ^I tab
    ^J <ignored>
    ^K
    ^L
    ^M enter
    ^N
    ^O
    ^P Dump hub memory ( addr cnt -- )
    ^Q Quick dump 32 bytes ( addr -- )
    ^R
    ^S Stack clear
    ^T
    ^U User register Dump
    ^V Print Version
    ^W Words (same as WORDS)
    ^X Re eXecute last non-blank line
    ^Y
    ^Z Cold start on two consecutive ^Zs
    ^[ Escape - cancel line entry
    ^\
    ^]
    ^^
    ^_
    
    $	Hex digits
    #	Decimal digits
    %	Binary digits
    &	IP notation
    0..9	Auto number
    A..F	Auto number if $ used
    .,_	digit separator
    
Sign In or Register to comment.