Re: An assembly question from the past
Hi Kashyap, > I can see how you would have to end up writing the whole thing in assembly > - in the example you shared. Would it be right to say that its only the > carry flag that you need or is it just an example and there are other flags > too? Pil64 used three flags (zero, sign and carry). CPUs usually have a lot more of them, e.g. overflow, but I decided to go without them. Some functions returned values in one or more registers, plus some flags. This is much more powerful than the single return value supported by C. > Can I say that the need is restricted to the use of BigNum? On the machine instruction level, the carry is used in a lot more situations, like comparisons or arithmetic shifts. > The ability to set/get the stack I presume needs to be compared with > setjmp/longjmp - correct? Is setjmp/longjmp insufficient or is it not > efficient enough? No, setjmp/longjmp is fine. Pil21 uses it too. But in some situations you need to set the stack pointer explicitly (e.g. when allocating coroutine stack areas) or read it (stack overflow checks). ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: An assembly question from the past
Thanks for the clear explanation Alex, Just to give some background - I've been working on the attempt to port miniPicoLisp to windows (more like making vanilla C as the only dependency). I wanted to make sure that I understood the cost of not going with assembly. Since I use https://github.com/libtom/libtommath for BigNum I think I am okay on the flags front. For the stack - I believe that Pil successfully existed without coroutines for decades right :) and I can see how I could mimic coroutines in the "user space". Somehow llvm - even though it's "industry standard" now - I feel that it imposes too much as a dependency - the very fact that it's written in c++ is a turn off for me :) Regards, Kashyap On Wed, Mar 30, 2022 at 12:13 AM Alexander Burger wrote: > Hi Kashyap, > > > I can see how you would have to end up writing the whole thing in > assembly > > - in the example you shared. Would it be right to say that its only the > > carry flag that you need or is it just an example and there are other > flags > > too? > > Pil64 used three flags (zero, sign and carry). CPUs usually have a lot more > of them, e.g. overflow, but I decided to go without them. > > Some functions returned values in one or more registers, plus some flags. > This > is much more powerful than the single return value supported by C. > > > Can I say that the need is restricted to the use of BigNum? > > On the machine instruction level, the carry is used in a lot more > situations, > like comparisons or arithmetic shifts. > > > > The ability to set/get the stack I presume needs to be compared with > > setjmp/longjmp - correct? Is setjmp/longjmp insufficient or is it not > > efficient enough? > > No, setjmp/longjmp is fine. Pil21 uses it too. But in some situations you > need > to set the stack pointer explicitly (e.g. when allocating coroutine stack > areas) > or read it (stack overflow checks). > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: An assembly question from the past
On Wed, Mar 30, 2022 at 08:13:00AM -0700, C K Kashyap wrote: > Just to give some background - I've been working on the attempt to port > miniPicoLisp to windows (more like making vanilla C as the only > dependency). Good, but isn't miniPicoLisp plan vanilla C anyway? I think it uses only stdio library functions. > For the stack - I believe that Pil > successfully existed without coroutines for decades right :) Yes. Coroutines are very nice in some situations, but with more programming effort you can always implement a conventional solution instead. > Somehow llvm - even though it's "industry standard" now - I feel that it > imposes too much as a dependency - the very fact that it's written in c++ > is a turn off for me :) I agree with both statements. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: An assembly question from the past
> Good, but isn't miniPicoLisp plan vanilla C anyway? I think it uses only > stdio > library functions. > Thanks :Alex :) ... almost Vanilla C I think - with some gcc toppings (VLA particularly) ;) I also moved away from pointer tagging in favor of an extra "part" in the cell. This takes away any alignment requirement as well
Re: An assembly question from the past
I haven't been following this thread terribly closely, so I hope this question isn't off-base. Is there a version of picolisp that runs on 80386/80486/80586 'bare metal' (or at least 'bare VM') -- talking directly to a HW serial port and reading from a FAT file system? -Original Message- From: Sent: Mar 30, 2022 10:38 AM To: Subject: Re: An assembly question from the past On Wed, Mar 30, 2022 at 08:13:00AM -0700, C K Kashyap wrote: > Just to give some background - I've been working on the attempt to port > miniPicoLisp to windows (more like making vanilla C as the only > dependency). Good, but isn't miniPicoLisp plan vanilla C anyway? I think it uses only stdio library functions. > For the stack - I believe that Pil > successfully existed without coroutines for decades right :) Yes. Coroutines are very nice in some situations, but with more programming effort you can always implement a conventional solution instead. > Somehow llvm - even though it's "industry standard" now - I feel that it > imposes too much as a dependency - the very fact that it's written in c++ > is a turn off for me :) I agree with both statements. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: An assembly question from the past
This may be of interest to you Henry - https://picolisp.com/wiki/?PilOS On Wed, Mar 30, 2022 at 4:42 PM Henry Baker wrote: > I haven't been following this thread terribly closely, so I hope this > question isn't off-base. > > Is there a version of picolisp that runs on 80386/80486/80586 'bare metal' > (or at least 'bare VM') -- talking directly to a HW serial port and reading > from a FAT file system? > > -Original Message- > From: > Sent: Mar 30, 2022 10:38 AM > To: > Subject: Re: An assembly question from the past > > On Wed, Mar 30, 2022 at 08:13:00AM -0700, C K Kashyap wrote: > > Just to give some background - I've been working on the attempt to port > > miniPicoLisp to windows (more like making vanilla C as the only > > dependency). > > Good, but isn't miniPicoLisp plan vanilla C anyway? I think it uses only > stdio > library functions. > > > > For the stack - I believe that Pil > > successfully existed without coroutines for decades right :) > > Yes. Coroutines are very nice in some situations, but with more programming > effort you can always implement a conventional solution instead. > > > Somehow llvm - even though it's "industry standard" now - I feel that it > > imposes too much as a dependency - the very fact that it's written in c++ > > is a turn off for me :) > > I agree with both statements. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe >