<rdrop-exit>
"Forth provides the tools for operating in a customized programming environment."
<rdrop-exit>
-- M.G. Kelly & N. Spies
<rdrop-exit>
good morning Forthwrights c[]
jsoft has quit [Ping timeout: 264 seconds]
rdrop-exit has quit [Quit: Lost terminal]
rdrop-exit has joined #forth
jsoft has joined #forth
<rdrop-exit>
"People like Steve Jobs say that the way to get simplicity is greater complexity.
<rdrop-exit>
Well, they don't put it quite that boldly. What they say is this, if we have intelligent enough systems and big enough systems, we can make them very easy to use. I have this stupid idea of simplicity via simplicity -- and for many applications it works." -- Jef Raskin
<phadthai>
it's enver simple enough for the stupid user :)
<phadthai>
s/enver/never/
<rdrop-exit>
:))
<phadthai>
"if it doesn't sing and dance at a single click, it's not ready for release -- phadthai"
<phadthai>
sorry for my midnight humor
<rdrop-exit>
np
<phadthai>
Day changed to 23 May 2020
<rdrop-exit>
I'm spending my lockdown going through old books and magazines, having a blast
<phadthai>
cool
<phadthai>
I've honestly been isolating too much and had pizza in a backyard with some people tonight, it was good, yet hopefully not too dangerous
<phadthai>
I'm in Montreal where the health-services curve is approximately at the limit
<rdrop-exit>
The lockdown is tougher on our two dogs than it is on me. It's given me a chance to go through boxes and boxes of forgotten literature.
<phadthai>
my mom almost died from it around 1th may, but fortunately ICU services and equipment were still available and she seems to be slowly recovering
<phadthai>
(still in a hospital though)
<rdrop-exit>
wow, you have my sympathy, hope she recovers quickly
<phadthai>
many thanks
<phadthai>
no longer in ICU and considered stable which is encouraging
<rdrop-exit>
excellent, there was a 95 year old laday here recently that recovered fully after a month
<rdrop-exit>
* lady
<phadthai>
at some point day after day updates were difficult to query, especially when sedation and oxygen were raised more and more with the ventilator etc
<phadthai>
spectacular, about the 95yo lady
<phadthai>
my mom is around 75
<rdrop-exit>
mine's 88 and lives by herself on the other side of the world, I call her weekly to check on her (real phone, she's not a computer user)
<phadthai>
ok
<phadthai>
it's the age my grandmother died, after complications from osteoporosis and ensuing depression, unfortunately
<rdrop-exit>
"It's important to remember that Forth is very much like a macro assembler for a two stack machine. It really is very low level but because it allows the development of application specific languages it can be brought up to high-level very quickly." -- Jeff Fox
<phadthai>
she was still autonomous and proud of it, until she fell because of a broken bone, then was on proud recovery, when learning that her other hip was also about to break if not being careful... so she moved to a decent elderly home, but about a year later wouldn't accept food etc
<phadthai>
I guess this is quite off-topic heh
<phadthai>
nice quote
<rdrop-exit>
I'm intermittenly posting quotes as I come across them going through the stacks of books, magazines, and printouts.
<phadthai>
just to end the sad story, although I was one of her main visitors along with my sister, at some point she seemed to either be mad or to not recognize us the last few times we visited, that was quite difficult for us to deal with at our young age back then
<phadthai>
soon after she died, although rather "peacefully"... natural gradual slowing of breath in her sleep
<rdrop-exit>
sad, my grandmother died very shortly after a broken hip
<rdrop-exit>
lunch is on the table, bbiab, stay healthy
<phadthai>
so we visited hours before the last breath, I remember her breating deeply every 30 seconds or so
<phadthai>
s/breating/breathing/
<phadthai>
some visitors believed, or hoped, that she might still hear so we had a turn with opportunity to privately talk
<phadthai>
I couldn't say anything personally so just watched in silence
<phadthai>
bon appetit
<phadthai>
actually I'll have some leftover pizza too heh
dddddd has quit [Ping timeout: 258 seconds]
<jsoft>
Well whats all happening in forth world today?
<jsoft>
I think its time to delve into stm32lx territory
<jsoft>
It kinda seems the msp430 stuff is well behind the stm32lx stuff
<jsoft>
Except in simplicity
dys has joined #forth
gravicappa has joined #forth
andrei-n has joined #forth
<tp>
bak
<tp>
jsoft, it's almost impossible to compare MSP430 and STM32
<tp>
it's like oranges and apples
<jsoft>
How so
<tp>
you tell me the difference between a apple and a orange and I'll tell you the difference between a MSP430 and a STM32 ?
<tp>
jsoft, anyway, dont get a "L" get a "G"
<tp>
jsoft, the G series looks to have the speed of the F and the low power of the L
xek has joined #forth
xek has quit [Ping timeout: 265 seconds]
<jsoft>
tp, hmm
<jsoft>
I have an L already, in an easy to use dev board setup already tho
<tp>
ahh
<tp>
me too
<tp>
but the newly released 'G' model looks to combine the best parts of the F and L
<tp>
the L is slow, 32MHz max
<tp>
the G takes it back up to 48MHz
<jsoft>
the 48Mhz does not really bother me
<jsoft>
I have never come close to needing 48Mhz for anything
<jsoft>
not in low power devices anyway
<tp>
jsoft, it bothers me, I actually run my 48MHz STM32F051 at 72 MHz
<jsoft>
Why tho?
<tp>
i used to run it at 96Mhz but couldnt write to the Flash at that speed
<jsoft>
What do you need that many Mhz for?
<tp>
SPEED
<jsoft>
To do what?
<tp>
develop
<jsoft>
lol
<tp>
seriously
<tp>
how does Forth load programs ?
<tp>
serially as it compiles them
<tp>
the faster the cpu, the faster that can happen
<tp>
my projects run at 48MHz or less, but I *develop* at 72MHz
<jsoft>
Ok yes, but back after all this 'development' is done, it does not need 72 or 96 Mhz
<jsoft>
or 48 Mhz
<tp>
true
<jsoft>
Well at least in my case
<tp>
and because all the timing is via the systick, I only change that with the clock for the actual standalone project
<jsoft>
Hmmm
<tp>
and I agree totally, I dont need the speed in the real world, even 8mhz is planty
dys has quit [Ping timeout: 246 seconds]
<tp>
I only require 72Mhz for development
<jsoft>
Yeah I think I need to get into some L0 business
<jsoft>
Fuck the complications, it can lick my dick
<jsoft>
I will win
<tp>
what complications, it's all extra FUN!
<jsoft>
I dunno, I seem to remember you saying Lx series are a nightmare
<tp>
no, I may have said that they have a lot of extra low power stuff to configure tho
<jsoft>
Yeah, and doing such is a nightmare
<tp>
I sure hope I didnt use the word 'nightmare'
<jsoft>
Well I dunno the exact words
<jsoft>
But that was the gist of it
<tp>
like anything new, once one assimilates the knowledge and experience it's easy
<jsoft>
I'm going to make then l0 my bitch :P
<tp>
for instance, I'm a bit bored with the F0 series as I know it well enough now, there isnt a lot I have to learn with it
<tp>
in no time at all youll be bored with the Lo
<jsoft>
I don't know dick about the f0 either.. I guess it computes the things
<tp>
then it's time for a "M"
<tp>
jsoft, hows your 'clocl' project going ?
<tp>
clock
<jsoft>
Yeah i've done the pcb up, I just need money to go produce it
<jsoft>
I've been paying out the ass for other things lately
<tp>
tyres and chains, child support, beer ?
<tp>
speeding fines ?
<jsoft>
tyres, yep
<jsoft>
wofs, brakes
<jsoft>
child support as usual
<jsoft>
beer
<jsoft>
well, bourbon
<jsoft>
and obviously, meat
<tp>
ah yes, gone cannibal yet due to the shortage of beef ?
<tp>
our local beef processor employed 1500 most on furlough now, plant shut down
<tp>
due to Coronavirus
<jsoft>
There is no shortage of beef
<jsoft>
What is furlough?
<tp>
it's like a unpaid holiday
<jsoft>
oh
<jsoft>
Fark
<jsoft>
Well there does not seem to be a bump in the beef over here anyway
<jsoft>
Thankfully
<tp>
youre still employed, still have a job, just not working and no money
<tp>
it's an American term I think
<jsoft>
Not sure I get ya
<tp>
jsoft, move this chat to #mecrisp ?
<tp>
apologies for our off topic chat folks
<jsoft>
It's tp's fault
<veltas>
glocal
<veltas>
lobal
<tp>
veltas, having a bad dyslexia day ?
<veltas>
Is this channel actually strict about being on-topic?
<tp>
veltas, it is but in a non obvious way
<veltas>
I understand if you come in here and just blogpost but if a conversation naturally evolves from forth-related discussion then I would generally not expect complaints
<tp>
for instance no one will stop you if you rant endlessly off topic, but anyone who does will wind up in a lot of ignore lists
<veltas>
I've noticed people tend to talk about ignore lists more than they apply them
<tp>
people here are very friendly and wont stop you, but the forthers who are only interested in Forth will prevent you filling up their logs with extranious off topic content by ignoring you
<veltas>
If you say so
<tp>
it's only my theory
<veltas>
My theory is people only react to stuff that annoys them, not stuff that bores them
<tp>
if you say so :P
<veltas>
It's only my theory
<tp>
touche
<veltas>
Actually it's a hypothesis since I have not tested it
<veltas>
Talking of Forth, I have input working and am now working on pictured numerical output
<tp>
nice work!
<veltas>
Another year and I'll be able to add numbers together interactively
<dave0>
veltas: i read on wikipedia that zx spectrum was popular in europe and it had z80... but commodore 64 was popular in america and it had 6502
<veltas>
Yes that's right
<veltas>
C64 was popular here too though
<dave0>
ah
<veltas>
We never had a video game crash like America either
<dave0>
my friend had a C64 and it had boulderdash, the best game ever :-)
<veltas>
The 6502 was popular here too, we had a 2MHz 6502 in the BBC Micro, which was pretty fast
<veltas>
A lot of schools had one
<veltas>
3.5MHz (which the ZX Spectrum came with) will outpace a 1MHz 6502 easily, but the video on the Spectrum is much more limited and inherently slow to access, so C64 games tend to have better/faster graphics
<veltas>
2MHz 6502 is more comparable. Spectrum could have made pretty good spreadsheet platform or something but all anyone remembers/owned is the games.
rdrop-exit has quit [Ping timeout: 265 seconds]
rdrop-exit has joined #forth
<veltas>
What would you call a word that does BASE @ HEX . BASE !
<veltas>
HEX. I suppose
<veltas>
There should be some stack manipulation in there sorry
<veltas>
BASE @ SWAP HEX . BASE !
TCZ has joined #forth
<rdrop-exit>
although I don't have a BASE variable, I name my equivalent $.
<rdrop-exit>
: u. ( u -- ) 10 x. ;
<rdrop-exit>
: $. ( u -- ) 16 x. ;
<rdrop-exit>
: %. ( u -- ) 2 x. ;
<veltas>
That's a much better name!
<veltas>
Thanks rdrop-exit
<rdrop-exit>
my pleasure
<veltas>
I think for my version I would use #. to print a decimal explicitly
<veltas>
I am using BASE since I'm still aiming for Forth 2012
<rdrop-exit>
#. is used in some Forths and OpenFirmware IIRC
<veltas>
For something else or for what I just said?
<rdrop-exit>
for decimals (although I don't remember if they use it for signed or unsigned decimal)
<rdrop-exit>
I suppose unsigned, we already have . for signed, I'm confusing with # being used as a prefix
<rdrop-exit>
(I just woke up from a nap) c[]
<rdrop-exit>
u. for unsigned decimal, . for signed decimal for printing
<rdrop-exit>
# 123 is used for decimal input in Open Firmware
<veltas>
Interesting
<rdrop-exit>
I use % 101110 for binary input
<rdrop-exit>
$ ffff for hex input
<veltas>
That syntax makes more 'sense' than adding the complexity into the number interpreter
<veltas>
Oh well
<veltas>
Would just entering a number get interpreted correctly?
<rdrop-exit>
# 123 is more cluttered then plain 123 but it means you don't have to do number interpretation after searching the entire dictionary which is very slow
<veltas>
Yeah I was just thinking that
<rdrop-exit>
in my Forths I don't have BASE, but I only check for decimal after a failed dictionary lookup
<veltas>
It would make the interpreter logic simpler to just remove numbers, and require # $ et al
<veltas>
But not much simpler
<veltas>
I'll consider it though if I ever make my own flavour
<rdrop-exit>
I compromised, decimal input doesn't need a prefix and therefore is slow (but uncluttered) while other bases require a prefix, $ for hex, % for binary
<rdrop-exit>
: $ ( <tok> -- u ) word 16 unsigned ; interpreted
<rdrop-exit>
: % ( <tok> -- u ) word 2 unsigned ; interpreted
<rdrop-exit>
I use the above instead of having a STATE variable
<rdrop-exit>
number base prefix words such as $ % (and your #) are prime candidates for dual behavior
<rdrop-exit>
since normally you want them to do one thing during interpretation and another during compilation, unless you're willing to give the compilation version another name, e.g. [#] [$] etc...
<rdrop-exit>
in normal Forth, such things would require words that change their behavior depending on the value of the STATE variable which opens up a whole can of worms
TCZ has quit [Quit: Leaving]
<rdrop-exit>
I'd rather not bother with having the STATE variable in the first place, or a BASE variable for that matter
<rdrop-exit>
(all the above is unstandard of course)
<veltas>
Of course
<veltas>
I don't have a problem with non-standard at all, I just want to produce a standard forth as a lowest-common-denominator approach.
<rdrop-exit>
I understand we're you're coming from, I sorta of gave up on standard Forth a long time ago since I have no need to run any of my Forth code on other than my own Forths
<rdrop-exit>
* where you're coming from
<veltas>
Okay I think I understand your writeup, I do like that approach
<rdrop-exit>
I find it leads to a better factoring of the outer interpreter, the compiler, and the interpreter than the STATE-based approach.
<rdrop-exit>
Just a sec, I'll dig up a related Chuck quote.
<rdrop-exit>
"Don't set a flag, set the function!" -- Chuck Moore, Thinking Forth
<rdrop-exit>
there's another, just a sec
<rdrop-exit>
"Choose the control structure that most closely matches the control-flow problem" -- Chuck Moore, Thinking Forth
<rdrop-exit>
interpretation lookup if >code execute then;
<rdrop-exit>
decimal ; compiled
<rdrop-exit>
: compiler ( -- ? )
<rdrop-exit>
compilation lookup 0= if decimal lit, then;
<rdrop-exit>
dup immediate? if >code execute then;
<rdrop-exit>
>code compile, ; compiled
<rdrop-exit>
If I were to always use a # prefix for decimal input, I could get rid of the decimal conversion attempt on unsuccessful lookup as you mentioned earlier
<rdrop-exit>
But I eventually decided to compromise on decimals to avoid clutter
<rdrop-exit>
IIRC Open Firmware always use base prefixes, even for decimals
<rdrop-exit>
My outer interpreter on my current host Forth looks like this:
<rdrop-exit>
: outer ( -- n/a )
<rdrop-exit>
word try dispatcher intercept refresh recur ; compiled
<rdrop-exit>
Dinner's on the table, catch you later, keep on Forthin' and stay healthy :)
TCZ has joined #forth
rdrop-exit has quit [Quit: Lost terminal]
tolja has quit [Ping timeout: 264 seconds]
<cmtptr>
go forth and multiply?
<CORDIC>
word
<veltas>
Is it weird I am adding double integer division before any kind of multiplication or regular integer multiplication/division
<veltas>
Well it's not weird because I am doing this in a 'as needed' basis, and this is the first thing that came up
<cmtptr>
it's a little weird that you needed double divide before you ever needed single anything, i guess
TCZ has quit [Quit: Leaving]
dave0 has quit [Quit: dave's not here]
<veltas>
cmtptr: Unfortunately this comes out of the definition of #
<veltas>
One typical way of doing an array of structures is with CREATE, i.e. CREATE TEST my-struct 80 * ALLOT
<veltas>
One way of doing a binary tree would be having a structure with left and right cells containing address of child node struct, or 0. This could be all located in an array like above, or each created with ALLOCATE
Zarutian_HTC has quit [Ping timeout: 260 seconds]
<andrei-n>
So to get a value in a structure you just count cells?
<veltas>
Do you understand how BEGIN-STRUCTURE works?
<veltas>
This is what e.g. C does as well, it knows the offset of everything in the struct. BEGIN-STRUCTURE gives you words that will add that offset to a given address
<veltas>
The name of the structure itself just gives you the total size of the structure
<andrei-n>
Is it standard?
<andrei-n>
I see it only in the gforth book...
<veltas>
andrei-n I just posted a link to the web standard
<andrei-n>
I understand, but it's something that doesn't seem to be mentioned in the books from forth.com, which I usually use. So, yeah, it's like named fields.
<veltas>
It's an optional section of the standard, and not all forths are standard or try to be. gforth does try though, and has its own older words for the same stuff as well
<veltas>
I would recommend reading gforth's manual as you are, because it does a good job explaining a lot of this stuff.
Zarutian_HTC has joined #forth
<veltas>
Lads, I have been sabotaged by C
<tp>
veltas, C is like that ;-)
<andrei-n>
Yeah, thanks. I think I'll use the gforth method, I won't test it on every system anyway.
<tp>
andrei-n, interestingly one of the first things C users ask about here is structures
<veltas>
I just caught myself using CHARS while doing address arithmetic, which is totally pointless in Forth 2012, the addresses are just addresses and bytes are 1. So even Forth 2012 doesn't need that.
<veltas>
C doesn't even have 'addresses', as ##C will tell you
<tp>
veltas, no, the C way seems to be to make all difficult embedded things into structures
<andrei-n>
I have the same problem with assembly, not only forth. I don't think counting bytes is the best method.
TCZ has quit [Quit: Leaving]
<tp>
and combine all bitfields into a cell so as to write them all at once
<veltas>
There's no "best method", it's situational, and using assembly (probably forth too) helps C programmers realise they were viewing their software through a filter of "what works in C"
<tp>
veltas, well put!
<veltas>
When I was starting with Z80 I would talk to other 8-bit programmers who would blow my mind about 8-bit performance programming
<andrei-n>
So what do forth people use instead of structures? Accessor functions?
<tp>
and C isn't the low level, on the baremetal OS that C users believe, it's more high level for systems, and it has difficulties with low level, mainly bitfields etc\
<veltas>
I would have a variable somewhere to store something needed in a critical routine, they would just use literals in their machine code and then *modify the literals in place* so the code could run faster
<tp>
andrei-n, whats your main reason for wanting structures, is it to deal with low level stuff like bitfields ?
<andrei-n>
tp, to implement binary trees, asts, and other complex data structures.
<veltas>
andrei-n: I think structures are a good fit for that
<veltas>
But... are complex data structures a good fit for the problem?
<andrei-n>
Sometimes it can be. If I need something like this I'd like to be sure that it's something that I can do.
<veltas>
I know exactly the feeling and I wish I could say more about using this in practice
<veltas>
I have not done 'serious' programming in Forth yet, so I will not pretend to answer with integrity on whether it can be approached 'nicely', although I believe it can
<veltas>
Certainly it's possible, you and I could both agree you could do this kind of programming in almost any language and Forth would not prevent it, but whether it's reasonable is another thing
<tp>
andrei-n, Im an embedded guy, veltas is the best to answer your query, so I'll just sit in the background now
<veltas>
rdrop-exit has given me the most useful indications that this works, although their environment might be quite different to gforth
<veltas>
Definitely good to ask them when they're around
<veltas>
I know I will do a 'serious' project in Forth at some point and have better answers, I am still very new to Forth really. :)
<andrei-n>
thanks. I also would like to do a serious project...
<veltas>
There are a lot of good candidates
<veltas>
Forth tiling window manager anybody?
<andrei-n>
I wanted to some kind of text editor, like emacs.
gravicappa has quit [Ping timeout: 246 seconds]
<veltas>
Forth numpy port
<veltas>
andrei-n: Text editor is definitely on my list
<andrei-n>
tiling window manager also would be awesome. After all there are already lisp-based wms.
<andrei-n>
why not a forth-based one.
<veltas>
Well if anybody writes anything like these suggestions and it's not bloated garbage or nasty keybindings I will use it
<veltas>
WM, editor, etc
<veltas>
In forth I mean
<andrei-n>
What's great about text editors is that you can extend them with programming languages, another one of my hobby subjects.
<andrei-n>
That's why I got interested in Forth. Languages use the stack. Forth also. And you can manipulate the stack. This way you can do cool and interesting things.
andrei-n has quit [Quit: Leaving]
* klys
recently picked up a copy of F83
<klys>
it works on dos in pcem, and I made a list of all the words
<klys>
I'm sure it's a much shorter list than comes with more modern forths
<klys>
now I would like to classify the words into seven categories: app dat net sys etc doc src.
<klys>
troube being that I don't know hardly any of them nor what they do.
<klys>
trouble being that I don't know hardly any of them nor what they do.