https://nanochess.org/emulator.html
After winning the IOCCC for the first time, I had the idea of writing an emulator of the 8080 processor in 2000 characters of C, after patterning experimentally the more than 200 instructions and doing measures of byte count, I realized that it was possible and I made it. Then I added CP/M support as a extra feature. I was completely astonished when I won Best of Show of 19th IOCCC :).
[...] This emulator was developed eighteen years ago when the computers had 32-bit processors and it used a hole in the C language syntax where you could pass a pointer on an integer. In fact, this is the IOCCC objective: make C compilers to do things these shouldn't be supposed to do.
However, the C compilers for 64-bit processors don't allow it any more as pointers are 64-bit and the int types are 32-bit, so compilers stop with an error (especially in macOS because clang).
Related Stories
The Eerie Linux blog (also in Gemini) has a longer post about how to actually get started using CP/M, the Control Program for Microcomputers.
This article is just what the headline promises: an introduction to the CP/M operating system. No previous knowledge of 1970s and early ’80s operating systems is required. However, some familiarity with Linux or a BSD-style operating system is assumed, as the setup process suggested here involves using a package manager and command-line tools. But why explore CP/M in the 2020s? There are (at least) two good reasons: 1) historical education 2) gaining a better understanding of how computers actually work.
Last year I wrote two articles about CP/M after having taken a first look at it:
A journey into the 8-Bit microcomputing past: Exploring the CP/M operating system – part 1
A journey into the 8-Bit microcomputing past: Exploring the CP/M operating system – part 2These were written with a focus on the first reason; I had (partially) read the manuals and tried out a few commands in an emulator (as well as done a little bit of research). I wrote an outsider’s look at CP/M and covered the various versions that were released and some of their notable features.
This article is different. It’s for readers who want to get started with CP/M themselves. Expect a practical introduction to get familiar enough with the platform to be able to explore a wealth of historic software, often enough ground-breaking and influential.
CP/M was of great importance back during the 8-bit microcomputer era. It was ubiquitous in small businesses and government offices for a while. It ran on the Zilog Z80 and Intel 8080 hardware architectures. MicroPro International's WordStar and Ashton Tate's dBase II were among the killer apps of the era. Networking was by sneakernet or, maybe, if your cable smithing skills were up to it, by null modem.
Previously:
(2024) Complete WordStar 7.0 Archive
(2024) End of an Era: End-Of-Life for the Venerable Zilog Z80
(2024) Intel 8080 Emulator. 19th IOCCC. Best of Show.
(2022) Z80—The 1970s Microprocessor Still Alive
(2016) Portion of Gary Kildall's Memoir Made Public
(Score: 5, Interesting) by Rosco P. Coltrane on Saturday March 23 2024, @11:04AM (6 children)
That 2K program took me MONTHS and incredible amounts of work to shave one byte here, one byte there, abuse the C compiler while still passing lint... I was really proud when I finally saw my name on ioccc.org.
And you may think it's pointless - well, maybe it is nowadays - but it's in my resume, and that's all the street creds I ever needed to convince propective employers that I'm a C specialist. Even better: if the interviewer knew what the IOCCC was, it was a very good indication that this was an employer worth working for.
(Score: 2) by SomeGuy on Saturday March 23 2024, @11:52AM (2 children)
It's great you can actually put something like that on your resume. A number of years back I tried to do some projects on my own, hoping to get something out of it I could put on my resume. But it all failed miserably. Employers around here only want someone who can kiss ass and suck dick. Anything technical just makes their eyes glaze over.
I hate this planet.
(Score: 3, Insightful) by pvanhoof on Saturday March 23 2024, @11:57AM (1 child)
It still has fish in its oceans though
(Score: 2) by Freeman on Monday March 25 2024, @04:49PM
That's why the dolphins are here still. https://en.wikipedia.org/wiki/So_Long%2C_and_Thanks_for_All_the_Fish [wikipedia.org]
Joshua 1:9 "Be strong and of a good courage; be not afraid, neither be thou dismayed: for the Lord thy God is with thee"
(Score: 2) by Snotnose on Saturday March 23 2024, @01:10PM (1 child)
Back in the day I tried to disassemble the ROM in my TRS-80. The Z80 in the TRS-80 had multibyte jump statements. The BASIC interpreter would jump to the middle of one of those multibyte instructions and interpret the "address" as, say, ADD A, B.
Once I saw that more than once and realized it wasn't just a fluke I gained a lot of respect for the programming abilities of Mr Gates and Mr Allen.
Parents in Africa: "Finish your food kids, there are starving children in America"
(Score: 3, Informative) by owl on Saturday March 23 2024, @06:11PM
This was not a Bill G or Paul A innovation. This was standard practice back in the days of writing things like interpreters in assembly while also meeting strict space limits (you had 4k of ROM and not a byte more).
Any assembly programmer who did assembly for a living from the same time frame should have been more than capable of creating these sorts of tricks.
(Score: 2) by Tork on Saturday March 23 2024, @04:13PM
🏳️🌈 Proud Ally 🏳️🌈 - Give us ribbiti or make us croak! 🐸
(Score: 2) by hendrikboom on Saturday March 23 2024, @01:53PM (1 child)
You mean something like &4 ?
(Score: 3, Informative) by tekk on Saturday March 23 2024, @03:19PM
No, you can still do that.
It used to be that on 32 bit x86 (usually) the size of a pointer was the same as the size of an int. What this meant was that you could put a pointer into a slot of type int, be it a parameter or a structure member, a variable, etc. I wanna say that this trick was used sometimes for things like tagged pointers (imagine you have a pointer but you also have a garbage collector. You just declare that the top bit of your pointer is always 0 and mask it off while using it. Now when your garbage collector is running, you can use the top bit to mark that the pointer is in use and still valid without "wasting" any memory.)