reepca has quit [Read error: Connection reset by peer]
reepca has joined #forth
TCZ has quit [Quit: Leaving]
TCZ has joined #forth
TCZ has left #forth [#forth]
<tabemann> I'm actually just copying Matthias's code
<tabemann> after all, his code is GPL3 and my code is GPL3
<tabemann> and I'm putting his copyright notice on my double cell arithmetic file
jsoft has joined #forth
<tp> tabemann, but the Zaptoforth greeting is 100% your own work tho ?
<tabemann> yes
boru` has joined #forth
<tabemann> lol
boru has quit [Disconnected by services]
boru` is now known as boru
<tabemann> the only thing I wonder about is whether I should put a GPL notice in the greeting
<tp> heheh, sorry I couldn't resist it ;)
<tp> it wouldnt harm anything
<dave0> my code is public domain
<dave0> i don't write much anyways :-)
<MrMobius> tp, did you ever see the thumbulator project?
<MrMobius> it converts thumb code to msp430 iirc
<tp> dave0, tabemann is restricted to the GPL as he has used code from Mecrisp-Stellaris which is GPL
<tp> MrMobius, I sure did, I used it initially to produce binaries from the MCU
<tp> MrMobius, but I soon ran into issues and so developed a method to obtain the binary straight from the mcu
<dave0> tp: oh i see
<tabemann> back
Zarutian_HTC has quit [Remote host closed the connection]
_whitelogger has joined #forth
<dave0> aha okay
<dave0> thanks
<tp> no problemo. Ive been testing it from time to time
<tp> I have a STMicro F4 Discovery board it runs on
<dave0> ugh writing multi-precision arithmetic is such a pain in c
dddddd has quit [Ping timeout: 258 seconds]
<crest> gn8
rdrop-exit has joined #forth
<rdrop-exit> simplified loop unrolling
<rdrop-exit> : foo ( -- ) left-foo [ 14 unrolled, mid-foo ] right-foo ;
<tp> rdrop-exit, Zen Guru of Forth!
<rdrop-exit> hello Forth Master Tech (tm)!
<tp> rdrop-exit, I cycled into my local town yesterday, first time since the Australian 'lockdown' so about 4 weeks
<tp> rdrop-exit, apart from pubs and hotels being closed, it was business as usual, all other biz and shops were open
<rdrop-exit> nice, I can't even remember the last time I went out and about
<tp> the town was full of cars, lots of people about
<rdrop-exit> : unrolled, ( # <name> -- )
<rdrop-exit> ^ swap for dup compile, next drop ;
<rdrop-exit> really, the streets I have a view of from my condo are pretty much deserted
<tp> yeah, I was surprised, I thought it would be deserted
<tp> it's a remote small country town, perhaps thats why
<tp> cafe's were all open, just no dine in facilities, take away only
<rdrop-exit> I guess people are running out of those infamous meat pies
<tp> ahah, I havent had a meat pie in a long time, a good locally made one is awesome, mass produced ones are horrible
<tp> probably be a while before I can get a good one
<rdrop-exit> my wife loves to cook but usually doesn't have the time for it, since the lockdown she's been cooking up a storm
<rdrop-exit> I had homemade pineapple upside down cake for desert last night, yummy
<tp> yum
<rdrop-exit> tonight she's promised Tarte Tatin
<tp> yun, French style apple tart
<rdrop-exit> there goes my diet
<tp> yep
<rdrop-exit> I've been going through my books deciding what to put in storage or donate/recycle
<rdrop-exit> it's a slow process as I have a tendency to go "hey I forgot all about this one" and get lost leafing through them
<tp> heheh
<tp> yeah, it's not easy
<rdrop-exit> lunch is on the table, bbiab
rdrop-exit has quit [Quit: Lost terminal]
<tp> I had a collection of about 200 scifi books going back to my teens, I'd reread them at least 2 -3 times each and was only able to ditch them as I matured and found them less interesting
<tp> no problemo
gravicappa has joined #forth
_whitelogger has joined #forth
djinni has quit [Quit: Leaving]
rdrop-exit has joined #forth
mtsd has joined #forth
djinni has joined #forth
rpcope has quit [Ping timeout: 256 seconds]
dys has joined #forth
<rdrop-exit> c[] good afternoon Forthwrights :)
reepca has quit [Remote host closed the connection]
reepca has joined #forth
<veltas> tp: Dune?
<veltas> rdrop-exit: good morning
<tp> veltas, San Worms ?
<tp> sand
<veltas> Fiance and I spent the first part of lockdown eating richly, now we're over the hump of easter we're eating more conservatively
<veltas> tp: Yes
<veltas> Good sci-fi
WickedShell has quit [Remote host closed the connection]
<tp> veltas, I was kind of lukewarm about Dune, I'm just not into religious Bene-Jesuit psychobabble. I prefer 'dark star' etc
<tp> veltas, I love how Forth words work together also, there is a symmetry in Forth I love
<veltas> I think I've said before, the only other time I've felt this kind of way about a language was learning Haskell
<tp> I think you have said that
<veltas> I read a lot of Terry Pratchett when I was a teen
<veltas> Not religiously but I did enjoy that kind of comedy fiction
dddddd has joined #forth
<tp> Forth is special to me because I thought about learning it for 27 years before I actually did
<tp> I loved Terry Pratchett for a period also, not so much now
<tp> I read TONS of scifi, usually 1 hr every night
<veltas> First heard of forth around 5 years ago or so, and had been interested by it but thought it was probably pointless and hard
<veltas> I gave in and learned it because one day I didn't care if it was pointless or hard
<veltas> looked like the right fit for the already pointless work I was doing in free time
<tp> i first saw it in use on a big project I was hired to do all the hardware for. I never forgot the massive enthuiasm the programmers had for this thing called Forth
<veltas> Many of the most brilliant things explored by humanity would have looked pointless at the outset.
<tp> so I wan't in a big hurry, Forth wasn't a priority, I even learned and used Basic on hardware first (uggh)
<veltas> POKE
<tp> phadthai, what, people are wearing clothes outside now ?
<phadthai> "but I want people to keep their social distance!"
<phadthai> heh
<tp> veltas, I should write a book .. "How The Goto Ruined My Life"
<veltas> goto is the girl who ruins your life because she got away and you spend the rest of your life thinking about her with other control statements
iyzsong has joined #forth
<crest> phadthai: leaving your clothes at home is one way to encourage people to keep a distance from you
iyzsong- has joined #forth
iyzsong has quit [Ping timeout: 256 seconds]
reepca has quit [Read error: Connection reset by peer]
reepca has joined #forth
<tp> crest, yahoo, finally finished every XSLT parser mod I have to do for the new bluepill release
<crest> tp: great
<crest> how large is the generated code?
<tp> som mods I thought would be easy were really hard, some hard ones really easy as there is a fair bit of cruft in those programs now
<tp> that always depends on the peripheral choices
<tp> definitely smaller
<tp> I've abbreviated the memory access type designators to two CAP letters, "read-only" becomes "RO"
<tp> and so on
<crest> how about deduplicating stuff?
<crest> how much use do you make of create and does>?
<tp> none, I don't understand them well yet, and all my processing is done in XSLT, the MCU plays no part in svd2forth yet
<rdrop-exit> hi guys
<tp> well I did once use create and does> and understood it to some degree ( I copied someone elses work)
<tp> hey rdrop-exit, all quiet on the whatever front ?
<rdrop-exit> create does> leads to bad factoring
<rdrop-exit> hi tp, was getting lost browsing through a almost 1000 book
<tp> crest, apart from the legend creations, eberything else calls a Word in my svd2forth
<tp> crest, and the legends are words themselves
<rdrop-exit> in addition create does> is kludgy
<crest> do you have some svd2forth generated code for me to look at?
<tp> hmm, I suppose I could generate the legends from a formula ... hmm hadnt thought of that before
<tp> everywhere
<crest> rdrop-exit: i wanted to reduce the memory footprint of the code as much as possible
<tp> what do you want a memmap or a bitfield ?
<crest> both?
<tp> sure
<crest> i just want to see if there is something that could easily be factored out
<crest> to reduce the amount of duplicated code
<crest> because code generators tend to generate bloated code because it's easier for the code generator
<rdrop-exit> You can get the same effect as create does> without the kludgyness
<tp> crest, memmap.fs: http://dpaste.com/1CENJCF
<veltas> rdrop-exit: Is there a writeup on this? Re. create does>?
<veltas> Would be interested
<rdrop-exit> I can't recall one off the top of my head
<veltas> I'm mostly interested in why it leads to 'bad' factoring
<rdrop-exit> because it's combining into one word what should actually be two words
<rdrop-exit> the "create" time part, and the "doing" part
<rdrop-exit> things get simpler if you have them as separate words, each individually "tick-able"
<rdrop-exit> one part is a specialized compiler, the other part is a specialized runtime
<crest> tp: that's not too bad for autogenerated code
<crest> it looks like a straight forward implementation a bored programmer would write
<tp> crest, I have ben working on it for a few years, but I'm always very keen to get any suggestions to make it better/more efficient
<crest> let me think about after work
<tp> I'm never bored, but Im a crap programmer
<tp> sometimes crap poor programmers look like bored real programmers
<crest> and measure different implementations by size before i make an ass of myself
<tp> hey, thats NOT a problem here, ALL ideas are welcome
<tp> I find the more confronting a concept here presented to me, the bigger the gains I make
<tp> rdrop-exit, took the time to (very tactfully) explain that I had nfi about stack pictures and thats resulted in massive changes to svd2forth :)
<tp> the pastebin wouldnt take a full bitfields.fs file and I noticed that I still have 1 or 2 incorrect stack pictures so I'll fix those first and pastebin a smaller sample
<crest> i suspect some nice tricks with create, does> and parse could get you shorted and more readable definitions
<tp> cool, please let me know and I'll see how they work
<tp> they will have to go in the XLST stuff
<tp> but it's easy enuf to test
<tp> one part is missing the "1b."
<tp> : b32loop. ( u -- ) \ print 32 bits in 1 bit groups with vertical bars
<tp> 0 <#
<tp> 31 0 DO
<tp> # 32 HOLD LOOP
<tp> # #>
<tp> TYPE ;
<tp> and
<rdrop-exit> crest, sure, to be clear I'm just saying that there are cleaner ways to produce the same word as you would using create does>
<tp> : 1b. ( u -- ) cr \ 31-0, 1 bit groups generic legend
<tp> ." 3|3|2|2|2|2|2|2|2|2|2|2|1|1|1|1|1|1|1|1|1|1|" cr
<tp> ." 1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0 " cr
<tp> @ binary b32loop. decimal cr cr ;
<tp> i put it here for any to comment
<tp> the end result is this
<tp> or thousands of cariations
<tp> variations
<tp> GPIOA_CRL (read-write) $44444AA8
<tp> 3|3|2|2|2|2|2|2|2|2|2|2|1|1|1|1|1|1|1|1|1|1|
<tp> 1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0
<tp> 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0
<tp> .. I type the name of the register using a legit CMSIS-SVD name such as "GPIOA_CRL" and get the following real time print of the data in that register
<tp> there is no way to do without the legend so a bit value can be easily located
<veltas> rdrop-exit: I'll have to have a think about that (re create/does>)
<rdrop-exit> sure
<tp> veltas, when I used create/does> before, the result used a lot of code
<tp> used a lot of space I mean
<tp> hhah, of course I had it do a lot of stuff also
<veltas> The 'obvious' implementation of create/does> on my forth will use more space than equivalents
<veltas> But it does do things that I can't replicate right now in an obvious way
<rdrop-exit> the point of a create does> word is that when you execute it, it produces a child word, and when that child word executes, it executes some code
<tp> yes
<veltas> I have seen discussion of how cruft seems to get introduced into all forths to enable it as a feature
<veltas> Well also it associates data with itself, that is the crufty bit as far as I can see
<veltas> I will have a little think about it later
<rdrop-exit> books often use CONSTANT as an example for create does>
<rdrop-exit> but tellingly Forths hardly ever use create does> to implement CONSTANT
<veltas> My CONSTANT is definitely better not being create does>, at least for the way I've been able to see implementing create/does>
<tp> in Mecrisp-Stellaris all Words are written assembly
<tp> so Ive never see the formation od the core system words in Forth
<rdrop-exit> actually I should have said never, rather than hardly ever
<veltas> I will do it if I can figure out how to remove the create/does> threading overhead
iyzsong- has quit [Quit: ZNC 1.7.1 - https://znc.in]
<tp> I think I see the attraction of create does>, but I dont have the terminology to explain it!
<rdrop-exit> the attraction is to have a factory word that you can use to produce child words
<rdrop-exit> a typical use case would be for writing an assembler for example
<tp> are you advocating factoryizing ?
<rdrop-exit> :))
<rdrop-exit> there's nothing wrong with the objective of create does> I just think there are always cleaner ways to achieve the objective than using create does>
<rdrop-exit> : constant ( x <name> -- )( -- x ) header, lit, inline ;
<tp> here is a example from Mecrisp-Stellaris
<tp> : reg: ( "name" offset-addr -- ) <builds , does> @ or ;
<tp> not my code
<rdrop-exit> <builds dates back to FIG Forth
<tp> i think this contributor uses it to create register fetch values ?
<tp> rdrop-exit, what does "name" mean in the stack comment ?
<tp> is that a ascii character(s)
<rdrop-exit> it means the word reads a token from the input stream
<tp> so the use may do something like " gpioa $100000 reg: " ?
<rdrop-exit> see the stack picture for CONSTANT as an example
<tp> or "reg: gpios $1000000" ?
<rdrop-exit> constant ( x <name> -- )
<rdrop-exit> then you use it thus
<rdrop-exit> 5 constant thingie
<tp> yes
<rdrop-exit> thingie corresponds to the <name>
<tp> yes
<rdrop-exit> it's not actually coming from the stack, it's read in from the input stream
<tp> this is all i have for Mecrisp-Stellaris
<tp> constant name ( u|n - - ) Makes a single constant.
<rdrop-exit> I guess that's his comment convention for showing that name comes from the input stream
<tp> yeah and he doesnt define "n" anywhere
<tp> I guess it means "name" ?
<rdrop-exit> n is a signed integer
<rdrop-exit> u is a unsigned integer
<rdrop-exit> by u|n he means it doesn't matter it the cell is signed or not
<rdrop-exit> most people use x to show that
<rdrop-exit> x means a cell
<tp> but constant consumes two values ?
<tp> ahh!
<rdrop-exit> no just one
<rdrop-exit> from the stack, and a token from the input stream
<tp> AHH!
mtsd has quit [Quit: Leaving]
<tp> so input streams are not shown in the stack picture ?
<rdrop-exit> it depends on the convention you're using, he seems to have his own convention
<tp> i guess not as theyre not on the stack ?
<rdrop-exit> when you see something like ( x <name> -- ) it usually means x comes from the stack and <name> comes from input
<tp> I have a very poor understanding of how to deal with text perhaps this is one reason
<tp> is "name" equivalent to <name> ?
<rdrop-exit> if the string were coming from the stack it would probably be shown as ( a # -- )
<rdrop-exit> these are just conventions, some people use "name" some use <name>
<tp> erk, yet # is used to represent decimal numbers in Forth
<crest> tp: lets take something like this trivial example https://pastebin.com/raw/H05EESfV
<rdrop-exit> not all forths
<crest> the 0 @ drop is to make the compiler emit some useless code
<crest> if you haven't used <builds/create and does> before it works like this
<rdrop-exit> tp, there should be a section in your Forth's documentation where he explains his comment notation
<tp> crest, I did once, but my understanding is poor, I know its used to build application words
<tp> rdrop-exit, there isnt, Ive been building that up as I understand it
<crest> foo consists of two parts the code to build a new words and the code to execute them
<tp> crest, yes, I understand that
<tp> crest yours is a programmers example :)
<crest> and each time you use foo it just creates a tiny word with just the data required by the does> part
<tp> crest try and explain this ? : reg: ( "name" offset-addr -- ) <builds , does> @ or ;
<crest> no problem
<tp> crest yes
<crest> the stack comment tells the users that this word consumes a name from the input stream
<tp> I think it's used like this "reg: porta $100000" ?
<crest> its not
<crest> use it like $100000 reg: porta
<tp> ahh!
<tp> of course
<rdrop-exit> :)
<crest> <builds strips a token from the input as name for the new word it builds
<crest> than it stores a single cell from the stack in the new word with ","
<tp> to me, that stack description conveys no parameter order
<crest> at runtime that new word gets the address of the words "payload" on its stack and executes the code after does>
<crest> in this case it fetches the cell you stored there ($100000) and ors with the top of the datastack
<crest> so the porta defined by reg: does the same as : porta ( x1 -- x2 ) $10000 or ;
<crest> but it does this by splitting the code of from the parameters allowing the code to be reused
<crest> in such a trivial case : porta $10000 or inline 1-foldable ; is probably better
<crest> because the compiler can turn it into a single or with immediate (unless thumb can't encode $100000 as immediate)
<tp> it will from the user pov
<tp> but the machine code might be longer than expected
<crest> if the code after does> gets longer it becomes more useful
<crest> or if it contains a nice abstraction
<rdrop-exit> not necessarily, if the code gets long it should be factored
<tp> what I mean is if it cant it will use a special method to get that $100000 as immediate
<rdrop-exit> the bottom line is create does> is nice in principle, but rarely that useful in practice
<rdrop-exit> I've never encountered a situation where I thought to myself I wish I could use create> does> for this
<tp> crest, Mecrisp-Stellaris does auto inlining
<tp> and I think auto folding
<crest> within reason
<tp> well if it doesnt, I cant add it manually
<tp> I know rdrop-exit doesnt like auto anything but at my stage of noob I think it helps
<rdrop-exit> auto-folding is ok as long as you can switch it on and off, but I wouldn't want auto-inlining
<rdrop-exit> in fact that's the combination I usually use
<tp> oc course ": reg: ( "name" offset-addr -- ) <builds , does> @ or ;" was written by a programmer with little cortex-m experience
<rdrop-exit> My convention for input stream is to always put it at the end of the comment section e.g.
<rdrop-exit> constant ( x <name> -- )
<rdrop-exit> rather than constant ( <name> x -- )
<rdrop-exit> I have no idea what the standard recommends
<crest> i've seen both
<rdrop-exit> e.g. what I posted earlier today
<rdrop-exit> : unrolled, ( # <name> -- )
<rdrop-exit> ^ swap for dup compile, next drop ;
<tp> for a start every cortex-m peripheral can have 50+ registers
<rdrop-exit> the reg: example is a bad example
<tp> yeah
<tp> it's in a contributor code
<rdrop-exit> I would just use constants
<tp> which is what I do
<rdrop-exit> people get carried away
<tp> and everything is created from data in a CMSIS-SVD file for the MCU model itself
<tp> with 413 registers in the lowly chip I use, there can be no manual typing
<rdrop-exit> it's deja vu all over again
<tp> heh
<tp> you only write for the registers you use I know, but I generate a solution for everyone, and so it must handle *all* registers, flawlessly and without error
jsoft has quit [Ping timeout: 250 seconds]
<tp> it's not *all about rdrop-exit ;-)
<rdrop-exit> I've never said "don't do that", I'm all for you doing as much XML stuff as makes you happy
<rdrop-exit> I never claim my way is suited for anyone but me
<tp> and my system is awesome, I know because 2 out of the three people who have tried it said so .... ok one of them was me!
<veltas> : this-amount-of-xml-makes-me-happy ( n -- flags ) 0 > 0= ;
<rdrop-exit> veltas, don't you have NOT defined in your Forth :)
<tp> veltas, everyone I know said "XML UGGH it's the devils work, dont do it" but Ive found it to be incredibly handy
<veltas> Fair enough ;)
<rdrop-exit> veltas, you seem to often use 0= instead of NOT (aka INVERT)
<tp> me too
<veltas> I saw someone do it
<veltas> It's tp's fault
<veltas> I use INVERT normally but I couldn't remember if it was INVERT or INVERSE and my reference is not out
<rdrop-exit> traditionaly it's NOT
<rdrop-exit> INVERT is just because the ANS guys can't come to an agreement
<veltas> Hmmm a lot of forth seems to go that way
<tp> hahah, how is 0= equal to NOT ?
<veltas> I was trying to make my forth partial standard, but I might give up with that because it's so mangled
<rdrop-exit> 5 0= vs 5 NOT
<tp> 5 0= . 0 ok.
<tp> 5 NOT . -6 ok.
<tp> ?
<rdrop-exit> now try it with a well-formed flag (either -1 or 0)
<veltas> Because 'true' is 0 NOT
<veltas> that's why
<rdrop-exit> If you know you have either -1 or 0 on the stack use NOT, since most CPUs have a one instruction NOT
<rdrop-exit> while 0= may be a slower primitive
<veltas> 0= is probably faster on the z80 but code clarity is more important to me than speed
<veltas> And they take up just as much room in the colon def
<rdrop-exit> 0= is faster than NOT on the Z80?
<veltas> Yes
<rdrop-exit> I don't remember that, but I've all but forgotten the Z80
<veltas> Basically because 0= you OR two 8-bit registers
<veltas> And NOT you have to NOT two 8-bit register separately
<veltas> It's because there isn't a 16-bit NOT basically
<tp> Ill keep using 0= thanks, my world is very different to yours
<rdrop-exit> I'll have to dig up some ancient Z80 source to refresh ny brain cells
<tp> this is why: http://dpaste.com/112SWR2
<MrMobius> hmm, you might save a few cycles if you had an IF_= primitive in assembly
<rdrop-exit> tp, as I said if what you have on your stack is either 0 or -1 then NOT will give you the same result as 0=
<veltas> 0= in Z80 would be something like LD A,L OR H JR NZ,_false DEC HL <forth_next> _false: LD HL, 0 <forth_next>
<veltas> NOT in Z80 would be someting like LD A,L CPL LD L,A LD A,H CPL LD H,A <forth_next>
<rdrop-exit> cool
<veltas> Depends on how you implement it, conventions etc, but 0= can sometimes be faster
<veltas> I think it's actually slower in code above when it's not zero
<veltas> Anyway, the point is that 8-bit registers are cumbersome :-)
<veltas> Part of my motivation for using forth
<MrMobius> veltas, I ended up making a pretty slick macro system for the 6502 to get around that
<MrMobius> BYTE foo
<MrMobius> WORD bar
<tp> veltas, don't you mean 'Part of my motivation for torturing myself using Forth on a 8 bit z80" ?
<MrMobius> MOV.W foo,bar
<veltas> MrMobius: Yeah 6502 far more tedious than Z80
<rdrop-exit> It's probably worthwhile to check your code against some of the old z80 Forths
<veltas> rdrop-exit: I will do eventually
<tp> the forth way (tm) "load shoot mrmobius"
<MrMobius> the macro knows that foo is 8 bits and word is 16 bits so when it generates the assembly it knows to copy on the 8 bits then copy a zero into the high byte of bar. likewise copying a word to a byte only copies the low 8 bits. saves a ton of time
<MrMobius> load mrmobius shoot :P
<tp> hahah
<tp> touche
<MrMobius> veltas, heh, I doubt that :)
<crest> what would be useful is to define multiple words a once just like lisp macros
<rdrop-exit> I would be surprised if NOT isn't more efficient than 0=, but I'm so out of touch with 8-bit that my gut could be totally off
<crest> e.g. define a read-write register once and you get the constant and pretty print word
<crest> but i have no idea if mecrisp stellaris does offer a way to this without resorting to assembler
<rdrop-exit> crest, defining multiple words at once doesn't sound like a good idea to me
<crest> rdrop-exit: it does to me, but i've been exposed to lisp and similar languages
<rdrop-exit> Forth is not lisp
<crest> i know
<crest> but the same advantages apply
<crest> you type just one defintion and the compiler does the rest for you
<crest> *definition
<rdrop-exit> as opposed to factoring
<crest> this is factoring the compiler
<tp> crest, does the compiler use the latest remote mind reading equipment ?
<crest> tp: ?
<rdrop-exit> I don't see how it's factoring
<crest> there is a reparative pattern to the code
<crest> you want to tell the compiler there is a 32bit read-write register at address $12345
<tp> crest, how does it know what to do from the one definition ?
<rdrop-exit> you're confusing factoring with macros
<crest> $40023000 reg-rw-32: CRC_DR
<tp> sure
<crest> that would create a constant CRC_DR with the value $40023000
<crest> and a pretty printer named CRC_DR.
<crest> and yes in lisp you would use a macro for this
<rdrop-exit> how is this factoring?
<crest> how would you call it?
<rdrop-exit> No idea, but I wouldn't call it factoring
<crest> to me factoring is finding repeated code, giving it a name and replacing it with a call to the single copy
<tp> i get that from the XLST orocessing of the CMSIS-SVD tho ?
<tp> $48001400 constant GPIOF \ General-purpose I/Os
<tp> GPIOF $0 + constant GPIOF_MODER ( read-write ) \ GPIO port mode register
<tp> GPIOF $4 + constant GPIOF_OTYPER ( read-write ) \ GPIO port output type register
<tp> it comes out like that
<tp> along with the factory descriptions
<rdrop-exit> crest, ok, where's your pretty print word?
<rdrop-exit> you're creating tons of pretty print words, that's not factoring
<crest> that's what i have to find out
<rdrop-exit> factoring reduces combinatorial explosion
<crest> because just lots of postpone isn't enough
<rdrop-exit> combinatorial explosions are typically only at the primitives level (assembly level, machine instructions)
<rdrop-exit> for high level words one of the reasons to factor is to avoid combinatorial explosions
proteus-guy has quit [Ping timeout: 264 seconds]
<rdrop-exit> you factor so as to have words that you can use in phrases, rather than having an explosion of compound words
<crest> sure but do you want GPIO-A RW-REG32. or GPIOA.
<rdrop-exit> I want option 1
<crest> the idea behind those svd2forth words is to make the hardware accessable
<rdrop-exit> if tghe alternative is having option 2 x1000
<crest> if you have to know how each register is encoded you can just use $1234 hex.
<crest> $1234 @ HEX.
<tp> crest, the register encoding has to be supplied by the programmer for each use
<rdrop-exit> you make constants for your registers, that's fine
<crest> lets say i want to get started with new chip and use svd2forth to define words for the chip
proteus-guy has joined #forth
<crest> or i'm debugging some external hardware connected to the gpio pins
<crest> in that case its very useful to have easy to *use* words for interacting with the system
<crest> instead of easy to write words
<tp> yes, and you would normally write those words
<crest> but writing them by hand is tedious and error prone
<tp> thats why we use Forth
<tp> conside the C alternative ?
<tp> you have to read the datasheet, plan your code, write it, compile, flash and test
<tp> with Forth you hack up a quick real time test
<tp> like spacex
<rdrop-exit> crest, factoring is not about automatic generation of tons of words
<crest> correct
<crest> to you its dealing with the combinatorial explosion by splitting at the points of divergence
<crest> instead of n x m words you have n + m words that can be concatinated
merkc0 has joined #forth
merkc0 has quit [Client Quit]
<rdrop-exit> yes, that's definitely one reason to factor
<rdrop-exit> probably the most important reason
<rdrop-exit> and by doing that you gain a deeper understanding of the problem space
<crest> exactly
<rdrop-exit> and the areas were that partitioning is problematic bring to light the edge cases
<tp> wow, you guys are heavy duty!
<rdrop-exit> that you'll need to analyze on a case by case basis, to discover if you've missed some important insight into the problem
<rdrop-exit> IIRC there's a Chuck quote in Thinking Forth related to this
<rdrop-exit> at least one, maybe more
<rdrop-exit> gotta make a call and check on how my mother's doing under confinement
<rdrop-exit> catch you all later, stay healthy
rdrop-exit has quit [Quit: Lost terminal]
nonlinear has joined #forth
nonlinear1 has quit [Read error: Connection reset by peer]
<tp> cya !
<crest> oh shit it's possible but as far as i can tell only with evaluate *shudder*
<crest> or maybe with tsource an (create) ?
dave0 has quit [Quit: dave's not here]
Zarutian_HTC has joined #forth
TCZ has joined #forth
TCZ has quit [Client Quit]
TCZ has joined #forth
<crest> has anyone of you used source/setsource and >in ?
<crest> i want to redirect parse to use something else than the normal input buffer
TCZ has quit [Quit: Leaving]
rpcope has joined #forth
dys has quit [Ping timeout: 258 seconds]
TCZ has joined #forth
jsoft has joined #forth
WickedShell has joined #forth
xek has quit [Ping timeout: 250 seconds]
<tp> crest, not me
<crest> tp i to the source buffer changed as part of a nicer higher order function
<crest> but that's not enough for my purposes
<crest> the compiler detects that i'm trying to trick it
<crest> and tells me that the stack isn't balanced
<tp> yeah I get that occasionally
<crest> i suspect that's a false positive because my code is crazy
<crest> after all you're not supposed to change the source, reset >in and call :
<tp> mine are always positive positives :)
<crest> it works unless i attempt to compile literals into the new definition
<tp> I'll probably never be able to 'trick' Mecrisp-Stellaris as part of Matthias brain lives in every kernel
<crest> i can define something like "+ ."
<crest> the compiler caught me as i got to cocky
<crest> it would work with evaluate
<crest> but i want to avoid generating source code only to compile it again
<tp> hahah
<crest> but it works!
<crest> but i would prefer to use lots of postpone
<crest> matthias isn't active on irc or is he?
<tp> I remember a smart russian found he could create a ram based array from flash using evaluate, but it needs a reboot to use it and by then the ram is reset
<crest> oh and i just fetched a longan nano from the mail
<tp> no, hes been on #mecrisp maybe twice
<crest> there is no need to reset
<tp> oh, youll love the documentation ;-)
<crest> there is documentation ?!?
<tp> kind off
<crest> how much worse than the stm documentation is it?
<tp> the STMicro doc is awesome in comparison
<tp> Im actually a STMicro doc fan
<tp> when I started with STM32 and XML everyone said "STM doc is terrible, all over the place, innacurate etc, and XML is a horror, dont do it" Ive found neither to be true
* boru coughs.
<tp> the main problem with the GD32VF103 doc is it looks like they just pasted from the STM32F103 and forgot to edit it in a few very important places!
<crest> i finally got my 4k screen from work for the home office
<tp> boru, !!!!
<boru> Evening, old chap.
<boru> I was actually about to clock out, but not before getting a jab at ST.
<crest> boru: shoot
<boru> I was lamenting on the days in ##embedded cursing ST's documentation with tp.
<tp> crest this is the famous boru who single handily caused me to switch from Linux to FreeBSD
* boru chuckles.
<crest> boru: good work
<boru> Well, it was the logical choice you'd probably have made eventually.
<tp> hahaha, those were the days, I was exceedingly young and stupid then, now I'm old
<boru> It was always entertaining.
<crest> i was supprised to see mecrisp work on freebsd in userspace :-P
<crest> it simplifies debugging code
<tp> boru, this is an official "thank you" for influencing me to switch!
<boru> I can't drink "thank you" -- what good is it!"
<boru> But on a serious note, I figured you'd probably stick with it, given the philosophy.
<tp> hahah, I have a bottle of Kahlua with coffee coming today, I'll drink 60 mils to your health!
gravicappa has quit [Ping timeout: 256 seconds]
<boru> I'll have to export some decent Irish whiskey down there to you. You can't go on like that.
<crest> boru: in which timezone are you?
<tp> hahaah, oh I do like the Baileys
<boru> CEST at the moment.
<tp> crest same as you
<crest> i prefer a nice smokey islay whisky
<boru> "Scotch" is Irish for "toilet cleaner".
<crest> boru: most irish whiskey is just not peaty enough for my taste
<tp> boru, so I ended up with ZFS and jails, just love it. Have a snapshot every 15 mins the last 2 years compliments of zfstools
<crest> most are smooth and interesting, but that's not all i want from a whiskey
<boru> Fair enough. I could never get the taste for the heavily peated stuff, personally, but I've a bias, being from Ireland. There are some Speysides I like, and a few Islay and Highlands, also.
<tp> boru, it's understandable but Im a bit concerned about 12.2 coming out with Lua as the boot manager
<crest> boru: maybe 14y oban is a gateway drug for you
<boru> tp; have you played around with capsicum yet?
<boru> Well, Caol Ila, or Aberloud Abunadh would be Scotches I'd consider buying a bottle of.
<crest> boru: capsicum is nice in theory, but pain in the ass if you have to port a large code base
<tp> boru, no, my ex wife used to feed me capsicum because she new I had a stomach ulcer
<boru> But for the likes of Bunabainn etc, not my thing.
<crest> boru: in that case oban could be something you enjoy
<boru> Perhaps, but I don't think I'll stop drinking Irish any time soon./
<crest> why should you?!?
<boru> Indeed, you're right.
<crest> irish has good stuff to offer as well it's just not my normal taste
<boru> Redbreast is my go-to. Single pot stills in general.
<tp> boru, Id not even heard of capsicum, I'll look into it thanks
<boru> Cool idea, but as crest said, a bit of a pita for portability.
<tp> ah
<crest> writing new code with capsicum isn't (much) harder than using the normal abi
<crest> and it forces you to get it right
<boru> In any case, I should really clock out. Work beckons in the morning, and I got a bit carried away with hobbies this evening.
<tp> boru, I dont hang around on #embedded anymore, I lead a solitary Forth life
<crest> because you can't abuse the ambient authority to do things out of order
<boru> Yeah, I don't either. A lot of big egos in that channel.
<tp> boru, fantastic to chat! stay well old friend!
<boru> Sound. I'll catch up with you fellas again tomorrow.
* boru absconds.
<tp> awesome
<tp> crest, yeah boru is right, too many C loving egos there for me
<tp> and at my age I no longer have the interest to engage in pointless flame wars
<tp> crest, I never do much on FreeBSD anyway, I'm just a user
<crest> i'm a freebsd sysadmin who likes to break things to see what happens
<crest> at the moment i'm playing with the pot jail manager
<tp> oh nice!
<crest> and already broke the poor developer by accident
<tp> I was a Linux refugee to FreeBSD in 2016
<tp> will the developer recover ?
<crest> i just braindumped all over him and now he's implementing the missing features
<crest> yes
<tp> awesome
<tp> it's a honour to meet a FreeBSD sysadmin!
<crest> and i'm writing my own ipsec keyexchange daemon as a hobby project because IKEv1 and v2 are just insane
<tp> I recall observing youre a bit security focused
<crest> yes and no
<tp> Im not, it's all too complex for me
<crest> but i did replace the freebsd init system because wanted to see what happens
<crest> along the way i found damn good reasons for it
<crest> but most people don't want to touch init and rc systems with a 10ft pole
<tp> crest, couple of small bugs to go and Im ready to put that damn blue pill diag together
<tp> hahah, I like them as they are
<tp> i did look at NOSH but ran away screaming
<crest> have you looked at the older approaches?
<tp> and of course when systemd came anywhere near me I shot it
<crest> daemontools, runit?
<tp> I think openrc looked sensible
<tp> no I havent loked at them
<crest> openrc isn't much of an improvement on the existing init system from a technical point of view
<crest> yes it has some eye candy
<tp> but ill leave init changes to the experts and if I ever see systemd anywhere near FreeBSD I'll jump to openbsd or openindiana
<crest> but the existing freebsd rc system isn't bad even if some script have grown far too large *cough* netif *cough*
<tp> agree totally
<crest> i really like s6 and s6-rc
<tp> I actually really liked openindiana but Id be compiling for months to try and get the apps I wanted, plus it seems to be dying slowly ?
<crest> i gave a talk at eurobsdcon 2018 on the subject, but that year the video crew bailed
<tp> damn
<tp> i never saw any eye candy with openrc, and I abhor bling myself
<crest> stuff like colored output and ascii art animations during boot
<tp> I've run icewm for about 20 years I think, no icons
<tp> ahh
<tp> I never ran it
<crest> s6 has really clean and simple design it does one thing and does it well
<crest> it is *only* a process supervisor
<tp> the only time I was interested in ascii art was when I was trying to get some insight into analysing the stack
<crest> it starts long running processes in a clean enviroment and expects them to stay direct child processes (no double forking)
<crest> if the proceses die they are restarted and the error logged and a hook can handle it
<crest> the init process is a finite state machine with no runtime resource allocations
<crest> it can't fail or (dead)block by design
<tp> sounds good
<crest> that limits it to simple things
<tp> c.d is fine here, I never have any problems and this box runs 24/7
<crest> all it does is scan a directory for symlinks to directories at startup
<tp> rc.d I mean
<crest> the problem with rc.d is that it has to do a lot of work to workaround problems that shouldn't be possible
<crest> a daemon shouldn't start live a a child process of your shell
<tp> yeah, it's a bit ancient I know and as a sysadmin Id expect system init stuff to be very important to you
<crest> instead your shell start a small tool that tells the proper daemon to reload its configuration
<tp> any idea where FreeBSD is heading with that ?
<tp> theyve been debating it for ages now
<crest> nowhere because rc.d is good enough and you'll never reach agreement on this
<crest> it would start with bike shedding and could end in total war
<crest> nobody wants to risk a hard fork over this
<crest> and there is no reason to do it
<tp> so what do you use on your FreeBSD machines at work ?
<crest> because it can be done as a port
<tp> exactly
<crest> and yes i should update my s6 and s6-rc ports
<tp> why force people, let them make up their own mind
<crest> the only way i can see this work out is to show that a different init can work
<tp> blood will run ....
<tp> ill be updating this to 12.1 soon
<tp> dunno I want the lua boot manager of 12.2
<crest> don't worry about it
<crest> it was an ugly forth system anyway
<tp> not that I've found the Forth bootmanager very reliable standalone, but seems ok as a boot manager
<tp> yeah it was a horrible Forth
<tp> *is* a horrible Forth
<crest> yes but nobody wanted to work on it
<tp> I dont blame them
<tp> no one does Forth anyway
<tp> thats what they said
<tp> I should be glad it's not a python boot manager ;-)
<crest> the bootcode had a bus factor of one or two
<tp> what does that mena ?
<tp> mean
<crest> bus factor = number of people have to be hit by a bus to kill something e.g. an opensource project
<tp> hahahah
<tp> first time Ive heard that
<tp> but as lua is gigantic compared to Forth I wonder if it will fit as a boot manager ?
<crest> don't worry about it
<crest> the bootcode includes a readonly zfs and ufs implementation
<crest> yes they had to improve it because it didn't fit in 640k anymore
<crest> at least not on all mainboards
<crest> some bios vendors like to claim most of the lower 640k
<tp> readonly! so I cant get a terminal on it and do the things I never did with Forth ?
<crest> and having zfs, ufs and encryption support in the bootloader is really useful
<tp> ill never use anything but zfs again anyway
<tp> you running 12.2
<tp> ?
<crest> 12.1
<crest> at the moment
<tp> FORTH BOOTLOADER
<tp> oops sorry caps!
<crest> calm down
<crest> i've used the lua bootloader for a while and it just works
dave0 has joined #forth
<crest> finally i can keep my kernel and userland in the same dataset of an encrypted zfs pool
<crest> yes it was neat that the old bootloader was written in forth
<crest> but freebsd needs a working bootloader with certain features
<crest> and because nobody stepped up to maintain the existing forth code the project switched to a new bootloader in lua
<tp> I dont actually care, I just thought it was nice until I looked at the Forth code
<crest> the code is nasty
<tp> yeah, I gathered, which is perfectly understandable
<tp> yeah, as you said 'ugly'
<tp> I only care about Forth on embedded, thats where it works for me
<tp> I have been using Perl on FreeBSD for my stuff and never thought Id consider Forth on a PC until I looked at CRC's Retro
<tp> now I'm really tempted
<tp> crest, execline looks interesting and it seems I know the maintainer
<crest> heliocat?
<tp> crest@rlwinm.de ?
<crest> :-P
<tp> thought that may be you ?
jsoft has quit [Remote host closed the connection]
<crest> correct
<tp> awesome
<tp> should I stop using SH for all my pc-embedded glue and use execline instead ?
jsoft has joined #forth
<tp> crest, hmm are you also skarnet.org ?
<crest> no that's laurent bercot
<tp> interesting name, reminds me of the "skodenriders" from "A fire in the deep" by ‎Vernor Vinge
<tp> ahh
X-Scale` has joined #forth
X-Scale has quit [Ping timeout: 265 seconds]
X-Scale` is now known as X-Scale
TCZ has quit [Quit: Leaving]
<veltas> rdrop-exit isn't here
<veltas> But tp is
<veltas> Remember we were talking about DOES> earlier?
<tp> veltas, I'm the embedded guy not the DOES> guy :)
<crest> veltas: yes
<crest> i got even crazier while you were gone
<veltas> I said I would go away and think about it
<crest> and used setsource and >in to trick the compiler to defien new words
<crest> to use postpone etc.
<crest> but only the most trivial test cases worked that way
<crest> i couldn't get it to compile literals from the datastack
<crest> of course (ab-)using evaluate would work
<crest> but it don't want go generate *source* code
<crest> i would prefer to generate code directly
tolja has quit [Ping timeout: 256 seconds]
<veltas> Anyway I think I understand the overhead a bit better now
<veltas> I think the overhead is acceptable for my forth, and usecases
<veltas> But when most stuff doesn't have additional 'overhead' I can see why rdrop questions its value