every piece of code i want to share is on that git thingie.
some cool stuff:
- kyacopycat, a Canon Cat emulator;
- nenemark2, a NES/Famicom compatible computer;
- lumasum, a tool for sorting images by luminance;
- 98tombr, a tool for reading PC-98 drives on other systems;
- keyrisame, a keyboard/joystick adapter for PC-98;
- saccalc, a simple RPN calulator;
contact
- fediverse: @evv42@donotsta.re (likely to respond quickly over there)
- fax: you lost the game
- irc: ask
Typical bradboard computer designs include two types of memory arrays for the CPU to read that have different properties: a read-only memory (ROM) containing the program and a random-access memory (RAM) containing the program variables.
The ROM (typically EPROM, EEPROM or NOR Flash) isn't usually writiable or re-writable, even though some types are to some extent. This is partly because the writing signaling of those isn't suitable for temporary storage and the number of write cycles those can withstand is limited.
The RAM (typically SRAM (*1) ) doesn't allow for keeping the data when no power is applied to it, which is a problem when you want to remove the chip for programming.
There's nothing preventing applying a separate isolated power source directly to the SRAM to allow for somewhat long-term storage, and thus significantly simplify the wiring and cost of a breadboard computer.
(*1): Unless using a Z80, which can interface easily to a pseudo-static RAM (XRAM/PSRAM).
alternatives
commercial modules
Some memory manufacturers (Dallas, ST to name the big ones) made and are still making memory modules that consist of a low-power SRAM chip, protection circuitry and a lithium button cell. Those modules are unfortunately quite expensive new and some sellers put a shipping restriction on these due to the lithium cell.
Also, those modules protection circuitry can have a significant start-up time when powered-on which should be taken into account if using them as main memory.
It it also noteworthy that some of these modules integrate a real-time clock (RTC) for timekeeping applications.
FRAM
Ferroelectric RAM (FRAM) is a type of memory that keeps its contents without the presence of power and has most of the properties of SRAM. It is roughly an order of magnitude more expensive than the equivalent SRAM new.
A constraint of these is that they don't support subsequent reads without reasserting the Chip Enable (/CE) signal, that is, you can't leave that singal low on the breadboard computer.
how-to
The minimal setup consists of an SRAM chip, two diodes, a power source (for example, a CR2032 in a holder) and a high value resistor (typ. 100Kohms).
A way of wiring it is to solder the negative lead of the power source to the VSS of the SRAM, the positive lead of the power source to the VCC of the SRAM through a diode.
Solder the resistor between a Chip Enable (/CE or CE) signal and either VCC or VSS so that the chip stays unasserted.
Finally, on the breadboard, add a diode to isolate the 5V rail from the battery backed SRAM.
Here's some notes on caveats you may encounter:
low-power SRAM
You want to be sure that the SRAM chip can be safely maintained at a low voltage/amperage if using a power source like a lithium cell.
A clear indicatior of that is a -L or -LL marking on the chip, though other CMOS SRAM can also have suitable characteristics.
In any case, it is advised to check the datasheet of the particular used chip.
Old NMOS/PMOS SRAM (most 2114 chips, early 16Kx8 SRAM) aren't very suitable for that.
programming SRAM
The TL866 series of programmers supports the following commercial modules from Dallas which algorithms can be used to program battery-backed SRAM:
- DS1220, for programming 16Kx8 SRAM (typically 6116)
- DS1230AB, for programming 64Kx8 or 256Kx8 SRAM (typically 6164, 6264, 62256) (*2)
(*2): There is a DS1225 module which would be suitable for 6164/6264 except that pin 26 isn't wired on those, and the TL866 doesn't assert that pin as a result. See the "funny scripts" section for examples on how to handle those using the DS1230 algorithms.
protecc the SRAM contents
You need a suitable circuitry that'll ensure that the breadboard computer won't do spurious writes at power-on and power-down.
This can be accomplished, for example, with voltage watchdog chips such as the TL7705, MCP100 or a simple microcontroller with brown-out detection.
the easy option: 6x64 SRAM
The 6164/6264 and compatible SRAM are well-suited for that approach due to the presence of an active-high Chip Select (CS2) signal.
On those, this signal can be wired directly to the /RESET signal to ensure protection of the stored data.
SRAM without positive logic enable
On SRAM without a positive logic enable, you can combine either the Write Enable (/WE) or Chip Enable (/CE) signal with the reset signal using an appropriate logic chip. Make sure that the logic chip is able to assert high the signal for long enough to actually protect the SRAM's data. A pull-up resistor can help with that.
data retention
You can expect data retention figures of more than 20 years with a -L rated 6164/6264 and a 220mAh CR2032.
funny scripts
Here is example shell scripts that can be used to program a 6164/6264 SRAM with the DS1230AB algorithm of the TL866:
Disclaimer 0: This assumes you're familiar with the NEC PC-98 family of computers. For information on this, I would recommand you to read this post on Wyatt's Blog.
Disclaimer 1: This is only useful if you don't have a flux writer (like a greaseweasle for example).
Disclaimer 2: You can also write a floppy by using your PC-98 itself, if you can easily transfer data to it.
crash course
The designers of the PC-9801 architecture (that is, the people at NEC) initially chose a simple approach for dealing with Sony's then new 3.5 inch
(90 millimeters) diskette format: they didn't.
That is, in the PC-98 world, a 3.5 inch drive can behave the same way as a 5.25 inch one. This had the main consequence of most games and software being distributed on what is commonly called the "1.2 MB format" (in reality, 1232 KiB).
This is different from the one used in the IBM PC world, which is exactly 1200 KiB (more on that later).
Since the interfacing was initially identical, the other consequence from this is that the spindle motor of those early 3.5 inch PC-98 drives rotated at a speed of 360 RPM, to match the speed of the 5.25 inch drive.
When the people at NEC later decided on adding support for the concurrent DOS/V format (which rotates at a speed of 300 RPM), they used a way to allow the drives to change speed on the fly to allow both formats to be read (it is unclear if this originated from NEC, as others Japanese computers of the era used the same approach).
3-mode floppy drives
The industry standard way of changing the speed of the spindle motor of a 3.5 inch floppy drive is by using pin 2 on the 34-pin interface (this pin is usually called "density").
In this regard, most floppy drives are not created equal, as only a fraction of those can actually change the rotation speed of the spindle motor. Here is an exaustive list of drives (made by testing units that I have) with the various states of support for that feature:
Full support without any modifications:
- NEC FD1231T
- NEC FD1231M
- Mitsumi D353M3D-5000 (probably other variants)
- Teac FD-235HG (A103-U5 variant, probably others)
Support with hardware modifications on some exemplaries:
- Sony MPF920 (put solder on pad marked SH1 on the PCB)
- Alps DF354 (put solder on pad marked either MS2 or SW2 on the PCB)
Unsupported (may be possible with extensive modifications:
- Panasonic JU-257A606P
- Newtronics (Mitsumi) D359T7 (this one is hell to disassemble, so i didin't)
aside: 3-mode IBM compatible motherboards ?
A lot of people who messed with the BIOS setup of their computer in the 2000s will remember an option that was named "3-mode floppy support" in it.
Well, this option was meant for allowing Japanese users of Windows to have a way of reading and writing (but not formatting) their PC-98 floppies in the era when both types of machines were common.
The way it worked was by a custom floppy drive interface driver (some were supplied in the japanese releases of windows, some others were pre-installed by the OEM) that changes the way the operating system talks to the Super I/O chip on the motherboard.
Since it's very limited in its functionality and it's very hard to setup properly (tried on different motherboards, it does not want to work), I decided against using that, and preferred another method.
an imperfect but easy way of writing disks
"if you force 360RPM via hardware, couldn't you make it treat the drive like a 5.25" drive and have it work?"
This idea from Wyatt was the missing piece in the puzzle to solve this (very specific) problem.
The ingredients you will need for this recipe are:
- A 3-mode compatible 3.5 inch floppy drive
- A IBM compatible machine with a floppy interface
- A Windows 2000 or later installation that works on this machine
- Some images in the D88 format (if not, you can convert them with the tools here)
- The SAMdisk utility and the fdrawcmd.sys floppy driver
hardware preparation
Short pin 2 of your floppy drive to ground. Using a soldered wire is preferred, but you can also use a jumper (or switch) and extend the others floppy pins by soldering a male header with a female one like this:
Before doing modifications, double-check that the ground point you're using is actually connected to ground. Some drives for example does not connect pin 1 to ground, which makes the jumper method useless.
software usage
In the BIOS setup of your computer, modify the drive type of the one you installed to "5.25 inch, 1.2MB".
Install the fdrawcmd.sys driver using the instructions provided on the website, and copy the SAMDisk executable to a known location.
Then, you can test if your drive modification was sucessful by using the following command (with a floppy in the drive):
SAMdisk rpm a: (or b: if the drive is the second one)
If everything worked fine, the software should report a speed of approximatively 360RPM.
To write a disk, use the following command:
SAMdisk [disk_image.d88] a: (or b: if the drive is the second one)
You can also image a disk with the following command:
SAMdisk a: [disk_image.d88] (or b: if the drive is the second one)
See the documentation on the website for additional options.
additional thoughts
Since the fdrawcmd.sys part of this software is open-source, it should be possible to write a piece of software that would handle the many formats that the PC-98 floppy images uses.
Here are some (most) of the books that I've read, ordered by reading date.
Electronics books and mangas are excluded from the list, I have too many of them to list and I don't remember when I first read them.
I've written the English titles when available.
childhood:
- Microsoft Windows 95, 1998 New Edition, Warren Bates
- Building a PC for Dummies, Mark L. Chambers
- UNIX for Dummies, 4th edition, John R. Levine, Margaret Levine Young
- Linux for Dummies, 4th edition, Dee-Ann LeBlanc
- MS-DOS 5 utile, Daniel Rougé
adulthood:
- The Lord of the Rings, J.R.R. Tolkien (vol. 1 only)
- Introduction à Ada, Pierre Le Beux, Second Edition
- Sword Art Online, Reki Kawahara (vol. 5 and 6 only)
- The C Programming Language, Brian Kernighan, Dennis Ritchie
- Haruhi Suzumiya, Nagaru Tanigawa (12/12 vol.)
- Curiosities of Lotus Asia, Jun'ya Ōta "ZUN"
- Shakugan No Shana, Yashichiro Takahashi (1/22 vol.)
- Kino's Journey, Keiichi Sigsawa (16/23 vol.)
- Higehiro, Shimesaba (2/5 vol.)
currently on the reading stack:
- Structure and Interpretation of Computer Programs, Second Edition, Harold Abelson, Gerald Jay Sussman, Julie Sussman
- The Apothecary Diaries vol. 1, Natsu Hyūga
Some notes:
All of my computer science books came from thrift stores.
Availability of light novels in a language other that Japanese can be abysmal. Kino and Shana only have the firsts volumes officialy translated in English, have long been out of print, and will probably ever be.
I had this really dumb idea of creating a webpage that would be contained in only one file.
Here are some random thoughts and obstacles I ran through while doing this:
This will absolutely backfire one day.
There is no menu to design.
Images. They are encoded in base64, and I had to make compromises on quality to keep the file sizes small and thus the html file somewhat readable:
-Mostly JPEGs in low quality (favicon for example is so small PNG is more efficient)
-Monochrome images
-Smallest resolution acceptable
Here is a 4KB JPEG example.
One compromise I didn't make was to use arhitmetic-coded JPEGs. stb-image.h and old browsers hates them, and the size loss wasn't that interesting.
As a side-effect, this webpage lacks colour. Except links.