mark4 changed the topic of #forth to: Forth Programming | do drop >in | logged by clog at http://bit.ly/91toWN backup at http://forthworks.com/forth/irc-logs/ | If you have two (or more) stacks and speak RPN then you're welcome here! | https://github.com/mark4th
pbaille has joined #forth
pbaille has quit [Ping timeout: 252 seconds]
<MrMobius> KipIngram, i stopped with TI at TI-89 which thr last one to support native code execution
<MrMobius> there are exploits for nspire but then ti patches them and the stop working until they find another loophole
<MrMobius> so i would say no not a great target but it can be made to work especially if youre ok not having newer OS features
<MrMobius> HP also doesnt allow it. check out Casio. they provide a C compiler. migjt be your best bet
<MrMobius> also they have python in rom and can run Xcas which is the same CAS in the HPs anyway
<KipIngram> That's good info. I just found an nspire that one of my daughters used in high school while cleaning out a drawer this afternoon.
<KipIngram> Just thought I'd... "investigate."
<MrMobius> oh very nice. if youve got one and arent looking to buy then that makes it easy
<KipIngram> I've never really understood why companies are so uptight about that sort of thing.
<KipIngram> I mean, so what if someone wants to hack their calculator?
<KipIngram> Seems like that just makes market demand higher (a little).
<KipIngram> Once they sell it to me, what's their interest in what I do with it?
<MrMobius> that was very much the attitude for decades. companied provided compilers and docs to make hacking easy
<MrMobius> but now engineers dont use them since technology has changed. all thats left is the education market
<KipIngram> Yes.
<MrMobius> if you allow hacking, the test mode features can be disabled and people can cheat
<KipIngram> Ugh.
<KipIngram> That makes sense, but it's still a bummer.
<MrMobius> so if you really wanna hack, get an HP or TI from before the market shift or get a casio
<KipIngram> Makes sense.
<KipIngram> Well, I'm not just burning to do it - I just found the thing and thought it was worth at least finding out what was possible.
<KipIngram> And the answer is "not much." :-)
<MrMobius> i saw a gen 1 HP prime on craigslist for $40 last week and turned it down. i just domt want it if i cant run code unless its su
<KipIngram> What I was actually looking for this afternoon, and found, was that little tiny thumb drive Cortex M4 gadget I bought a year or two ago.
<MrMobius> per cheap
<KipIngram> Now that I've got a new computer that will have working USB ports on order, I'll be able to do stuff with that sort of thing again.
<KipIngram> I've thought about porting my Forth to it.
<KipIngram> It's got the right sort of resources to land where a mid to late 1990's PC might have landed.
<KipIngram> Somewhere in there.
<KipIngram> My idea was to have it be able to sleep - you'd just plug it into a computer and do stuff directly on the stick, and then just unplug it and carry it away.
<KipIngram> I was hoping to get it so it could do multiple sessions at once, organized kindn of like a Gnu Screen set of windows.
<KipIngram> The thing is TINY - you could come really close to covering it up with a quarter.
dave0 has quit [Quit: dave's not here]
<MrMobius> thats really neat. have a link?
<KipIngram> Yeah. It may be obsolete now, but lemme see if I can dredge something up.
<KipIngram> one sec.
boru has quit [Ping timeout: 240 seconds]
<KipIngram> Here you go:
<KipIngram> The way I liked to describe is that it had RAM and storage resources similar to the first IBM PC I ever owned, and about 20x the clock speed. :-)
<KipIngram> It shipped with a little Python setup that you can use to program it right away, but I'll be interested in re-flashing it.
<KipIngram> That brought about a fairly major change in the last Forth. It had a simple block pool memory allocator. I was thinking in terms of running on a normal desktop environment, so I just set the page size to 64k and figured each session would only ever need one page.
<KipIngram> But that little dongle was more memory challenged, and I decided if I wanted to get to have multiple sessions on it I'd need to use much smaller pages.
<KipIngram> So, I did, and then coded it so that the dictionary could grow across page boundaries.
<KipIngram> I ran it with 4k page size most of the time I used it.
<KipIngram> But on the transition to MacOS Mojave something happened to the tool chain and that Forth stopped working. I troubleshot it down to the memory allocator and fixed it well enough to make it run, but I'm mostly just doing the new one.
<KipIngram> I'm keeping the memory management a lot simpler this time.
<KipIngram> Apple constanntly dicking with their tool suite is one of the reasons I decided to get a new computer.
<KipIngram> I swear sometimes it feels like Apple doesn't really want you to write software for their machine.
<KipIngram> What I'll have to do now is decide whether to continue forward with this "offset based" Forth design, or change it to use absolute addresses, since with Linux I can do that (I think). I may keep it using offsets just so it'll run both places - we'll see.
<KipIngram> Fortunately I already have all of the Linux syscall and ioctl values from the last time, so flipping that all over shouldn't be too bad.
sts-q has quit [Ping timeout: 246 seconds]
dave0 has joined #forth
dave0 has quit [Client Quit]
sts-q has joined #forth
pbaille has joined #forth
pbaille has quit [Ping timeout: 240 seconds]
pbaille has joined #forth
pbaille has quit [Ping timeout: 252 seconds]
pbaille has joined #forth
sts-q has quit [Quit: ]
sts-q has joined #forth
pbaille has quit [Ping timeout: 260 seconds]
proteus-guy has quit [Ping timeout: 252 seconds]
<mark4> can now specify window with / height and their coordinates as a percentage of the screen width/height :)
<mark4> really im just doing low hanging fruit here, i should be trying to integrate unit testing but thats not something thatas going to be easy for me
proteus-guy has joined #forth
wineroots has joined #forth
pbaille has joined #forth
mtsd has joined #forth
pbaille has quit [Ping timeout: 240 seconds]
pbaille has joined #forth
gravicappa has joined #forth
wineroots has quit [Remote host closed the connection]
wineroots has joined #forth
wineroots has quit [Remote host closed the connection]
wineroots has joined #forth
mtsd has quit [Remote host closed the connection]
mtsd has joined #forth
xek has quit [Remote host closed the connection]
xek has joined #forth
Zarutian_HTC has quit [Read error: Connection reset by peer]
Zarutian_HTC1 has joined #forth
Zarutian_HTC1 has quit [Read error: Connection reset by peer]
pbaille has quit [Remote host closed the connection]
pbaille has joined #forth
Zarutian_HTC has joined #forth
tech_exorcist has joined #forth
<KipIngram> Afternoon, gentlemen.
<KipIngram> mark4: I totally understand about certain very logically important tasks just not being the easy road. :-|
<KipIngram> So, what's a good syntax for a way to combine primitives? The "non-next" portion of each primitive would be strung into place, and we'd get a new primitive.
gravicappa has quit [Ping timeout: 240 seconds]
<KipIngram> I guess the syntax isn't my question - more just the name. Syntax wise it would be something like this:
<KipIngram> def-word <new name> <prim1> <prim2> <prime3> done-word
<mark4> :)
<KipIngram> and <new name> would wind up being a primitive with the "meat" of <prim1>-<prim3> with a single NEXT at the end.
<KipIngram> Anyway, I see this as the resolution of whether to have that whole flock of conditional returns.
<KipIngram> I think I should have just the flag conditional return, and then if I want any of the others I make them using the above.
<KipIngram> def-word 0=; 0 = ?; done-word
<KipIngram> That still might not be quite as efficient as the other - for one thing, it would still actually push a zero to the stack for the zero check.
<KipIngram> I guess def-word 0=; 0= ?; done-word is better.
<KipIngram> maybe just prim: and prim;
<KipIngram> That Python script I wrote to produce the assembly source for those words has them damn near optimum. There are a couple of places where there are clearly redundant assembly steps, but for the most part it's straight line from A to B.
<KipIngram> I figure if I stare at it a little while I can remove those inefficiencies.
<KipIngram> There's enough of them that I just couldn't imagine writing them all by hand and not making a few mistakes.
mtsd has quit [Ping timeout: 252 seconds]
LispSporks has joined #forth
Zarutian_HTC1 has joined #forth
Zarutian_HTC has quit [Read error: Connection reset by peer]
Zarutian_HTC1 has quit [Remote host closed the connection]
<tabemann> KipIngram: in an inlining native code forth, one could do something like the following (in zeptoforth) : <new name> [inlined] <prim1> <prim2> <prim3> ; as long as <prim1>, <prim2>, and <prim3> were inlined themselves
<KipIngram> I see. So still use : and ; - just include the [inlined] word.
<KipIngram> So [inlined] would just change the CFA of the just compiled name so that it behaves like a primitive. And then I guess it would loop over the following words, pulling the meat, and finally when it saw ; it would apply next.
<KipIngram> That seems simple.
dave0 has joined #forth
<dave0> maw
pbaille has quit [Remote host closed the connection]
LispSporks has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<tabemann> back
<tabemann> [inlined] just makes an inlined word
<tabemann> note that [inlined] has to go before ; not after because of the way compilation happens for flash
tech_exorcist has quit [Remote host closed the connection]
<dave0> tabemann: ooh does ; copy from ram to flash?
<tabemann> no
<tabemann> ; finishes compiling a word in flash
<tabemann> the problem with stuff like inlined or immediate the ANS way is that there is no way to know when to finally finish writing a word to flash
<tabemann> because in theory inlined or immediate could always be specified later
<tabemann> ; writes the flags field to flash, amongst other things
<tabemann> note that there is also inlined and immediate (without brackets), but they apply to words being compiled while the word they are within is being executed
<dave0> so inlined is a flag that the compiler notices to, instead of compiling an xt, it copies the word body directly?
<dave0> i always wanted more control over inlining in c... instead of having a function that is always inlined, i would rather an option to specify inlining for each instance that i call the function
<tabemann> inlined / [inlined] sets a flag where, when the word is called from another word, it compiles the word body into that word rather than compiling a subroutine call
<tabemann> note that there is a big caveat
<tabemann> words that are to be inlined cannot contain subroutine calls, only inlined words and constants
<tabemann> if this is not the case
<tabemann> it ignores inlined / [inlined]
<dave0> tabemann: are you using subroutine threading?
<tabemann> SRT/NCI
<tabemann> yep
<tabemann> note that a significant portion of primitives appear to be inlined in practice, from looking at disassembled code
<dave0> do calls use relative offsets? if it was a relative offset you wouldn't be able to copy the contents of the word somewhere else without fixing up the offsets
<tabemann> yes - exactly
<tabemann> that's why inlined words cannot contain subroutine calls
<tabemann> only inlined words and literals
<tabemann> they can contain control constructs though
<tabemann> because branches within an inlined word are allowed
<tabemann> just not branches out of the inlined word
<dave0> what did you name your conditional branch primitive? the branch-if-false one?
pbaille has joined #forth
<dave0> hmm i could call it brach-if-false haha i went with 0BRANCH
<tabemann> I don't have a catchy name for it, because it's actually two parts - one to reserve space for a branch to be compiled, and one that actually compiles the branch in that place
<tabemann> and I don't compile any actual word into that place
<tabemann> just a beq instruction
<dave0> oh that's interesting
<tabemann> well, also a cmp instruction too
<dave0> you effectively inlined the branch-if-false primitive
<tabemann> yes
<tabemann> there is no 0branch primitives, just primitives for setting up a branch and for actually resolving the branch
pbaille has quit [Ping timeout: 240 seconds]
<dave0> is your unconditional branch compiled to a jmp instruction?
<tabemann> well, to a b instruction, yes
<dave0> cool
<dave0> hmmm "b" for branch... is your cpu ARM ? :-)
<tabemann> yep
<dave0> nice
<tabemann> ARM Cortex-M4 and Cortex M7
<tabemann> I could probably do a port to ARM Cortex-M3, if I really felt like it
<tabemann> ARM Cortex-M0 and Cortex-M0+ are no-goes, though, because they would require significant rewriting of zeptoforth
<dave0> i once helped a guy make a 64 bit multiply with shifts and adds for an ARM forth... before i actually looked at forth
<dave0> that made me interested in forth
Zarutian_HTC has joined #forth
<tabemann> I based my 64-bit multiple and divide code on Mecrisp-Stellaris's code (I got permission from Matthias to relicense his code as MIT)
<dave0> ah let me google for that
<tabemann> bbl - dinner time
<dave0> byes tabemann
pbaille has joined #forth
pbaille has quit [Ping timeout: 252 seconds]
<tabemann> back
<dave0> wb tabemann
<tabemann> hey
* tabemann is weighing whether he should make a new release just because he fixed a bug in 2! of all things
<dave0> you could bump the 4th number of your version x.y.z.patchno
<tabemann> I've been currently going with 3 version numbers
<tabemann> x.y.z
<tabemann> and calling z bumps "patch-level releases"
<dave0> ah you could bump z
<dave0> tabemann: speaking of multiply & divide, i added a totally excessively silly word... integer square root :-)
<dave0> i found code on wikipedia
<tabemann> heh
<tabemann> I have square root, but it's fixed point
pbaille has joined #forth
<dave0> i can't see any use for it, but it sort of resembles multiply and divide so why not :-)
<tabemann> heh
pbaille has quit [Ping timeout: 260 seconds]
<KipIngram> What's that do? Just give you the nearest integer?
<KipIngram> I've been reading up on cordics.
<dave0> KipIngram: yup
<KipIngram> They make a lot of sense.
<dave0> brb
<KipIngram> dave0: Does it just average each guess with product/guess and iterate?
<dave0> KipIngram: no, it's like long division
<dave0> guessing is probably faster
<dave0> i adapted the c code there
<dave0> it works!
<dave0> it was just indulgent :-)
<dave0> i can't see any need for an integer sqrt lol
<tabemann> a fixed point SQRT is much more useful
<tabemann> and, after all, a 64-bit fixed point SQRT value can easily be turned into a 32-bit integral SQRT value
<KipIngram> That's great. x(i+1) = 0.5*(x(i) + product/x(i)) will work too.
<KipIngram> It's similar to Newton's method for that function. Or is exactly it - I'm not sure.
<tabemann> this is my implementation of SQRT: https://dpaste.com/4LNCD9CM2
<KipIngram> Yeah, I just scratched at it for a minute - I think that's just what Newton's method turns out to give for sqrt.
<tabemann> a lot of naive methods for numerical stuff based on things such as newton's method don't work out very well in practice though, I've found
<KipIngram> Yeah, you can get into trouble if you don't watch out.
<tabemann> either they end up having a lot of error when you have only 32 bits to the right of the decimal point, or they converge really slowly, or they have factorials that won't fit in 32 bits to the left of the decimal point
<KipIngram> When Newton's method works it works very well, though; once it starts converging you like double the accurate figures on every iteration.
<KipIngram> The cordic algorithms are mostly about trig functions - they're designed from the ground up to work well with base 2 digital representation of the angle.
<tabemann> yeah
<MrMobius> you can do sqrt and logs with cordic too if you use a different table than trig functions
<MrMobius> you can also do division if you're so inclined
<MrMobius> i was kind of disappointed when i looked at newton and similar solvers. theres just not anything that always works for everything
<KipIngram> Yeah, it seems like a kind of general method.
<KipIngram> I've had good luck with Runge-Kutta.
<KipIngram> But it is an "explicit" solvers, and they can be unstable for certain types of system.
<tabemann> I've derived most of my trig stuff from sqrt, expm1, and ln
<KipIngram> I think the impicit one I've used is Adams-Bashforth.
<MrMobius> hmm ya there are equations where newton oscillates forever if thats what you mean
<KipIngram> Yeah, it can get stuck in a cycle.
<KipIngram> It's been a long time since I learned this stuff; I think the problem equations are the ones where the ratio between the largest and smallest eigenvalues is large.
<KipIngram> They call them "stiff" systems.
Zarutian_HTC has quit [Read error: Connection reset by peer]
Zarutian_HTC has joined #forth