How to write Emax II OS disks with Linux
2004-01-31 by poeml@...
Hi,
I looked at the EMX source code, and figured out that writing these OS
floppies is pretty straightforward with the Linux OS. It works like
this:
- raw format an 800K floppy:
fdformat /dev/fd0u800
- given you have the emaxos.emx file available, as it can be found in
the files section of this group, it can be written with the dd(1)
tool. Since the layout of parts of the OS is a bit complicated, I used
the following shell script:
---snip------------>
#!/bin/bash
osfile=emaxos.emx
drive=/dev/fd0u800
set -x
# OS is layed out on disk in the following blocks:
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# (total blocks on disk: 1600, numbered 0 to 1599)
#
# OS 0 to 367 n= 368
# Bank 368 to 423 n= 56
# OS 424 to 439 n= 16
# Samples 440 to 1463 n=1024
# OS 1464 to 1599 n= 136
#
function WriteOS () {
local out=$1
# here, we read from stdin, but divide the stream in three parts, as in:
# (dd of=bla count=1; dd of=bla count=1 seek=1; dd of=bla seek=2) < emaxos.emx
dd bs=512 count=368 | dd of=$out bs=512
dd bs=512 count=16 | dd of=$out bs=512 seek=424
dd bs=512 count=136 | dd of=$out bs=512 seek=1464
}
function ReadOS () {
local in=$1
dd if=$in bs=512 count=368
dd if=$in bs=512 count=16 skip=424
dd if=$in bs=512 count=136 skip=1464
}
md5sum $osfile
WriteOS $drive < $osfile
rm -f $osfile.read
ReadOS $drive > $osfile.read # verify it...
md5sum $osfile.read
exit 0
<---snap----------
The script is in a bit rough form but I thought I'd already share it
nevertheless.
Credits go to Mike Prudence, author of EMX, of which the source code
enlightened me.
So far I have only formatted OS disks, I haven't looked into copying
banks, but that will be the next thing.
Peter
PS. It would be possible to make a Mini-Linux one-floppy-distribution
that contains the needed tools (mostly fdformat and dd), so one could
boot from that floppy -- that'd be easier to get hold of that painful
DOS...
[Non-text portions of this message have been removed]