A DR-DOS console showing the IDLE command

Missing DR-DOS Power Management Source Code Found In Patent

Modern processors come with all kinds of power management features, which you don’t typically notice as a user until you start a heavy program and hear the CPU fan spin up. Back in the early 1990s however, power management was largely unheard of, meaning that a CPU with nothing to do would run through an idle loop that dissipated about as much power as a real computing task. [Michal Necasek] noticed this while experimenting with DR-DOS 6.0 in a virtual machine – his laptop fan would start running on full blast whenever he opened the VM. His search for a solution to this annoyance led him down a fascinating journey into the intricacies of DOS power management.

As it turned out, DR-DOS 6.0 does have functionality built in for putting the CPU in power saving mode when it’s idle. This feature is not complete, however: Digital Research required each computer manufacturer to develop an IDLE driver customized to their specific hardware platform in order to enable power management. Sadly, no manufacturer ever bothered to do so, leaving [Michal] with no option other than writing a driver himself. While there was some documentation available, it didn’t include any example code or sufficient detail to write a driver from scratch.

A snippet of x86 assembly code found in a patentWhat it did include was a reference to U.S. Patent No. 5,355,501. Normally this sort of information is of interest only to those planning to sell a competing system, but this specific patent happens to include dozens of pages of well-documented but poorly-scanned x86 assembly code, including source code for a basic IDLE86.SYS driver. As [Michal] wasn’t looking forward to chasing bugs caused by OCR errors, he simply copied the source code by hand, then ran it through an assembler. The end result was a working IDLE driver, which is now available for download from his website.

[Michal]’s blog post also includes lots of details on early power saving implementations, including all the DOS interrupt calls involved in the process. Patents might seem boring in contrast, but they sometimes contain surprising amounts of usable information. You might find enough details to reverse-engineer a wireless protocol, or even to help track down an obscure instrument’s original designer.

Assembly Language For Real

We all probably know that for ultimate control and maximum performance, you need assembly language. No matter how good your compiler is, you’ll almost always be able to do better by using your human smarts to map your problem onto a computer’s architecture. Programming in assembly for PCs though is a little tricky. A lot of information about PC assembly language dates back from when assembly was more common, but it also covers old modes that, while still available, aren’t the best answer for the latest processors. [Gpfault] has launched a series on 64-bit x86 assembly that tries to remedy that, especially if you are working under Windows.

So far there are three entries. The first covers setting up your toolchain and creating a simple program that does almost nothing. But it is a start.

Continue reading “Assembly Language For Real”

512 Bytes Ought To Be Enough For Dinosaurs

It’s said that slow internet is worse than no internet at all, which is mainly a matter of continuously crushing all hope and sanity vs. finding peace in accepting a fate out of your control. Plus, you can easily pass the time of being catapulted back to the prehistoric ages by navigating a jumpy little creature from that same age through a field of cacti — at least if you’re using Chrome or Chromium. But neither a browser nor actually an operating system are really necessary for that, as [franeklubi] shows with a boot sector implementation of the same game.

Sure, the graphics aren’t quite on par, but compared to the original’s 3000+ lines of JavaScript, [franeklubi] managed to implement it in a few hundred lines of assembly, and was of course constrained by the 512 bytes of the boot sector itself (well, 510 plus the signature). This constraint causes a few limitations, like a slight lack of randomness in the obstacle arrangements, and a constant running speed, but it also makes it the perfect playground and starting point to delve into the world of nifty knacks and hacks, trying to squeeze every last byte.

If you want to give it a try for yourself, all you need is NASM and QEMU — and while you’re at it, why not have some Tetris along the way? We could also see this nicely combined with the real-world jumping version from a few weeks back, and turn it into a standalone arcade game. Bounce Crouch Revolution anyone?

CD Image Via Twitter: A Handcrafted Game Disc

Humans can turn anything into a competition. Someone always wants to be faster or drive a ball farther. Technical pursuits are no different, which is why a lot of people overclock or play regular expression golf. [Alok Menghrajani] sets himself some odd challenges. A few years ago, he hand-built a bootable floppy image that had a simple game onboard and managed to fit it in a Twitter message. Twitter has increased their number of characters, so — you guessed it — this time he’s back with a CDROM image.

His tweet is a command line that starts with perl. The text is base64-encoded binary and if you run the Tweet from a shell — which is an odd thing to do with a Tweet, we grant you, you’ll be rewarded with a file called cd.iso. You could burn that to a CDROM, but it is more likely you’ll just mount in a virtual machine and boot that. [Alok] says it does work in QEMU, VirtualBox, and — yes — even a real CD.

Continue reading “CD Image Via Twitter: A Handcrafted Game Disc”