On Fri, 6 Feb 2026 22:32:14 +0000, Pancho wrote:
I was assuming the hardware stack was more than just a register, and
memory. i.e. I assumed there were specific pop/push instructions
which were optimised to get data and adjust a register stack pointer
as a single instruction.
Some common architectures have no hardware stack: the stack convention
comes purely from the software ABI. E.g. POWER/PowerPC.
So there would be a performance hit in a software stack where
multiple instructions would be needed.
I remember, back in the days of the VAX, which was the classic machine
with the rCLkitchen-sinkrCY instruction set in the 1980s -- an instruction for just about everything, including pushing and popping stack
elements. You could save the lowest 6 general-purpose registers with
just one PUSHR instruction (2 bytes), or you could do it with 6
separate PUSHL instructions (2 |u 6 = 12 bytes). Guess which was
faster?
On 2/5/26 16:03, Richard Kettlewell wrote:
Pancho <Pancho.Jones@protonmail.com> writes:
On 2/5/26 14:14, The Natural Philosopher wrote:
The first is of course implementation specific. C can specify a data
stack separate from a program stack and avoid code corruption,
leaving only data corruption...
Can it? Naively, I would have thought C was normally built on top of
native assembler function calls, which dictates a shared stack.
Obviously you could implement a function call independent of
assembler, but does anyone, in practice?
YourCOd leave the call stack as it is (i.e. CALL and RET, on x86) and
use another register to manage the data stack (maybe rbp on
x86). IrCOve never heard of anyone doing it for C but I donrCOt think
thererCOs any fundamental obsctacle to it. ItrCOd be a distinct ABI, so
not particularly convenient to integrate into existing systems.
I was assuming the hardware stack was more than just a register, and
memory. i.e. I assumed there were specific pop/push instructions which
were optimised to get data and adjust a register stack pointer as a
single instruction. So there would be a performance hit in a software
stack where multiple instructions would be needed.
On 2/5/26 16:03, Richard Kettlewell wrote:
Pancho <Pancho.Jones@protonmail.com> writes:
On 2/5/26 14:14, The Natural Philosopher wrote:
The first is of course implementation specific. C can specify a data
stack separate from a program stack and avoid code corruption,
leaving only data corruption...
Can it?-a Naively, I would have thought C was normally built on top of
native assembler function calls, which dictates a shared stack.
Obviously you could implement a function call independent of
assembler, but does anyone, in practice?
YourCOd leave the call stack as it is (i.e. CALL and RET, on x86) and use
another register to manage the data stack (maybe rbp on x86). IrCOve never >> heard of anyone doing it for C but I donrCOt think thererCOs any fundamental >> obsctacle to it. ItrCOd be a distinct ABI, so not particularly convenient
to integrate into existing systems.
I was assuming the hardware stack was more than just a register, and
memory. i.e. I assumed there were specific pop/push instructions which
were optimised to get data and adjust a register stack pointer as a
single instruction. So there would be a performance hit in a software
stack where multiple instructions would be needed.
Looking at Google, it appears my simplistic view of pushing arguments
onto the stack is wrong anyway. There seems to be optimisations
involving using registers for the first few arguments (x86/64), more so
with RISK_V, only using the stack when necessary. I guess there are also parallel instructions to push multiple registers onto a hardware stack
in one go.
But I take your point about the protection of execute permission on
memory areas etc.
On 2/6/26 20:12, Lawrence DrCOOliveiro wrote:
On Fri, 6 Feb 2026 22:32:14 +0000, Pancho wrote:
I was assuming the hardware stack was more than just a register, and
memory. i.e. I assumed there were specific pop/push instructions
which were optimised to get data and adjust a register stack pointer
as a single instruction.
Some common architectures have no hardware stack: the stack convention
comes purely from the software ABI. E.g. POWER/PowerPC.
So there would be a performance hit in a software stack where
multiple instructions would be needed.
I remember, back in the days of the VAX, which was the classic machine
with the rCLkitchen-sinkrCY instruction set in the 1980s -- an instruction >> for just about everything, including pushing and popping stack
elements. You could save the lowest 6 general-purpose registers with
just one PUSHR instruction (2 bytes), or you could do it with 6
separate PUSHL instructions (2 |u 6 = 12 bytes). Guess which was
faster?
-a The TMS-9900 had a couple of similar instructions
-a so you could shove ALL the registers onto a stack
-a before branching or whatever. Odd chip - sort of
-a a hardware solution to multiple users.
Proper coding and nobody will over-write yer buffer.
On 2/6/26 05:45, The Natural Philosopher wrote:
On 06/02/2026 01:51, c186282 wrote:
On 2/5/26 14:27, The Natural Philosopher wrote:Oh sure. You would have to modify the compiler
On 05/02/2026 15:09, Pancho wrote:
On 2/5/26 14:14, The Natural Philosopher wrote:You simply use-a a register as a second stack [data] pointer.
The first is of course implementation specific. C can specify a
data stack separate from a program stack and avoid code
corruption, leaving only data corruption...
Can it?-a Naively, I would have thought C was normally built on top >>>>> of native assembler function calls, which dictates a shared stack.
Obviously you could implement a function call independent of
assembler, but does anyone, in practice?
Assign all your mem variables on that stack, and increment it at
function end.
The assembler is trivial. Making C do it that way would not be hard,
either..
-a-a I actually searched on that a little, could
-a-a not see any civil way to specify a stack in
-a-a a new segment in 'C'.
-a Ah .... no problems then .......
But IIRC the first PDP I worked on had 64k data and 64k code in
entirely different bits of RAM.
-a Works.
-a Of course actual 'segments' are kind of
-a passe' these days - an olde-dayz artifact
-a everyone hated.
-a-a ASM, yea, easier - you have total control (andOf course. That's what it teaches you....
-a-a total responsibility).
-a Gen X/Y/Z/A2 "programmers" - have any EVER done
-a a thing in ASM ? Even microcontrollers are now
-a normally done in 'C' or MicroPython.
On 07/02/2026 02:59, c186282 wrote:
On 2/6/26 20:12, Lawrence DrCOOliveiro wrote:Yes indeed. A context switch was enormously efficient.
On Fri, 6 Feb 2026 22:32:14 +0000, Pancho wrote:
I was assuming the hardware stack was more than just a register, and
memory. i.e. I assumed there were specific pop/push instructions
which were optimised to get data and adjust a register stack pointer
as a single instruction.
Some common architectures have no hardware stack: the stack convention
comes purely from the software ABI. E.g. POWER/PowerPC.
So there would be a performance hit in a software stack where
multiple instructions would be needed.
I remember, back in the days of the VAX, which was the classic machine
with the rCLkitchen-sinkrCY instruction set in the 1980s -- an instruction >>> for just about everything, including pushing and popping stack
elements. You could save the lowest 6 general-purpose registers with
just one PUSHR instruction (2 bytes), or you could do it with 6
separate PUSHL instructions (2 |u 6 = 12 bytes). Guess which was
faster?
-a-a The TMS-9900 had a couple of similar instructions
-a-a so you could shove ALL the registers onto a stack
-a-a before branching or whatever. Odd chip - sort of
-a-a a hardware solution to multiple users.
It wasn't so much (IIRC) a question of having all the registers pushed
into a stack so much as not having registers in the first place - these being instead locations in memory pointed to by a master register, which
you could change and thereby have a completely new context.
Thus general instructions were slow, but context switches were
blindingly fast. a real minicomputer architecture
I may be wrong about that., Its been a long time.
On 07/02/2026 02:44, c186282 wrote:
On 2/6/26 05:45, The Natural Philosopher wrote:Isn't it all handled by a memory manager?
On 06/02/2026 01:51, c186282 wrote:
On 2/5/26 14:27, The Natural Philosopher wrote:Oh sure. You would have to modify the compiler
On 05/02/2026 15:09, Pancho wrote:
On 2/5/26 14:14, The Natural Philosopher wrote:You simply use-a a register as a second stack [data] pointer.
The first is of course implementation specific. C can specify a >>>>>>> data stack separate from a program stack and avoid code
corruption, leaving only data corruption...
Can it?-a Naively, I would have thought C was normally built on top >>>>>> of native assembler function calls, which dictates a shared stack. >>>>>> Obviously you could implement a function call independent of
assembler, but does anyone, in practice?
Assign all your mem variables on that stack, and increment it at
function end.
The assembler is trivial. Making C do it that way would not be
hard, either..
-a-a I actually searched on that a little, could
-a-a not see any civil way to specify a stack in
-a-a a new segment in 'C'.
-a-a Ah .... no problems then .......
But IIRC the first PDP I worked on had 64k data and 64k code in
entirely different bits of RAM.
-a-a Works.
-a-a Of course actual 'segments' are kind of
-a-a passe' these days - an olde-dayz artifact
-a-a everyone hated.
Precisely.-a-a ASM, yea, easier - you have total control (andOf course. That's what it teaches you....
-a-a total responsibility).
-a-a Gen X/Y/Z/A2 "programmers" - have any EVER done
-a-a a thing in ASM ? Even microcontrollers are now
-a-a normally done in 'C' or MicroPython.
But at least inveterate tinkerers are leaning about things like response times...
My Picos will not output anything to the USB port for quite a few milliseconds after it has been initialised.
Juts be patient and use the sleep function
Bought a 'Pico starter kit' recently. Still in the box. A Pico2w and
some little dev boards and jumper wires and what looks to be a
super-tiny LCD display of some kind. Gotta check to see if I have a compatible power supply.
Have the instructions for adding the 'C' dev junk to my system (and
there's always MicroPython).
On 07/02/2026 21:31, c186282 wrote:
Bought a 'Pico starter kit' recently. Still in the box. A Pico2w and
some little dev boards and jumper wires and what looks to be a
super-tiny LCD display of some kind. Gotta check to see if I have a
compatible power supply.
On 07/02/2026 21:31, c186282 wrote:
Bought a 'Pico starter kit' recently. Still in the box. A Pico2w and
some little dev boards and jumper wires and what looks to be a
super-tiny LCD display of some kind. Gotta check to see if I have a
compatible power supply.
I think anything from 3 to 5.5V. Draws a couple of hundred mA max when shouting radio.
Have the instructions for adding the 'C' dev junk to my system (and
there's always MicroPython).
Took me a long time to figure out the C toolkit.-a And cmake.
Scream for help if you get stymied.
I'll see what the online docs can do for me, there are a fair number,
maybe they'll do it. Alas there always seem to be weird syntax traps
in some of the utilities.
Gen X/Y/Z/A2 "programmers" - have any EVER done a thing in ASM ? Even microcontrollers are now normally done in 'C' or MicroPython.
This prompted me to try ferroelectric memory, which is much much
faster. Built a dozen field-project boards using that. Could save a
bunch of relevant vars and values into that mem more often without
slowing down the rest of the app.
On Sat, 7 Feb 2026 16:31:24 -0500
c186282 <c186282@nnada.net> wrote:
This prompted me to try ferroelectric memory, which is much much
faster. Built a dozen field-project boards using that. Could save a
bunch of relevant vars and values into that mem more often without
slowing down the rest of the app.
Been meaning to poke around with that for ages. Obviously the intended application is as an alternative to flash memory for persistent storage
of firmware and/or settings, but it's interesting to consider a small homebrew system where it's used as main memory, directly analogous to
core - free and indefinite-ish "suspend" with no battery drain!
(Volatility of main memory is such a baked-in assumption to every form
of computing post-mini era...of course mobile devices have had suspend/ resume for ages, but our OSes are still designed around the assumption
that the computer starts with a blank slate and every process starts by getting loaded from disk. It'd be interesting to seriously re-examine
that way of thinking...)
Alas it's not 'dense' ... ie the chips don't hold THAT much info in comparison to typical flash. I think you can find 512kb ferro chips,
and that's about it.
GREAT for lower-end/microcontroller/field devices. But yer not gonna
be buffering video frames.
Anyway, look on Mouser and DigiKey ... I2C examples are most common
but there do seem to be a few more, maybe faster, options.
On Mon, 9 Feb 2026 23:39:05 -0500
c186282 <c186282@nnada.net> wrote:
Alas it's not 'dense' ... ie the chips don't hold THAT much info in
comparison to typical flash. I think you can find 512kb ferro chips,
and that's about it.
GREAT for lower-end/microcontroller/field devices. But yer not gonna
be buffering video frames.
Anyway, look on Mouser and DigiKey ... I2C examples are most common
but there do seem to be a few more, maybe faster, options.
Actually have a coupla parts hanging around, from the period where it
was new enough they'd hand out samples to anyone passing themselves off
as a researcher ;) Think I've got a meg or two of the second-generation
stuff (and another 64KB of first-gen, but the read/rewrite life on that
is specced an order or two of magnitude lower.)
Had the notion to use old cache SRAMs as a 1:1 write-through cache to
keep wear to a minimum; just haven't gotten around to *doing* it yet.
Well, oneathesedays...
I just bought a Pico2w "starter kit". Dunno if I really NEED a Pico
for anything but it does look to be good cool tech so I'm gonna put
in the effort. Ards are also good, have used them for many things and
the IDE really makes stuff easier,
but they're not as zippy as a Pico and adding wi-fi, or even wired
networking, do NOT expect any useful speed.
There have become a large selection of really sophisticated sensors
out there - multi-axis super-precise position/motion sensors, multi-
axis magnetometers with impressive sensitivity,
those kinds of things. They're aimed mostly at the mobile bot/drone
markets. The prices are impressively good now too. But they are SO
capable, SO many options, so many relevant factors, that you really
need a 'sensor nerd' to lay it all out in a comprehensible manner.
On Wed, 11 Feb 2026 20:22:32 -0500, c186282 wrote:
There have become a large selection of really sophisticated sensors
out there - multi-axis super-precise position/motion sensors, multi-
axis magnetometers with impressive sensitivity,
those kinds of things. They're aimed mostly at the mobile bot/drone
markets. The prices are impressively good now too. But they are SO
capable, SO many options, so many relevant factors, that you really
need a 'sensor nerd' to lay it all out in a comprehensible manner.
https://docs.arduino.cc/hardware/nano-33-ble-sense/
The Harvard TinyML series used these so I have a couple plus the expansion board to a camera for image recognition that was in their kit. Saves you a lot of Dupont wires :)
https://www.adafruit.com/product/3333
I bought one of these 6 years ago and it was my introduction to
CircuitPython and ARM Cortex M0. Not a bad package to play with. CircuitPython can be a little friendlier that MicroPython but the last
time I looked it didn't do interrupts. I don't think it has the decorator that MircoPython uses to do the weird little GPIO assembler stuff either.
So many toys, so little time. I'm starting to miss the old toys though.
When you dig into the guts of the Pico 2's processor it gets gnarly. 4
cores, 2 ARM and 2 RISC-V plus all the wiring to bridge to the GPIOs. Lot
of registers with a lot of bits is you got deep into the C stuff.
On 2/11/26 23:48, rbowman wrote:
On Wed, 11 Feb 2026 20:22:32 -0500, c186282 wrote:
-a-a-a There have become a large selection of really sophisticated sensors >>> -a-a-a out there - multi-axis super-precise position/motion sensors, multi- >>> -a-a-a axis magnetometers with impressive sensitivity,https://docs.arduino.cc/hardware/nano-33-ble-sense/
-a-a-a those kinds of things. They're aimed mostly at the mobile bot/drone >>> -a-a-a markets. The prices are impressively good now too. But they are SO >>> -a-a-a capable, SO many options, so many relevant factors, that you really >>> -a-a-a need a 'sensor nerd' to lay it all out in a comprehensible manner. >>
The Harvard TinyML series used these so I have a couple plus the
expansion
board to a camera for image recognition that was in their kit. Saves
you a
lot of Dupont wires :)
https://www.adafruit.com/product/3333
I bought one of these 6 years ago and it was my introduction to
CircuitPython and ARM Cortex M0. Not a bad package to play with.
CircuitPython can be a little friendlier that MicroPython but the last
time I looked it didn't do interrupts. I don't think it has the decorator
that MircoPython uses to do the weird little GPIO assembler stuff either.
-a Interrupts are very important for buttons and some
-a sensors ! Otherwise you have to waste vast CPU
-a *polling*.
So many toys, so little time. I'm starting to miss the old toys though.
When you dig into the guts of the Pico 2's processor it gets gnarly. 4
cores, 2 ARM and 2 RISC-V plus all the wiring to bridge to the GPIOs. Lot
of registers with a lot of bits is you got deep into the C stuff.
-a Yeek !
-a Oh well, I'll give it a try. Not an expensive
-a experiment, so what the hell ...
Interrupts are very important for buttons and some sensors !
Otherwise you have to waste vast CPU *polling*.
On Thu, 12 Feb 2026 01:04:33 -0500, c186282 wrote:
Interrupts are very important for buttons and some sensors !
Otherwise you have to waste vast CPU *polling*.
It all depends. Interrupts add complexity. For many applications the CPU doesn't have anything better to do than poll.
I take a hybrid approach. I set a timer to wake me up every so
often, then poll everything once. If there's no activity, I go back
to sleep again.
On Thu, 12 Feb 2026 01:04:33 -0500, c186282 wrote:
Interrupts are very important for buttons and some sensors !
Otherwise you have to waste vast CPU *polling*.
It all depends. Interrupts add complexity. For many applications the CPU doesn't have anything better to do than poll.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 59 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 24:09:19 |
| Calls: | 810 |
| Calls today: | 1 |
| Files: | 1,287 |
| D/L today: |
12 files (21,036K bytes) |
| Messages: | 195,978 |