How Small Can You Make A C Executable?

It’s well known that the difference in executable size between a compiled binary and one hand-written in optimized assembler will be significant. The compiler brings in all manner of boilerplate whether it needs all of it or not, which is responsible for the extra space. [Weineng] has fallen down the rabbit hole of trying to make the smallest possible gcc-compiled C executable, and the resulting write-up is a fascinating read.

Surprisingly the smallest C program isn’t “Hello World”, but one which simply does nothing but return 0. This results in a binary weighing in at a surprisingly large 15,816 bytes — something which surely could be improved. There follows a set of clever compiler flags and bits of code manipulation to remove some debugging information, and strip out unnecessary stuff executed before void main().

At 13,632 bytes it’s still a little on the chunky side, so it’s time to examine what libraries it brings in. More compiler flags get it down to 8,704 bytes. Removing a code comment section and error handling with more flags takes it to 4,320 bytes. Then there’s code which dictates how memory is allocated, which brings it down to 400 bytes. That’s an impressive reduction!

Reading this as hardware people we maybe don’t have the elite knowledge of compiler flags it takes to manage something like this. But we’ve all at times had to reduce the size of a bit of software, so we’re sure some of the techniques used are going to be interesting to quite a few readers.

After all, even hardware people need to trim the fat at times.

LIPS Is An Open Source Sip-And-Puff Interface

Lots of us have– thanks to repetative stress injuries– developed mobility issues that we have to work around when using computers. Maybe it’s a trackball instead of a mouse, or a split keyboard, or mechanical keys with very specific force requirements– but those are small potatoes compared to people with such severe movement issues such as quadriplegia who need to fall back on things like a sip-and-puff device to control the computer with their mouths. Commercial options of course come with absurd price tags, but a DIY option is a different story. [DanielYordanov]’s L.I.P.S project can be built for only a couple percent of what the big boys want, and it’s fully-open source.

So you might think a sip-and-puff device is a two-bit interface, only slightly more advanced than the morse terminal we featured earlier. While Morse code might be an option, these devices also act as pointers, as the lips and chin can be used to point the mouthpiece. Thus there are a few sensors needed: a hall-effect joystick for pointing info, and one or more pressure sensors to detect the breathing interface for ‘clicks’. [Daniel] has single and dual-sensor versions, creating at minimum a four-button mouse. In reality this hardware can distinguish long and short pulses, or combinations of breath to run some nice macros. With operating-system features like an on-screen keyboard, L.I.P.S. can provide someone with digital freedom– and at a tiny fraction of the cost of a ‘real’ medical device.

Despite the DIY nature, for the end-user control and config is easy enough thanks to a webserial portal run on the CH552 that you can preview on the official website. Code, ki-cad and STL files are all on his GitHub repository. If you’re interested in the design process, we’ve embedded his video about that below.

Thanks to [Daniel] for the tip! Do you know of a hack to make life better for someone, disabled or otherwise? Send us a tip!

From one-handed typing to open-source prosthesis, this sort quality-of-life hack may be the best thing about our community. Continue reading “LIPS Is An Open Source Sip-And-Puff Interface”

A New Life For A Rare Console

One of the delights of our tips line is that from time to time it brings us retrocomputing hardware that, despite years of reporting, we were not aware existed. [Hitmanmcc] has just such a machine, an NEC PC Engine LT. It’s a PC engine in a laptop form factor, and like many of this super-rare console, it has succumbed to capacitor failure. We’re treated to the process of bringing it back to life.

Replacing capacitors was only part of the story for this repair, as the electrolyte had caused damage elsewhere on the board. In particular there is a small transformer that forms part of an inverter to generate an LCD bias voltage, and this had been destroyed. Fortunately the art of switching power conversion has advanced in the decades since the console was produced, and a small module was procured to do the same job.

The result of all this surgery is another rare console rescued from e-waste, and an opportunity for the rest of us to take a look too. The PC engine is a relative rarity here, but we’ve had a few hacks over the years. This converter for its American cousin is one.

Apparently what a fusion power plant should look like

Less Than 10 Years? Commonwealth Fusion Systems Applies To Plug Into Grid In 2030s

Whenever the topic of fusion power comes up, someone will say it’s only 10 years away from commercialization in an excited tone, and someone older or more cynical will point out that it’s been 10 years away since Eisenhower was president. So it’s with a certain-sized crystal of sodium chloride that we share the news here that the US-based Commonwealth Fusion Systems is applying to feed 400MWe into the grid there by the early 2030s.

The early 2030s is, notably, less than ten years from now.

Commonwealth Fusion Systems isn’t a bunch of nobodies out to suck up venture capital; they’re a talented group of researchers from MIT’s well-known plasma laboratory out to suck up lots of venture capital and hopefully build reactors along the way. So far, the second part is going better than the first: they’ve raised a couple billion dollars, which has let them make great strides in building their SPARC reactor– like crafting the big magnet we told you about in 2021. As that article describes, SPARC is the precursor to the later, larger ARC reactor they hope to hook to the grid in slightly under a decade. Alas, SPARC remains under construction as of this writing. ARC is evidently in the final planning stages, with a physical location determined and grid-tie applied for at the “Fall Line Fusion Power Station” in Virginia.

CFS’s reactors are of the Tokamak type that has been favoured at universities since the 1970s. From China to Europe’s ITER who are also planning to produce power before another decade passes— though not, notably, into a power grid. While promising, Tokamaks aren’t the only game in town, either– steampunk startup General Fusion started making plasma last year, though while if it works it has some big advantages, that one is probably the traditional “ten years away” still.

What do you think? Will fusion power be in the grid before humans make it back to the moon? Add the flying-car potential of eVTOL and we might finally get close to the future we were promised.

A RayCast FPS In COBOL

COBOL is not the first language anyone would ever think of when writing a First Person Shooter– after all , it’s the Common Business Oriented Language, not the Common Game Oriented Language. For Youtube-based hacker [icitry] though, that’s the point. The only way to determine if COBOL would be enough to write an FPS game was to do it.

Sure, you could rest on your laurels knowing that the language is Turing complete and therefore capable by definition, but what’s the fun in that? Now the pipeline for this game is as hacky as anything– COBOL doesn’t exactly have a robust graphics stack or a lot of libraries for pushing pixles, so he’s outputting each frame of the game as raw bitmap to STDOUT, and letting ffplay assemble the images. Control enters the same way, with the terminal set to raw input and the COBOL program reading STDIN.

As for what the images consist of, he’s going for a standard Wolfenstien-inspired raycasting shooter. [icitr] provides a decent explanation of the raycasting algorithm, along with why implementing in COBOL is a silly thing to try. That’s a theme here; he’s able to implement sprites and the logic to move and attack enemies, while constantly complaining about COBOL. If that wasn’t enough, he adds variable-height sectors to bring this much closer to a true DOOM clone. By the end, there’s a full game. It’s all up on GitHub on an Apache license.

While this video is not the most gentle introduction to COBOL, it does show you can hack the business-specific language to do whatever you’d like.

Building A Gifford-McMahon Cryocooler With 3D-Printed Parts

Although cryocoolers are capable of pretty impressive cooling, for many of them the underlying working principle is simple enough that you do not need any special skills or a big budget to make your own version. Take the Gifford-McMahon cryocooler for example, which works using nothing more than some kind of coolant gas and a piston in a cylinder that you can even 3D print, as demonstrated by [Hyperspace Pirate] in a recent video.

The lowest temperature reached across the two prototypes was only -84°C, but this was mostly due to some sub-optimal design choices, such as the use of regular air and a clear acrylic tube to get a good glimpse at the inner workings. The trickiest part of this type of cryocooler is probably that you need to move the piston containing the regenerator between both ends of the cylinder to get a cool and a hot side.

That particular problem was solved by using magnets to move the piston externally, which worked beautifully until the problem of using regular compressed air from the shop compressor caused massive ice formation that jammed up the piston. Obviously this was not an unexpected issue, and for the next step the coolant gas will be replaced by helium, as making that gas freeze up requires quite a bit more effort.

Continue reading “Building A Gifford-McMahon Cryocooler With 3D-Printed Parts”

Pi Pico Demos, Therefore It Is

A good demo, like [Linus Akesson]’s Sum Ergo Demonstrato, looks like magic to the average hacker. To normies who don’t know the limitations of the RP2350, they don’t see the big deal. To anyone who has spent any time with the chip, though, it’s a series of tricks you cannot help but be amazed by. Fortuanately for us, [Linus] isn’t actually a magician, because while a magician never reveals his tricks, [Linus] has an hour-long video explaining exactly how his demo was accomplished. We’ve embedded both the demo and the explanation below.

Even if you aren’t into YouTube, you should check out the demo video, and again– remember this is all on a Pi Pico with only the extra passives required for video-out. Then you can watch [Linus] explain how he did it, which is really best heard in his own words. There are a couple of bleeding-edge tricks on the RISC V core and peripherals that we would hate to misrepresent– especially the clever hack with the interpolator that he uses for 3D acceleration.

If this sounds a bit familiar, it’s because we were equally impressed by his Kaleidoscopico demo last year. From demos like this to 3D engines on the ESP32, its amazing what you can do on modern micros if you’re willing to hit the limits of the hardware.

Thanks to [Stephen Walters] for the tip!

Continue reading “Pi Pico Demos, Therefore It Is”