tabemann has joined #forth
dddddd has quit [Ping timeout: 260 seconds]
tabemann has quit [Ping timeout: 265 seconds]
rdrop-exit has joined #forth
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
<MrMobius> crc, do you know how that kind of optimization is done?
<MrMobius> like generally what I should google
jsoft has joined #forth
cheater has quit [Ping timeout: 258 seconds]
cheater has joined #forth
cheater has quit [Changing host]
cheater has joined #forth
cheater has quit [Client Quit]
cheater has joined #forth
reepca has quit [Ping timeout: 255 seconds]
reepca has joined #forth
reepca has quit [Remote host closed the connection]
reepca has joined #forth
reepca has quit [Remote host closed the connection]
tabemann has joined #forth
reepca has joined #forth
reepca has quit [Remote host closed the connection]
reepca has joined #forth
<crc> MrMobius: no idea; I've not looked at the code for it
dave0 has quit [Quit: dave's not here]
reepca has quit [Ping timeout: 260 seconds]
<tabemann> hey crc
<tp> hey tabemann congrats on your Forth progress
<tabemann> now IF THEN ELSE works
<tabemann> *IF ELSE THEN
<tabemann> I tried BEGIN AGAIN and... well... it repeats for a bit, then exits, leaving the RAM dictionary corrupted
<tabemann> BEGIN UNTIL acts funny
<tabemann> okay, this is stupid
<tabemann> the code looks correct, but those just act really weirdly
<tabemann> I thought for a sec that it was . that was the problem, so I tried : foo 0 begin 1 + dup 10 = until ; and it caused it to freeze
<tabemann> my guess is it caused the stack to explode, causing a memfault
<rdrop-exit> good morning Forthwrights :)
<tabemann> hey rdrop-exit
<rdrop-exit> hi tabemann
* tabemann is busy debugging zeptoforth
<rdrop-exit> cool
<tabemann> it now compiles code to RAM and executes it, but loops are acting funny
<rdrop-exit> funny how?
<tabemann> I'm not sure how to describe it; I think it may actually be that something is goofing up the stack, which is interfering with the exit conditions for the loops
<rdrop-exit> I see
<tabemann> : baz 0 begin 1 + dup 10 = until ;
<tabemann> followed by
<tabemann> baz
<tabemann> causes a hang for instance
<rdrop-exit> insert a dup . so you can at least see the progress
<rdrop-exit> I haven't done any Forthing for the past week or so, today I'm looking into the possibility of switching my host forth to x11
<tabemann> making it graphical?
<rdrop-exit> Not graphical, two main reasons are to get key release events and using a special font
<rdrop-exit> I'm getting tired of the limitations of terminals when it comes to keyboard input
<rdrop-exit> I figure x11 is my best bet for key release events that will work with any unix flavor
iyzsong has joined #forth
<tabemann> ah
<rdrop-exit> I haven't done anything with x11 since the 80s, I'm dedicating this afternoon to a refresher
<tabemann> I've never done anything with raw x11
<tabemann> from what I've heard it's best left alone
<tabemann> I've done stuff with GTK+ and OpenGL
<tabemann> old-school OpenGL, not the modern-day fancy schmancy GPU-centric OpenGL of today
<rdrop-exit> X has always been a mess, I'm not sure if there's a viable alternative that will meet my needs across the different unices (including MacOS)
<tabemann> I'd say find a toolkit like GTK+ that fits your needs, write a frontend using it, and communicate with that frontend with sockets or pipes or like to separate your Forth code from the language that the frontend would have to be written in (e.g. C for instance)
<rdrop-exit> I was planning on just writing to the wire protocol
<tabemann> that is another option
<tabemann> except that from what I gather dealing with X11 in the raw is a pain in the ass
<tabemann> thirty-something years of history layered on itself
<rdrop-exit> I used the wire protocol in a project in the 80s, no longer have the code though
<rdrop-exit> I also have an idea for a custom ASCII font I'd like to use
<rdrop-exit> two birds with one stone I'm hoping
<rdrop-exit> X is definitely long in the tooth
<rdrop-exit> If anyone knows of an alternative that works on Unices and Macs, I'd appreciate a heads up
<tabemann> GTK+/Pango/Cairo is my go-to if I ever need to write 2D GUI code
<tabemann> I'd write a terminal with those in C, then talk to my Forth code with said terminal over some wire protocol
<tabemann> actually, it need not be C
<tabemann> my last two graphical projects used those and were written in Haskell (aside from my sixel work, which was in Forth)
<tabemann> (I am using an IRC client right now written in Haskell using GTK+)
<rdrop-exit> I may be wrong, but I don't think I need GTK+
<tabemann> to me the main factor is that GTK+ is pain-free compared with raw X11
<rdrop-exit> you're right I'm sure
<rdrop-exit> My initial googling tells me x11 is the common denominator between the different unices, although on Mac it's an optional add on to Quartz
<tp> heyhey
<rdrop-exit> hello Master Forth Technician (tm)!
<tp> rdrop-exit, there is a new x windowing system called 'wayland'
<rdrop-exit> or is it Forth Master Technician (tm)? I forget :)
<tp> i think it's made by ex windows x haters but I dont know
<rdrop-exit> thanks tp, will check it out
<tp> just 'natural born electronics tech' will do :)
<tabemann> does anyone actually use wayland
<rdrop-exit> ok :)
<tabemann> I think they haven't yet decided how to do screenshots
<tp> wayland is supposed to replace all the layers of X with a nice unified and homogeneous system
<tabemann> because they're confused about how to permission processes so they're allowed to do screenshots
<tabemann> also there is no remote wayland either
<tabemann> rather you're supposed to use something like RDP for remote
<tp> tabemann, yeah, i bet it's useless compared to the X we all use everyday to good effect
<tp> exactly, thats why I think it's a Windows users system
<rdrop-exit> The thing I like about X is that there's a wire protocol spec, so you don't have to deal with libraries
<tp> X windows without remote X would be utterly useless to me
<tabemann> I like it how they from on high just decided that This was The replacement for what we've been relying on for the last thirty-odd years
<tp> I imagine Linux will become more and more windows like as more and more windows people have a say
<rdrop-exit> kids always think they now better, hindsight is always 20/20
<tabemann> ugh
<tp> in the same way that C users try and make Forth look like C, windows users try and make Linux more like windows
<tabemann> like systemd
<tp> rdrop-exit, so true, and it's driven by those kids
<tp> tabemann, yes
<Kumool> systemd is not a bad idea though, it does speedup boot time
<tabemann> damn you Poettering
<Kumool> i'll take anything as long as its faster
<tp> Kumool, thats fine for a car radio I guess
<tabemann> there were other alternatives they could have taken
<tabemann> like parallel init
<tp> windows users typically shut down their PC/laptop after use, Unix users typically leave their running 24/7
<Kumool> well. shit, I'm gonna shut down my laptop right now
<Kumool> and am running linux
<tp> and in the latter case, bootup time is utterly irrelevant
<tp> I never shut this box down
<tp> it's uptime equals exactly the local power company outages
<Kumool> yeah but that's because you live in a first world country that's not constantly having blackouts
<rdrop-exit> I only shut down my mac a couple times a year
<Kumool> <- right now the lights are flickering
<Kumool> at my place
<rdrop-exit> spooky
<tp> 4:24PM up 2 days, 9:21, 14 users, load averages: 0.52, 0.40, 0.32
<Kumool> also I doubt this is a windows thing, because windows 10 takes like 10 minutes of booting for me
<Kumool> probably why its windows 10!
<tp> Kumool, I like in rural new south wales, the power here isnt very reliable, tho probably better than yours
<rdrop-exit> except for watching videos and surfing, I mostly use a terminal
<Kumool> tp: oh is your country trying desperately to sell and privatize its power plants too?
<tp> Kumool, they have sold them all years ago
<tp> after which power costs went up and up ...
<Kumool> :S
<Kumool> power generation is one of those things that should not be privatized
<tp> and now the power companies are in a death spirel
<tp> spiral
<tp> Kumool, oh I agree 100%
<tp> the Australian govt didnt ask for permission, they just did it
<rdrop-exit> I don't think there's a Wayland for mac yet
<Kumool> :(
<tp> solar power really took off here with massive govt subsidies and so the electricity companies struggle, raising prices to survive as more and more people go to solar
<Kumool> I better go, 1am now, bb
<rdrop-exit> unless my google-fu is lacking
<tp> Kumool, cya!
<Kumool> :)
<rdrop-exit> ciao Kumool
<tp> rdrop-exit, Im sure you can buy it for mac, just $300 plus yearly subscriptions ;)
<rdrop-exit> I've never bought any software for mac
<rdrop-exit> You're thinking Windows
<rdrop-exit> Mac is basically a BSD underneath all the GUI stuff
<tp> Sergey Bugaev @bugaevc@mastodon.technology
<tp> I have ported Wayland (that is libwayland-client, libwayland-server, libwayland-cursor, and wayland-scanner) from Linux to Darwin (Mac OS X 10.6 Snow Leopard to be exact).
<tp> Wayland relies on many little things that are specific to Linux (examples: epoll, timerfd, SO_PEERCRED, <linux/input-event-codes.h>), so I had to try and come up with ways to make it work without them.
<tabemann> okay, I'm gonna hit the sack
<tp> yeah, weyland is Linux only I guess, same as systemd is Linux only
<tabemann> g'night guys
<rdrop-exit> good night tabemann!
<tp> Linux is becoming more and more it's own thing
<tp> night tabemann
<tabemann> I hate how linux users can be so provincial at times
<tp> and less and less POSIX
<tp> tabemann, better get used to it
<tabemann> g'night guys for real now
<tp> or move to *bsd, openindiana, mac
<rdrop-exit> I've always favored BSDs over Linux
<tp> rdrop-exit, :)
<tp> I went to FreeBSD to escape the Linux systemd, but I stayed for the ZFS and FreeBSD jails
<rdrop-exit> If this Mac dies one day, I'll probably try NetBSD
<tp> theyre all pretty safe and admin friendly
<tp> no OS is perfect
<rdrop-exit> right
<tp> rdrop-exit, I had a breaktru in my own forth dev environment
<rdrop-exit> pray tell
<tp> i wanted to achieve this thing in 2014 but was utterly clueless about how to do it
<tp> the other day I woke up and knew how it was achieved, and 30 mins later was working with no issues
<rdrop-exit> I love it when inspiration strikes
<tp> so I guess I've been learning slowly a bit each day since 2014 :)
<tp> it's boring and XML related
<rdrop-exit> hack cough cough
<rdrop-exit> ;)
<tp> but basically my "svd2forth" generation now knows the difference between bitfields with >1 bit and acts accordingly
<tp> this was a pain for me for years as a MCU may have up to 17,000 bitfields
<tp> and the Forth Words to handle them need to be automatically constructed
<rdrop-exit> cool, I have some higher level bitfield handling words that optimize down when the width is known at compile-time
<tp> otherwise making the simplest programs that use Peripherals is a exercise in pain
<tp> in C all this is done *exactly* the same way, by building header files from the same XML data
<tp> no one does it by hand because it's impossible
<tp> and the data is ONLY available as XML
<tp> which makes sense as XML is easiest to parse using XML tools
<tp> so now my new svd2forth builds a Word for bitfields >1 as per this example
<tp> : GPIOC_MODER_MODER15 ( %XX -- ) 30 lshift GPIOC_MODER ; \ GPIOC_MODER_MODER15,
<tp> a possible use may be like this " OUTPUT GPIOC_MODER_MODER15 BIS! "
<rdrop-exit> I use BITS for that
<rdrop-exit> 23 10 bits constant %csr.icount.count
<tp> your example is non peripheral based tho ?
<rdrop-exit> %csr.icount.count is a bit mask with bits 23 down to 10 set
<tp> what is "csr" ?
<rdrop-exit> control and status register
<tp> a cpu register ?
<rdrop-exit> a special RISC-V register
<tp> ah yeah
<rdrop-exit> 2 %csr.icount.count
<rdrop-exit> 4 reset: 1).
<rdrop-exit> 6 Instead of changing csr.icount.count from 1 to 0, it is also
<rdrop-exit> 3 Bit mask for isolating the csr.icount count bitfield (R/W,
<rdrop-exit> 5 When csr.icount.count is decremented to 0, the trigger fires.
<rdrop-exit> 7 acceptable for h/w to clear csr.icount.m, csr.icount.s, and csr.icount.u.
<rdrop-exit> 8 This allows csr.icount.count to be hard-wired to 1 if this CSR
<rdrop-exit> 9 just exists for single step.
<tp> debugging
<rdrop-exit> profiling instruction count IIRC
<tp> the CMSIS-SVD standard gives only a start bit position and the number of bits involved
<tp> nice
<tp> rather than start and finish bit positions
<rdrop-exit> The RISC-V docs usually give starting and ending bit numbers for a field
<rdrop-exit> for a single bit, I just use BIT
<rdrop-exit> 3 bit constant %csr.mstatus.mie
<rdrop-exit> that's a bitmask with just bit number 3 set
<rdrop-exit> I usually name bitmasks with a percent, e.g. %foo
<tp> i think youre still working on the risc-v system registers ?
<rdrop-exit> I've done all the registers, including the debug bus registers
<tp> the gd32Vf103 also has a CMSIS-SVD.xml file, I use it now for the peripherals
<tp> can you see the similarity to my example above for cortex-m3 ?
<tp> : GPIOA_CTL0_CTL7 ( %XX -- ) 30 lshift GPIOA_CTL0 bis! ; \ GPIOA_CTL0_CTL7
<rdrop-exit> Why is the bit store part of the word?
<rdrop-exit> I tend to keep fetches and stores factored out
<tp> btw, my Forth powered STM32F103 diagnostics program had located a GD32F103 labeled as a STM32F103 in a Chinese 'blue pill' board
<rdrop-exit> cool :)
<tp> rdrop-exit, thats a old example, after your comment a few weeks back I moved the store part out of those definitions
<tp> it's now used as in my first example above
<rdrop-exit> cool :)
<tp> once you mentioned it I saw the logic was sound
<tp> it had been annoying me previously but I hadn't actually thought about why
<rdrop-exit> you're devoloping gut feelings about Forth aesthetics
<tp> that stuff is a hold over from my 2014 days when I wrote that stuff
<tp> well I can appreciate your highly developed Forth logic, you were the catalyst
<tp> and I appreciate it
<tp> with better logic comes better understanding and the ability to apply the logic to build better systems
<rdrop-exit> Some people prefer it the other way around, to factor in the fetches and stores, especially people into OO programming
<tp> so my auto parsing system now produces this for a 1 bit bitfield
<tp> %1 15 lshift GPIOC_OTYPER \ GPIOC_OTYPER_OT15,
<tp> no Word name is needed as the only choices are set, reset or test the bit like so
<tp> %1 15 lshift GPIOC_OTYPER bis!
<rdrop-exit> I would do that as:
gravicappa has joined #forth
<rdrop-exit> 16 bit constant %gpioc.otyper
<rdrop-exit> since it's bit# 16
<rdrop-exit> (bit numbering starting at 0)
<tp> why do you need 'constant' ?
<tp> good point re 16 bit
<rdrop-exit> to name the mask
<tp> 16 bit bin. $00010000
<tp> 3322222222221111111111
<tp> 10987654321098765432109876543210
<tp> 00000000000000010000000000000000
<tp> ahh
<tp> in my case BIS! does all that
<tp> so I could instead to "16 bit GPIOC_OTYPER bis!"
<tp> but the extra parsing work would probably only result in the same binary code
<tp> it's easy to test
<tp> : test1 %1 15 lshift GPIOC_OTYPER bis! ; ok.
<tp> see test1
<tp> 20000398: 2090 movs r0 #90
<tp> 2000039A: 04C0 lsls r0 r0 #13
<tp> 2000039C: 3080 adds r0 #80
<tp> 2000039E: 0100 lsls r0 r0 #4
<tp> 200003A0: 6843 ldr r3 [ r0 #4 ]
<tp> 200003A2: 2280 movs r2 #80
<tp> 200003A4: 0212 lsls r2 r2 #8
<tp> 200003A6: 4313 orrs r3 r2
<rdrop-exit> In my case I use bset ( mask a -- )
<tp> 200003A8: 6043 str r3 [ r0 #4 ]
<tp> 200003AA: 4770 bx lr
<tp> Bytes: 20 ok.
<tp> : test2 16 bit GPIOC_OTYPER bis! ; ok.
<tp> see test2
<tp> 200003CC: 2090 movs r0 #90
<tp> 200003CE: 04C0 lsls r0 r0 #13
<tp> 200003D0: 3080 adds r0 #80
<tp> 200003D2: 0100 lsls r0 r0 #4
<tp> 200003D4: 6843 ldr r3 [ r0 #4 ]
<tp> 200003D6: 2280 movs r2 #80
<tp> 200003D8: 0252 lsls r2 r2 #9
<tp> 200003DA: 4313 orrs r3 r2
<tp> 200003DC: 6043 str r3 [ r0 #4 ]
<tp> 200003DE: 4770 bx lr
<tp> Bytes: 20 ok.
<tp> see bis!
<tp> 000019D8: CF03 ldmia r7 { r0 r1 }
<tp> 000019DC: 4302 orrs r2 r0
<tp> 000019DA: 6832 ldr r2 [ r6 #0 ]
<tp> 000019DE: 6032 str r2 [ r6 #0 ]
<tp> 000019E0: 000E lsls r6 r1 #0
<tp> 000019E2: 4770 bx lr
<tp> Bytes: 12 ok.
<tp> probably similar I guess
<tp> I have "bis!" (set), "bic" (clear) and "bit@" test
<rdrop-exit> try it with a constant
<rdrop-exit> I have bset bclear btoggle
<tp> : test3 16 bit constant GPIOC_OTYPER bis! ; ok.
<tp> see test3
<tp> 20000404: 2680 movs r6 #80
<tp> 20000402: 603E str r6 [ r7 #0 ]
<tp> 20000400: 3F04 subs r7 #4
<tp> 20000406: 0276 lsls r6 r6 #9
<tp> 20000408: B500 push { lr }
<tp> 2000040A: 20BD movs r0 #BD
<tp> 2000040C: 0180 lsls r0 r0 #6
<tp> 2000040E: 300D adds r0 #D
<tp> 20000410: 4780 blx r0 --> constant
<tp> 20000412: 2090 movs r0 #90
<tp> 20000414: 04C0 lsls r0 r0 #13
<tp> 20000416: 3080 adds r0 #80
<tp> 20000418: 0100 lsls r0 r0 #4
<tp> 2000041A: 6843 ldr r3 [ r0 #4 ]
<tp> 2000041C: 431E orrs r6 r3
<tp> 2000041E: 6046 str r6 [ r0 #4 ]
<tp> 20000420: CF40 ldmia r7 { r6 }
<tp> 20000422: BD00 pop { pc }
<tp> Bytes: 36 ok.
<rdrop-exit> you're code is wrong for that one
<tp> what should it be ?
<rdrop-exit> what is the stack picture of your bis! is it ( mask a -- )?
<tp> I've no idea
<tp> hmm hang on
<rdrop-exit> I'll get a coffee while you look
<tp> bis! ( mask a-addr - - ) Set BIts in word-location
<tp> me too!
<rdrop-exit> so you're code should be <mask> <addr> bis!
<rdrop-exit> 16 bit constant %gpioc.otyper
<rdrop-exit> %gpioc.otyper <addr> bis!
<rdrop-exit> what's the <addr>?
<rdrop-exit> that's probably another constant you generated
<rdrop-exit> %gpioc.otyper foo bis!
<rdrop-exit> presumably foo is a constant address of a memory mapped register
cheater has quit [Ping timeout: 258 seconds]
cheater has joined #forth
<rdrop-exit> So you're XML parser would produce hordes of constants, some to name bitmasks, some to name addresses
<rdrop-exit> then you use those constants in phrases as needed
<rdrop-exit> * your
<rdrop-exit> thus avoiding a combinatorial explosion
<tp> bak
<tp> a-addr is the address of the data
<tp> rdrop-exit, I think you have the gist of it!
<rdrop-exit> cool
<tp> so my breakthru was knowing how to tell the xml parser to remove all the Word preamble and postamble from the generated template definition
<rdrop-exit> so if I understood correctly your XML thingy produces oodles of code that looks like this:
<rdrop-exit> <something> constant <somename>
<tp> so now, with the separation of the action (bis! etc) and Words only generated for bits >1, I'm pretty happy with my current svd2forth generator
<rdrop-exit> kudos
<tp> youve seen two examples above of the actual autogenerated code
<tp> one for bit = 1 and the other for bits >1
<rdrop-exit> (scrolling back in history)
<tp> this is my attempt to make the early embedded Forth code more readable
<tp> here are the two examples
<rdrop-exit> ok
<tp> : GPIOC_MODER_MODER15 ( %XX -- ) 30 lshift GPIOC_MODER ; \ GPIOC_MODER_MODER15
<tp> %1 15 lshift GPIOC_OTYPER \ GPIOC_OTYPER_OT15
<tp> the bitfields can be up to 30 bits in some cases
<tp> oops
<tp> 32 bits
<rdrop-exit> What is the definition of GPIOC_MODER ?
<tp> $48000800 constant GPIOC ( General-purpose I/Os )
<tp> GPIOC $0 + constant GPIOC_MODER ( GPIO port mode register )
<tp> GPIOC $8 + constant GPIOC_OSPEEDR ( GPIO port output speed register )
<tp> GPIOC $4 + constant GPIOC_OTYPER ( GPIO port output type register )
<tp> GPIOC $C + constant GPIOC_PUPDR ( GPIO port pull-up/pull-down register )
<tp> GPIOC $10 + constant GPIOC_IDR ( GPIO port input data register )
<tp> GPIOC $14 + constant GPIOC_ODR ( GPIO port output data register )
<tp> GPIOC $18 + constant GPIOC_BSRR ( GPIO port bit set/reset register )
<tp> GPIOC $1C + constant GPIOC_LCKR ( GPIO port configuration lock register )
<tp> GPIOC $20 + constant GPIOC_AFRL ( GPIO alternate function low register )
<tp> GPIOC $24 + constant GPIOC_AFRH ( GPIO alternate function high register )
<tp> GPIOC $28 + constant GPIOC_BRR ( Port bit reset register )
<tp> these are all in my first loaded 'memmap.fs'
<tp> also autogenerated from the same SVD file that the bitfields are
<rdrop-exit> the stack picture of GPIOC_MODER_MODER15 seems wrong
<tp> maybe it is
<tp> I use it this way "%11 GPIOC_MODER_MODER15 BIS!"
<rdrop-exit> it looks like it leaves two items on the stack
<tp> or "ANALOG GPIOC_MODER_MODER15 BIS!"
<tp> and it does
<tp> it leaves the mask and the address
<tp> which are consumed by BIS!
<tp> well BIS generates and handles the mask from the number supplied
<tp> value supplied
<rdrop-exit> cool
<tp> I'm just a user, I tend to take a lot for granted
<rdrop-exit> similar to what I do, names are different to protect the innocent
<tp> yeah, in the end it's gotta be the same, only the journey is different
<tp> it's even the same for C, but in a utterly different way
<rdrop-exit> bset bclear btoggle 16set 16clear 16toggle set clear toggle etc...
<tp> when the binary hits the metal, it's the same
<tp> yeah, typical of Forth, everyone has their own methods and names that work for them
<tp> you can do it in C like this if you like "GPIOA->AFR[0] |= (0x3 << (4*1)) + (0x3 << (4*2)); //enable AF3 for PA1 and PA2"
<rdrop-exit> yes, the difference usually comes down to what you leave up to the optimizer to figure out
<tp> which the C people seem to think is self explanatory
<tp> ahh, good point
<rdrop-exit> C style varies a lot too I guess
<tp> yes, especially historically
<tp> Ive been working thru a Cortex-m0 'touch' peripheral config
<tp> you know, where it has a copper pad on a pcb, about the size of a fingertip, and the pad is electrically isolated under plastic or glass etc
<tp> a finger touch on the pad is then detected
<rdrop-exit> what are you using it for?
<tp> the code I followed is naturally in C, by STM around 2010
<tp> as a alternative to a button for a project
<rdrop-exit> interesting
<tp> and in those days, STM defined 'bits' like this "TSC_CR_PGPSC_2" and "TSC_CR_PGPSC_0" right up to "TSC_CR_PGPSC_31" I guess
<rdrop-exit> seems redundant
<tp> yeah
<tp> then in the next C revision they stared using the "TSC->IOHCR &= ~(0x06);" stuff
<tp> or maybe "<<" etc
<tp> whats crazy is that now, if one looks up the STM code example for how to use the 'touch' peripheral, there is no code
<tp> it's all pictures of GUI windows, HAL etc
<rdrop-exit> the reason they're using the and complement idiom is that it doesn't knowing how wide machine word is
<rdrop-exit> i.e. ~(0x06) generates a mask with bits 2 and 3 off and all other bits on regardless of the machine word width you're dealing with
<rdrop-exit> sorry I meant bits 1 and 2 off
<tp> i can see why Boeings ISS astronaut capsule failed to make orbit now "we used the wrong version of HAL in our STM32CUBE ide, and the clock got the wrong data"
<tp> in ceneral when I read the embedded forums, I see two things 1) a universal love for and godlike respect for The C programming Language
<tp> 2) users struggling with basic operations on bitfields
nonlinear has quit [Ping timeout: 260 seconds]
<tp> 3) users with almost zero hardware experience
<tp> oh and 4) even tho none of them have ever used Forth, they think they know all about it and as a result avoid it like the plague
<rdrop-exit> TSC->IOHCR &= -7
<tp> Forth is 'read only', 'untyped', 'ancient', 'unsuitable for teams' and 'arcane' didn't you know ?
<rdrop-exit> I tend to see it the other way around, they are unsuitable for forth ;-)
<tp> hahaha
<tp> me too :)
<tp> I did mention that after 58 days a C user managed to provide partial functionality of my Forth binary, but it's very cut down.
<tp> he reads the chip registers, makes a conclusion, then outputs it in a USB 'identification' string when the device is queried
<tp> it's pretty clever I admit, but the actual source requires quite a few libraries
<tp> and it has no 'fancy menu' like mine ;-)
<rdrop-exit> there was a short window of time when C interpreters were popular, the users of such interpreters were more likely to understand the benefits of a variable level interactive system such as Forth
<rdrop-exit> but then C got complicated and C interpreters died out
<rdrop-exit> late 70s, early 80s timeframe
<rdrop-exit> is when the C interpreters were popular IIRC
<tp> i missed all that somehow
<tp> probably too busy being a newlywed and having kids
<rdrop-exit> I probably have some old magazines with articles on them, maybe Computer Language or early Dr. Dobbs
<rdrop-exit> one of them was called C-terp IIRC
<tp> one advantage is he doesnt need a serial terminal, but then Im always hearing C embedded people explaining how they use print statements on a serial terminal to debug their code
<tp> looks pretty old
<rdrop-exit> wow cool! Copyright 1985
<tp> good memory!
<rdrop-exit> better than I expected :)
<tp> in 1985 I was writing machine code on a STK8085, that was the state of my tech!
<rdrop-exit> I think there were others, but that's the name that popped to mind
<tp> it's been replaced by GDB over JTAG now
<rdrop-exit> There were also a some Small-Cs, don't recall if they were just compilers
<rdrop-exit> Do you remember the Motorola debug monitor
<rdrop-exit> forget what they called it
<tp> well I'm off for tea! thanks for the chat and many Forth tips as always :)
<tp> no I never had stuff like that
<tp> cya!
<rdrop-exit> take care, I'm off to x11 land
<rdrop-exit> ciao!
nonlinear has joined #forth
nonlinear has quit [Quit: The Lounge - https://thelounge.chat]
nonlinear has joined #forth
WickedShell has quit [Remote host closed the connection]
nonlinear has quit [Ping timeout: 260 seconds]
gravicappa has quit [Remote host closed the connection]
dys has joined #forth
jsoft has quit [Ping timeout: 265 seconds]
nonlinear has joined #forth
nonlinear has quit [Ping timeout: 240 seconds]
xek__ has joined #forth
rdrop-exit has quit [Quit: Lost terminal]
jsoft has joined #forth
jsoft has quit [Ping timeout: 255 seconds]
iyzsong has quit [Remote host closed the connection]
iyzsong has joined #forth
proteus-guy has joined #forth
iyzsong has quit [Ping timeout: 245 seconds]
dave0 has joined #forth
dave0 has quit [Quit: dave's not here]
gravicappa has joined #forth
proteus-guy has quit [Ping timeout: 240 seconds]
Lord_Nightmare is now known as LordNLptp
LordNLptp is now known as LordNAway
LordNAway is now known as Lord_Nightmare
Lord_Nightmare is now known as Lord_Nightmare2
Lord_Nightmare2 is now known as Lord_Nightmare
dddddd has joined #forth
tabemann has quit [Ping timeout: 240 seconds]
proteus-guy has joined #forth
cheater has quit [Ping timeout: 260 seconds]
cheater has joined #forth
cheater has quit [Ping timeout: 260 seconds]
cheater has joined #forth
cheater has quit [Ping timeout: 265 seconds]
cheater has joined #forth
dys has quit [Ping timeout: 248 seconds]
X-Scale` has joined #forth
<veltas> >Forth is 'read only', 'untyped', 'ancient', 'unsuitable for teams' and 'arcane' didn't you know ?
<veltas> I hear those same excuses for almost every tool I know that actually works well and isn't bloated
<veltas> I have to be honest though I would not trust most of the programmers I know to write Forth, there is such a thing as 'read-only' code and most such code I've read is in C, and you can achieve it in any language
X-Scale has quit [Ping timeout: 265 seconds]
X-Scale` is now known as X-Scale
_whitelogger has joined #forth
dave0 has joined #forth
<dzho> don't we mean "write only"?
<ecraven> I was just pondering what read-only code is... APL? because you cannot type it? :P
proteus-guy has quit [Ping timeout: 260 seconds]
WickedShell has joined #forth
<crc> my code isn't write only (or read only) and has normally plenty of comments
gravicappa has quit [Ping timeout: 265 seconds]
xek__ has quit [Ping timeout: 258 seconds]
<tp> veltas, youre right, I misquoted, Forth is normally accused of being "write only"
<tp> dzho, oops also meant yourself and ecraven, my mistake, I did mean to type "write only". Crc your source is totally readable along with your own literate source extraction tool and documentation
<veltas> Well read-only usually means unchangeable so it works as well
<tp> just a brain fart on my part
<veltas> It made sense to me anywya
<tp> thats Forth people for ya, they can understand most things :)
<tp> i was just ranting after transcribing some C examples to Forth
<veltas> Right
<veltas> I skimmed those logs it was an interesting rant
<veltas> I have opinions about C code too ;)
<veltas> But not a strong opinion on Forth since I am brand new to it
<tp> oh!
<tp> just the fact that you're looking at Forth puts you in a quite exclusive group
<veltas> I have seen it mentioned multiple times over the years and it seemed interesting, I didn't learn anything other than it can have very minimal implementations, is stack-based, reverse-polish, and can extend/rewrite itself
<veltas> The last few weeks I suddenly got the inspiration to go learn it from Starting FORTH and I have been enjoying the experience
<veltas> It is highly unconventional but still very capable and worth trying just for that reason alone, most programming languages are too similar
<tp> starting Forth is quite old now and some of the examples wont work on modern Forths, so don't immediately assume it's you when that happens
<veltas> Yeah I get that
<veltas> The beautiful thing about it is that the implementation is so simple in Starting FORTH that I can kind of tell how it worked on their system, and can guess why it doesn't always work now
<tp> I guess "it can have very minimal implementations, is stack-based, reverse-polish, and can extend/rewrite itself" are some of the very important points, but one of the main ones is 'its interactive'
<veltas> Like 'forget' not working on gforth makes sense that the dictionary would be a bit more sophisticated now (although it needn't be)
<veltas> tp: Well that was my impression before learning it
<tp> Im a poor fit in this channel because I'm a electronics technician and not a programmer. I only use Forth on small embedded systems
<tp> and in that field, interactivity is everything
<tp> yet the points you mentioned above cant be stressed enough in my opinion also
<veltas> I work with electrical engineers every day
<tp> the ability to rewrite itself is a MASSIVE thing shared only with LISP
<tp> aha
<veltas> It's not as novel anymore, LISP is the other 'old' language that really took this to the limit, and Haskell maybe since Haskell is quite old and can extend its syntax
<tp> the Forth I use is very small, fits in 19kB and runs on ARM cortex-M microprocessors
<veltas> The impressive thing about Forth is how it can rewrite itself *and* it's really tiny
<veltas> I believe I have spent a lot of time on a Cortex-M microprocessor
<tp> haskep could do something like rewrite itself so one equals 2 in such a way that "1 + 1 = 3 " ?
<tp> Haskel I mean
<tp> veltas, really ? youre familiar with cortex-m, awesome
<veltas> Not too familiar with the details
<tp> I mainly use cortex-m0 but have done some stuff lately with cortex-m3
<veltas> Just did a lot of work on a real-time system on a smartfusion
<veltas> SmartFusion was Cortex-M3 I think
<tp> yeah, m0 is very small but ideal for what I do
<tp> in my tests, m3 is usually 3 - 5 times faster than m0, not that it matters for me
<veltas> Hmm it didn't matter for me either probably
<tp> most of the bigger dev environments need at least M3 and bigger
<tp> but Im at the really small end, tho I'd like a M0 with a couple of MB of flash just to fit all the Forth dev aids I have built
<veltas> tp: Was that a question about Haskell? I missed that
<veltas> I'm not sure honestly, I don't know Haskell well
<tp> yeah it was
<veltas> But you can add operators and define e.g. precedence, and I have seen some weird stuff in Haskell that implies a lot of control over syntax
<tp> I dont know Haskell at all
<tp> it sounds very complicated, and I try and avoid complicated things, hence my love for Forth (not that Forth isnt complicated in areas)
<veltas> Yes that is what I was saying earlier really by saying Forth was minimal
<tp> I started learning Forth in 2014 myself, Im slow but steady
<veltas> Because if something is really tiny then it can only be so complicated (well, that logic is somewhat true anyway)
<tp> after 6 years I have a basic understanding I feel
<tp> I used to use C, but nowdays it's all Forth for me
<veltas> I have been enjoying Forth a lot, I hope I do keep using it
<tp> but when learning about how to configure a unfamiliar Cortex-m0 peripheral I have to wade thru C examples
<tp> if youve just started and youre liking it, you may now be on a journey that will last decades :)
<tp> sadly almost all of the STMicro tech docs only give C examples as tho C is the 'language of microprocessors'
<veltas> Hmm
<tp> and that supplies a lot of the ammunition for my rants
<veltas> C is the language of a PDP-11
<tp> I mean it's bad enough to read examples that dont actually explain a particular C syntax, such as "TSC_CR_PGPSC_2"
<tp> I have nothing against C, I know it and I like it but for me thesedays it's just too complex and limited for small embedded in comparison to Forth
<veltas> It is an alright 'portable assembler' and general systems language in my opinion.
<veltas> Probably the biggest issue with C is the standard
<tp> the "TSC_CR_PGPSC_2" is from a 2014 tech document example, and STMicro have gone thru about 4 different systems since then in their search for the one easy method ... theyre still trying
<tp> yeah I agree, on larger systems C is great and very portable
<veltas> Do you know K&R C at all?
<veltas> I mean pre-standard C
<tp> I always thought Id only use Perl,Tk/tcl, and C on my PC when writing apps, but of late Ive begun using Forth thanks to CRC's "retro"
<tp> yeah, thats what I started with when I learnt C in 1997
<tp> I still have that blue book
<veltas> I don't mean the book
<veltas> I mean the style of C that was supported and defined in the first edition of that book
<tp> oh, in that case I'm probably not familiar
<veltas> It is pre-1989 standard
<veltas> Before e.g. prototypes were defined
<veltas> If you can find the first edition of K&R online (it is not hard on google) then have a look, very interesting read
<veltas> C used to be much less verbose, and you can see how they were so productive with it in the early days
<veltas> We took a long time to come back to that kind of syntax now in languages with type inference, in the 70s they just had very weak types and they managed fine
<tp> ahh!
<tp> I pretty much just learnt enough C to use in simple embedded programs
<veltas> One of the reasons I like Forth is it reminds me of that ... even in Forth 2012
<tp> thats a excellent point you raise
<tp> 'they managed fine'
<tp> consider 1969 ? the USA landed men on mars and their 'computer' was all discrete components, the assembly was written by one man
<tp> it had zero bugs
<veltas> Was that the one they had to debug and modify live to work around some issue (hardware issue maybe, if the code had 0 bugs)?
<tp> they had problems, serious ones as they were landing, but they were hardware ones, the computer and software was bug free and even allowed a workaround for the most serious hardware bug
<tp> thats the one
<veltas> Yeah I read about that, very cool
<tp> and that was 1969
<veltas> I think it was in an article about the nature of 'real time' programming
<tp> yet now in 2020, Boeing fail to get a capsule into orbit because of a 'clock sync error'
<veltas> The program was one big continuous loop, simple flat state, so it was real time for free
<veltas> Honestly Boeing's biggest fail is the decision that their products don't need to be owned and maintained by dedicated teams
<tp> the lander problem was caused by a faulty switch
<veltas> And that you can just purchase work from anyone based on management's requirements and expect good code to come out of it
<veltas> They have dropped all sense and rely entirely on the 'process', it turns out the process is not good enough
<veltas> on its own
<tp> and that switch wanted to cause a abort which meant rocketing away from moon while attempting to land
<tp> no one even new what the error code meant, only the one guy who wrote it all
<tp> knew
<veltas> If I wrote 'requirements' for my garden and then hired different people every day to come and 'implement' the maintainance for my garden derived from those high-level requirements they probably would mess it up and leave it horribly inconsistant and ugly
<tp> and he quickly designed a workaround to prevent the switch aborting everything
<tp> yeah, I can see that
<veltas> If they can't even get that right then how are they meant to write mission critical software
<tp> well Boeing has had a number of fatal issues of late so it seems to me that modern software development is going backwards
<veltas> I think the issue is more to do with corporatism
<tp> good point
<tp> Im a one man band, my own development is easy and straightforward in Forth, life is easy
<tp> and thats the thing with forth, no one uses my system because I built it for myself
<tp> no one wants to use it either, other Forth users have their own systems, and theyre all different
<tp> and theyre all different because Forth is so malleable
<tp> we make what we want
<tp> if I really want 1 to actually be 2, with Forth I can
<veltas> Forth users are all too busy talking to the computer to bother talking to other Forth users apparantly
<veltas> Can you make 1 + 1 = 3?
<tp> Forth users are the most independent free thinkers Ive ever met
<tp> sure
<veltas> You would have to redefine +, not '1' to do that, right?
<tp> if I use fixed point :)
<veltas> Good point
<veltas> Well also depending on the size of your floats but yes
<veltas> Wait ... is that right?
<tp> I dont use floating point, only fixed point
<veltas> You would still need to redefine + because it's for single word integers
<tp> youre also right, there are multiple ways to do it
<veltas> Hmmm
<tp> + also works with fixed point
<veltas> Forth has just one thing to say about this
<veltas> "ok"
<veltas> Nighty night
<tp> oh, thanks for the chat :)
<tp> i hope Forth holds your interest
remexre has quit [Ping timeout: 240 seconds]
remexre has joined #forth