246 karma · joined October 1, 2023
If you have a CGA card, you're stuck with the code page of the ROM your card came with, which in most cases was code page 437, although a few variants were made.
EGA/VGA had software fonts so other code pages could be loaded.
The combination of these two decisions means its inadvisable to type while your floppy drive is transferring data
I was trying to Run Back To The Future, so I figured I'd call my emulator either Marty or McFly.
Unfortunately I found out about the FM Towns later, so I renamed it from Marty to MartyPC so you could google "MartyPC Emulator" properly.
I have to make all new pixel-art for a Tandy 1000 keyboard and PCjr keyboard. Fun
But honestly I wanted to learn the Rust programming language and I thought writing an emulator was a good a project to learn as any.
I have been working on a emulator in C++ in collaboration with a friend, it is also cycle-accurate. It is called XTCE-Blue.
It is insane because IBM wanted a wireless keyboard. If you're not familiar with the PCjr keyboard, it has two IR transmitters (they are electrically the same, just having two gives you a better transmission path). The PCjr system has an IR receiver.
Now, a normal keyboard cable is a standard two-wire serial protocol with clock and data. Being wireless, you have no clock, so you have to synchronize clocks, or have clock recovery built into the protocol. The PCjr does the former, using the 8253 timer chip.
The keyboard has no way of knowing if the system has received a keystroke, so the system must receive every keystroke - they can't be stored in a fifo, they can't be resent if the CPU missed it.
This rules out the possibility of using system interrupts - so when you type a key on the CPU and the IR receiver gets the start bit - the NMI line is raised, the 8253 is programmed to time the clock bursts from the IR receiver, and the CPU reads out every bit of the scancode.
In software.
By mentioning Rust people have been able to more easily find MartyPC as an example of how (or how not to) write an emulator in Rust.
Perhaps the tag as outlived its usefulness, especially if people find it pompous or something. I'm not trying to be Rust cultist, I swear.
I've uploaded all the binaries to GitHub if you're struggling with copy & paste. There's also a new example in Braille.
I think blogpspot unfortunately mucks with the emoji.
It's less to do with browser versions and more to do with websites. Mastodon and unfortunately blogspot seem to mess up the emoji. Fortunately you can click on the disassembly links that go to my disassembler and copy them from there.
That language can then be translated into Verilog, and has been.
Other instructions like PUSHA and POPA are implemented as loops that iterate by incrementing the fields corresponding to registers - and we know in what order they operate.
Bit by bit, relation by relation, you can puzzle out the format of the microcode. Of course, this is glossing over the enormous added complexity of protected-mode operations. This was a herculean effort by reenigne, and I don't think it is hyperbole to call it one of the more impressive human achievements I have witnessed in my lifetime.
Documentation from the NEC vs Intel lawsuit ended up documenting the microcode word format for both the 8088 and NEC V20 CPUs, but unfortunately, we were on our own for the 386. But we could take educated guesses - working off the 8088 field format, what additional microcode fields would a 386 add? What fields would expand and how many bits would they need?
We used a lot of python scripts to decode the microcode array into 37-pixel wide, very long bitmaps, in different permutations, to see if any vertical patterns emerged that would hint to us the boundaries of microcode word fields. And some did emerge!
Then you have to classify them as 0's or 1's. Each is visually distinct, a 1 being encoded by the presence of a transistor and a gap in the polysilicon. We didn't have to guess which is which is by the nature of Intel microcode we could assume 0's were much more frequent, so a transistor meant a 1.
There are some automatic tools designed to perform this work via color thresholding, but they didn't work very well here because some of the mosaic was blurry, and a lot of dust had crept in which created false 1 bits.
Instead, we trained a convolutional neural network to classify the extracted bit regions into 0's and 1's. This was overlaid back onto the original mosaic as white or black squares at 50% opacity.
Then we spent several long, tedious days just checking the results for errors. Finally we had the raw 2d array of bits - the next step is to extract the microcode words from the bit array.
The CGA is dumb and re-fetches memory eight times per character row, so what you could do is tie in to HSYNC, so you could basically synthesize three new address lines from the row counter. That would give you a virtual 128K of video memory - a single character cell could then have 8 different sets of foreground and background colors. You could make some pretty impressive composite art with that!
I will likely do this for fun at some point, because I want to see "Never Gonna Give You Up" in the classic magenta & cyan palette, but this is not going to be something that anyone else will likely ever do as the RAM is soldered in - and nobody but Omega-level nerds are going to de-solder eight chips for a meme.
Inspired is a strong word. I didn't invent the concept of an accurate emulator, although I'm certainly a fan of his approach.
Run Area 5150 at 60fps on your phone!
Almost every feature from the desktop version is present if practical:
- View the realtime state of nearly every component of the system. - View live disassembly of CPU instructions. - Edit registers and memory. - Slow down or speed up the system. - Peek on how games draw their graphics with the Memory Visualizer.
But the new wrinkle here is support for grayscale, meaning photos or other grayscale artwork can now be put on a disk.
We can even put the art inside of valid sectors to keep the disk appearing completely normal to casual observation from a host computer.
I do have a bit-mode, and if you rendered at high enough resolution you could do it, maybe something like 32k x 32k. But this is a very inefficient way to store a disk image. :)
Xelok was quite devious on the Apple II, implementing "fat tracks" that could not be produced with a conventional disk drive. However the PC doesn't allow such tricks, so Xelok appears a bit different on the PC platform.
We take a look at two titles that use it, Sargon III and The Ancient Art of War.
We also take note of a rather amusing bypass for this protection!
Also included is an interview with Quaid Software founder, Robert McQuaid. Vault sued Quaid Software for producing CopyWrite, a utility that could copy PROLOK protected diskettes.