2026-06-24 02:16:19 : square does> drop dup * ; ok : sq ; ok 6 sq . 6 ok 6 square . 6 ok 6 sq . 36 ok 2026-06-24 04:28:26 Stalevar, what are you doing with DOES> without CREATE (ANS) or tabemann, gforth 2026-06-24 04:30:06 raw does> overwrite code of last defined word 2026-06-24 04:30:11 I'm surprised that doesn't cause a crash 2026-06-24 04:31:32 in zeptoforth at least DOES> requires I can even run does> drop dup * ; to make last compiled word square the number 2026-06-24 04:32:53 then the question is, why on earth would you want to do that with anything other than CREATE (ANS) or the whole point of DOES> is so you can write things like : make-adder create , does> @ + ; 2026-06-24 04:34:06 or, in zeptoforth or Mecrisp-Stellaris, : make-addr @ + ; 2026-06-24 04:34:52 *make-adder 2026-06-24 04:35:09 so that you can then execute, say, cell make-adder cell+ 2026-06-24 04:36:16 I was just trying to understand what DOES> does 2026-06-24 04:36:23 of course, in zeptoforth you're better off writing : make-adder { x -- } : x postpone literal postpone + postpone ; ; 2026-06-24 04:36:48 as that will generate faster code 2026-06-24 04:38:02 It doesn't crash zeptoforth, it said no word is being built and even colors it red (how did it know what terminal was behind ttyACM0? ) 2026-06-24 04:39:53 it doesn't know, it just assumes that all terminals in this day and age support ANSI 2026-06-24 04:40:31 If it was cmd in windows 8.x or earlier it wouldn't? 2026-06-24 04:40:55 it assumes that people aren't actually using VT52's or Windows 8 2026-06-24 04:41:16 anyway, those probably will just print garbage instead of crashing 2026-06-24 04:41:27 yeah 2026-06-24 04:41:41 you'll see the ANSI color codes 2026-06-24 04:42:30 ... And that the programmer doesn't ever use script(1) to capture the interactive session in a /readable/ form... 2026-06-24 04:42:37 I don't get why some forths use create and other tabemann, what does raw create do in mecrisp and zepto? 2026-06-24 04:44:16 Stalevar, the reason why zeptoforth uses is that DOES> can't overwrite a word once it's compiled to flash, so it needs a special "empty" word to be created 2026-06-24 04:44:23 In Gforth it would take next word from input buffer and put it into dictionary, while following does> fills its code section, as far as I understand 2026-06-24 04:44:28 raw CREATE, though, is used for creating constant arrays 2026-06-24 04:45:00 iv4nshm4k0v, you can turn off colors in zeptoforth if you want 2026-06-24 04:45:32 tabemann, by the way how does it know width of my terminal window? 2026-06-24 04:45:46 if you want to allocate a block of memory as a buffer, though, the recommended approach is to use BUFFER: 2026-06-24 04:46:11 Many command line apps would break when run through ttyS / ttyUSB / ttyACM because they don't know the window size 2026-06-24 04:46:12 Stalevar, it does by trying to move the cursor to an absurd coordinate, and then reading the actual cursor coordinate 2026-06-24 04:46:52 however, WORDS and company assumes that the terminal is 80 characters wide unless told otherwise 2026-06-24 04:46:55 can I ask zeptoforth window size to see if it works? 2026-06-24 04:48:30 Stalevar, execute ANSI-TERM::GET-TERMINAL-SIZE ( -- rows columns ) 2026-06-24 04:50:44 $ stty -a 2026-06-24 04:50:44 speed 38400 baud; rows 31; columns 122; line = 0; 2026-06-24 04:52:11 one thing is that it breaks if you try to use it with a "terminal" that doesn't support reading the current coordinate 2026-06-24 04:54:06 Actually, zeptoforth sends awful lot of ansi controls, it seems 2026-06-24 04:54:27 if you're using ENABLE-LINE it sends them every line 2026-06-24 04:55:21 if you're not using ENABLE-LINE it only sends ANSI proper when changing colors, but it also sends ACK at the end of a line and NAK if there is an error (along with a BEL) 2026-06-24 04:55:31 mind you, all of these things can be turned off 2026-06-24 04:55:47 Yeah, I compiled enable-line to flash. 2026-06-24 04:56:48 Also my zeptoforth dongle doesn't light the LED up, unlike when it was micropython, but it was too bright. 2026-06-24 04:57:44 what GPIO is the LED on? 2026-06-24 04:57:53 and also, is it active high or active low? 2026-06-24 05:00:42 https://pastebin.com/raw/aNQC06pX 2026-06-24 05:01:01 That's main.py from when it run micropython 2026-06-24 05:02:29 can it light up a little to indicate power is on without blinding? 2026-06-24 05:04:18 it's using a WS2812; for that there is extra/rp_common/neopixel.fs 2026-06-24 05:05:47 Stalevar, yes, by setting the colors to something dim 2026-06-24 05:05:53 Is it already in image 16m full? 2026-06-24 05:06:40 no, you have to load it yourself, as with all things in extra/ (except for things, which this is not one of, installed by the PicoCalc installers, if you're using a PicoCalc) 2026-06-24 05:12:22 OK, disable-line, paste, enable-line; it has : init-neopixel { init-sm init-pio init-count init-pin addr -- } ok 2026-06-24 05:12:59 I guess I need to provide some numbers and call init-neopixel 2026-06-24 05:13:18 use -1 for init-sm and init-pio 2026-06-24 05:13:50 What about init-count and init-pin? 2026-06-24 05:14:01 and addr of what? 2026-06-24 05:14:22 addr is the address of a BUFFER: of NEOPIXEL::NEOPIXEL-SIZE ( count -- bytes ) 2026-06-24 05:14:58 init-count is the number of neopixels in a string you're supporting -- for your board it will be 1 2026-06-24 05:15:23 init-pin is the GPIO index for the GPIO you have your neopixel hooked up to 2026-06-24 05:16:29 Python mentions 17 and 25 GPIO 2026-06-24 05:16:39 one might be power 2026-06-24 05:16:58 led_onboard2.value(1) 2026-06-24 05:17:09 So 25 is power 2026-06-24 05:17:25 And how do I get 25 on in this? 2026-06-24 05:18:22 yeah 2026-06-24 05:19:18 25 PIN::OUTPUT-PIN PIN::HIGH 25 PIN::PIN! 2026-06-24 05:28:19 or just import PIN and then later 25 OUTPUT-PIN HIGH 25 PIN! 2026-06-24 05:31:01 create npxbuf 20 allot ok 2026-06-24 05:31:15 25 pin::output-pin pin::high 25 pin::pin! ok 2026-06-24 05:31:15 -1 -1 1 17 npxbuf neopixel::init-neopixel ok 2026-06-24 05:31:21 Nothing visible happens 2026-06-24 05:31:48 you need to call npxbuf neopixel::update-neopixel 2026-06-24 05:32:24 Still nothing 2026-06-24 05:33:19 also, the CREATE ... ALLOT idiom is deprecated in zeptoforth 2026-06-24 05:33:43 the proper way to do it is: 1 NEOPIXEL::NEOPIXEL-SIZE BUFFER: NPXBUF 2026-06-24 05:34:55 hmm... just realized something 2026-06-24 05:35:09 I've never tried this code with an RP2350, so the clock divider is probably off 2026-06-24 05:35:47 the only board I have with a WS2812 is an RP2040 board 2026-06-24 05:38:20 can I test if it works without neopixel module? Let's set it to full brightness or something 2026-06-24 05:39:09 try editing the neopixel module to fix the clock divider 2026-06-24 05:39:56 \ 8000000 Hz ? 2026-06-24 05:40:00 the key line is 160 15 init-sm init-pio sm-clkdiv! \ 8000000 Hz 2026-06-24 05:40:35 8 MHz, and so? 2026-06-24 05:40:53 set it to 12MHz ? 2026-06-24 05:41:01 the problem is it's dividing the system clock, and the RP2350 by default has a faster system clock than the RP2040 2026-06-24 05:41:11 but this code was originally written for the RP2040 2026-06-24 05:41:58 pio::sm-clkdiv! ( fractional integral state-machine pio -- ) 2026-06-24 05:44:52 25 pin::output-pin pin::high 25 pin::pin! ok 2026-06-24 05:44:52 import neopixel stack underflow 2026-06-24 05:44:53 100 100 100 0 npxbuf neopixel! ok 2026-06-24 05:44:55 npxbuf update-neopixel ok 2026-06-24 05:44:57 Still nothing 2026-06-24 05:45:18 I have replaced 8 with 12 because crystal on my board said 12.000 MHz 2026-06-24 05:45:39 nah 2026-06-24 05:46:18 the WS2812 PIO program expects to be clocked at 8 MHz 2026-06-24 05:46:30 this has nothing to do with the crystal on your board 2026-06-24 05:46:43 the problem is the system clock is faster than this code expects 2026-06-24 05:47:24 It is running PWM on the GPIO to lower the intensity, right? 2026-06-24 05:47:43 How do I just run it full on to se if I can get leds to light up at all? 2026-06-24 05:49:02 the system clock of the RP2350 by default is 150 MHz, whereas for the RP2040 it is 125 MHz 2026-06-24 05:49:15 don't use PWM for this, it won't work 2026-06-24 05:49:51 the problem is the clock is wrong, so the WS2812 isn't working right 2026-06-24 05:50:40 So it's overly smart led, I thought it were just three leds in one package 2026-06-24 05:54:00 no 2026-06-24 05:54:24 you encode the color in a signal sent on a single wire to the LED 2026-06-24 05:54:39 I can see darker spot in the middle. Could I have already killed the LED thing? 2026-06-24 05:55:15 nah, you wouldn't've killed it 2026-06-24 05:55:24 The led module has four legs 2026-06-24 05:55:56 yes, data in, data out, power in, and ground 2026-06-24 05:56:19 the reason why there's a data out is that this is used to string multiple LED's together 2026-06-24 05:56:31 It has data out? Hmm... what data can it send? It's just led block 2026-06-24 05:57:18 So data out should be unused 2026-06-24 05:58:21 no 2026-06-24 05:59:01 each time you send a pixel value to its data in, it sends its current pixel value to its data out 2026-06-24 05:59:56 this is why you can string multiple WS2812's together 2026-06-24 06:00:13 because you attach each one's data out to the next one's data in 2026-06-24 06:00:57 So you send data to last one, then pre-last one and so on and to first one, it will consequtively pushed down the line? 2026-06-24 06:01:23 yes 2026-06-24 06:01:35 you have to send the last LED's value first, and the first LED's value last 2026-06-24 06:11:15 Wait, 160 15 init-sm init-pio sm-clkdiv! and I edited the comment. Of course nothing changed, huh 2026-06-24 06:11:34 125MHz/800kHz = 156.25 2026-06-24 06:12:02 150MHz/800kHz = 187.5 2026-06-24 06:12:11 tabemann, what 15 does? 2026-06-24 06:12:26 Why is it 160 instead of 156? 2026-06-24 06:13:31 pio::sm-clkdiv! ( fractional integral state-machine pio -- ) 2026-06-24 06:13:49 wait a second, the pin's 23, not 17 2026-06-24 06:14:12 15 is integral, 160 is fractional 2026-06-24 06:14:34 15.160 ? 2026-06-24 06:14:40 or what fraction? 2026-06-24 06:15:31 >>> 125_000_000 / (15 + (160 / 256)) 2026-06-24 06:15:55 gives 8000000 2026-06-24 06:18:03 192 18 2026-06-24 06:18:57 yes 2026-06-24 06:19:01 and try GPIO 23 2026-06-24 06:21:50 but python code seems like decimal? 2026-06-24 06:23:15 Python does calculations behind the scenes whereas zeptoforth just plugs in the values 2026-06-24 06:24:04 Then power is also not 25 but 37? 2026-06-24 06:24:45 power may just be hard-wired 2026-06-24 06:25:12 but leave the 25 in place as-is 2026-06-24 06:25:31 I have tried to turn both 37 and 25 on but nothing so far 2026-06-24 06:27:24 do you have access to a schematic of the board? 2026-06-24 06:27:45 try using GPIO 22 actually 2026-06-24 06:27:51 there may be a typo in the comments 2026-06-24 06:28:13 -1 -1 1 22 npxbuf init-neopixel 2026-06-24 06:29:55 https://ae01.alicdn.com/kf/Sc7c5f2ccf5994c2aa5fd05625099692eq.png 2026-06-24 06:32:02 it's GPIO 22 2026-06-24 06:32:24 https://ae01.alicdn.com/kf/S90e241e0ce3e4833b20f1a5e8806dd4af.png 2026-06-24 06:32:32 What about power? 2026-06-24 06:33:57 power may be hardwired 2026-06-24 06:34:07 i.e. not to a GPIO 2026-06-24 06:34:19 same thing with GND 2026-06-24 06:34:42 as that image you linked didn't say anything about power or GND 2026-06-24 06:34:51 for the WS2812 2026-06-24 06:35:05 Then why python code pokes 17 and 25? 2026-06-24 06:36:03 25 is the Pico's LED GPIO 2026-06-24 06:36:09 17, I don't know 2026-06-24 06:36:48 oh, there may be an LED at 17 that it flashes once it's done 2026-06-24 06:37:11 or it may just be toggling an output not tied to an LED 2026-06-24 06:38:02 hmm I don't see anything about GPIO 17 in those images 2026-06-24 06:38:04 OK, it shines like crazy now, I have tried it again 2026-06-24 06:38:09 Maybe 25 turns it off? 2026-06-24 06:38:48 25 shouldn't turn it off 2026-06-24 06:39:31 you can change its color 2026-06-24 06:40:15 but yeah, WS2812's are really damn bright 2026-06-24 06:42:16 0 1 0 0 npxbuf neopixel! ok 2026-06-24 06:42:16 npxbuf update-neopixel ok 2026-06-24 06:42:29 This is more like my speed, than 255 255 255 2026-06-24 06:45:58 Only question is why it didn't work the first time when did the same 2026-06-24 06:46:34 neopixel-init with same buff twice with different gpio isn't supported? 2026-06-24 06:48:03 All three are on bottom, so dark spot I noticed on the die was probably the control chip 2026-06-24 06:48:26 I mean, with 1 1 1 I can see where the actual leds are without blinding myself 2026-06-24 06:50:46 I don't recommend attempting to run init-neopixel more than once on the same buffer 2026-06-24 06:52:21 Either way it was 22 2026-06-24 06:54:01 It's using SPI to bit-bang the ws 2812 fast enough? 2026-06-24 06:54:43 it's using PIO to do so 2026-06-24 06:55:11 PIO is designed for very tightly-controlled bit banging independent of the main CPU's 2026-06-24 06:58:26 That's pretty advanced for device which costs as much as cheapest USB flash drive 2026-06-24 06:59:42 it's weird to think that a $1 USD MCU today is significantly more powerful than, say, the Mac 512K when it came out, which costed thousands of dollars *in the money of that day* 2026-06-24 07:03:14 Now, I need to know how to do a delay or something 2026-06-24 07:03:28 Then I can make LED blink in interesting patterns 2026-06-24 07:04:43 MS ( ms -- ) 2026-06-24 07:04:48 1000 MS waits a second 2026-06-24 07:06:23 there's also TASK::DELAY, which is useful in some cases (e.g. if you want to keep a steady pace, and it also has 100 us resolution rather than 1 ms resolution, but it is more unwieldy) 2026-06-24 07:07:00 ( delay start task -- ) 2026-06-24 07:07:50 where delay is the number of ticks after start to delay, where start is a value in ticks based on SYSTICK::SYSTICK-COUNTER, and task is the task you want to delay (TASK::CURRENT-TASK for the current task) 2026-06-24 07:13:58 begin 255 0 0 0 npxbuf neopixel! npxbuf update-neopixel 333 ms 0 255 0 0 npxbuf neopixel! npxbuf update-neopixel 333 ms 0 0 255 0 npxbuf neopixel! npxbuf update-neopixel 333 ms again 2026-06-24 07:17:44 just so you know, if you execute the last one, you can break out of it without rebooting by entering: control-T z 2026-06-24 07:18:12 you may want to do KEY? UNTIL KEY DROP instead of AGAIN though 2026-06-24 07:20:13 Stalevar, okay, I do plan on hitting the sack soon 2026-06-24 07:20:53 What happens when I hit ^C ? 2026-06-24 07:21:00 connection breaks but led keep shining 2026-06-24 07:21:39 control-C reboots 2026-06-24 07:22:07 but the LED is powered from USB and is unaffected by the MCU rebooting as long as power is applied 2026-06-24 07:23:10 control-T z does not reboot but rather raises an exception that returns control to the REPL 2026-06-24 07:23:47 however, it can fail if something catches the exception without reraising it, or if something does not properly clean up after itself when the exception is raised, breaking things 2026-06-24 07:25:07 Also Home key doesn't seem to work 2026-06-24 07:25:15 or I broke the terminal earlier 2026-06-24 07:26:11 what are you trying to do with Home? 2026-06-24 07:26:32 many terminal emulators catch control-A, often requiring you to enter control-A twice if you want to use it 2026-06-24 07:26:59 so if you're trying to use control-A in the line editor and wondering why it's not working 2026-06-24 07:27:13 I know both picocom and GNU Screen do this 2026-06-24 07:27:28 : shine ( r g b -- ) 0 npxbuf neopixel! npxbuf update-neopixel ; ok 2026-06-24 07:27:28 : blink ( -- ) 0 5 10 begin 1 ms 2 0 do 1+ dup 10 > if drop 0 then rot loop 3dup shine key? until ; ok 2026-06-24 07:29:09 I see, 1 ms was too fast, 50 ms more like it 2026-06-24 07:29:29 1 ms is a one millisecond delay, so yeah 2026-06-24 07:30:56 okay, it's 12:30 pm here and I'm getting tired as I haven't had a lot of caffeine today 2026-06-24 07:31:07 good night 2026-06-24 07:31:17 Thanks for help getting it blinking 2026-06-24 07:31:30 g'night, and have a good time playing around with your WS2812! 2026-06-24 07:33:17 : blink ( -- ) 0 5 10 begin 100 ms 2 0 do 1+ dup 10 > if drop 0 then rot loop 3dup shine key? until 2drop drop ; ok 2026-06-24 07:37:57 It should be 3 0 do actually 2026-06-24 15:21:12 02how is : factorial 1 [a,b] product ; computing a factorial? i have no idea how it could work 2026-06-24 16:02:42 pyzozord, what language is it? did you make sure it is computing factorial? [a,b] doesn't look like valid forth word 2026-06-24 16:02:55 if it was [ ] then it needs to be separated by space 2026-06-24 16:03:21 try see [a,b] 2026-06-24 16:03:25 see product 2026-06-24 16:04:34 : factorial 1 [a,b] product ; 2026-06-24 16:04:35 :9: Undefined word 2026-06-24 16:04:35 : factorial 1 >>>[a,b]<<< product ; 2026-06-24 16:04:42 does not work in gforth as expected 2026-06-24 16:05:13 it makes me think of Factor rather than Forth. 2026-06-24 16:10:40 02Stalevar: it was factor, i figured it out already [a,b] is a word generating a range of numbers 2026-06-24 16:17:05 What is the lifetime of a string created by "#>"? I know "s"" strings are basically pointers to the input field and so should be copied elsewhere immediately, but the wording of "#>" is much more vague. 2026-06-24 16:20:49 lofty, I don't even know how s" " work when not in word 2026-06-24 16:21:28 is : my-string s" my string" ; canonical way to make a string variable? 2026-06-24 16:22:30 in gforth raw s" string" spits out a pointer which seems to live long, maybe forever until interpreter is restarted 2026-06-24 16:22:34 the FILE word set defines interpretation semantics for "s"" as 2026-06-24 16:22:35 > Parse ccc delimited by " (double quote). Store the resulting string in a transient buffer c-addr u. 2026-06-24 16:22:59 so in practice it's a reference to the input buffer 2026-06-24 16:23:30 Is it supposed to die when you press enter? It doesn't in gforth 2026-06-24 16:24:07 no, but it probably dies when you interpret another "s"" string 2026-06-24 16:26:11 Nope, it doesn't, in gforth. I'm not sure if it's ever freed at all 2026-06-24 16:57:56 tabemann, edit in zeptoforth is even harder to leave than vi. I found it exits by ^V accidentally. How hard would it be to add hints like in nano? 2026-06-24 16:58:52 In vi everybody knows :q! but in this it just types :q! 2026-06-24 16:59:06 And I have no idea if it's saved anywhere in flash now or anything 2026-06-24 16:59:37 Though address suggests it edits near the dictionary area by default 2026-06-24 18:59:43 lofty: 3.3.3.6 says the area used for #> may be transient. See https://ccreweb.org/documents/dpans94/dpans3.htm#3.3.3.6 2026-06-24 22:28:46 back 2026-06-24 22:29:19 Stalevar, if you're using zeptoed, you do know that there's online help, right? 2026-06-24 22:30:21 unless you're using the block editor... but frankly I would avoid the block editor as if you're also using a FAT32 filesystem in flash it will corrupt it 2026-06-24 22:32:05 as for the block editor, there is documentation, which is in docs/words/edit.md in the Markdown source 2026-06-24 22:33:44 (just reread what you said, yeah, you're using the block editor) 2026-06-24 23:47:20 Stalevar, part of why the block editor is so limited is that I'm used to editing files in filesystems, which is what zeptoed (which is much more powerful) is for 2026-06-24 23:47:50 so I never really bothered to build much into EDIT