Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Harold Innovation Technologies - HMD2043 and HMU1440 spec sheets

View HIT_HMD2043.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
__ __
|| ||
||==|| I T
_|| ||_
Harold Innovation Technologies
"If it ain't a HIT, it's a piece of..."
DCPU-16 Hardware Info:
Name: HMD2043 - Harold Media Drive
ID: 0x74fa4cae, version: 0x07c2
Manufacturer: 0x21544948 (HAROLD_IT)
Document version: 1.1
Change history:
1.1: Added command for setting interrupt message. Fixed manufacturer id
which was erroneously word-swapped.
1.0: Initial release.
The HMD2043 is the latest effort on the part of Harold Innovation
Technologies to futurise the computing landscape of tomorrow; today!
It is a high-quality disk drive made from the finest materials known to
man. It supports a vast panopoly of disk formats:
* HMU1440 - 1.44 MB 3.5" Harold Media Unit.
Because of its amazing all-American construction, it will also support disks
manufactured by other, inferior "technology" companies; YOU KNOW WHO YOU
ARE! The drive incorporates unique "quality sensing" technology to identify
low-quality disks, allowing the system to warn the user. But, I'm a big
enough man to stoop to your level and...
Waitaminute; I've just had an idea for a motorised stooping machine;
Angela, get the engineers in here and turn this damn recorde
-- Harold Lam, Founder and Chief Innovationist.
Interrupt behaviour:
The HMD2043 supports a number of HWI commands based on the value of the A
If a supported disk is present in the drive, this sets the B
register to 1. Otherwise, it sets the B register to 0.
Media should be tested with the 0xFFFF command before use.
Reads out the physical properties of the media. They are placed
into registers as follows:
B = Number of words per sector.
C = Number of sectors.
X = 1 if media is write-locked, 0 otherwise.
Returns the internal device flags in the B register. The meaning
of this field is defined in the UPDATE_DEVICE_FLAGS command.
Sets the internal device flags to the value of the B register. The
available bit flags are, by bit number:
0: NON_BLOCKING - if set, all slow operations will be performed in
"non-blocking" mode; that is, the hardware command will return
control to the DCPU immediately and an interrupt will be issued
upon completion.
Note that other commands issued during a non-blocking operation
will silently fail.
Until the interrupt is raised, the device will NOT consider the
non-blocking operation "complete".
Before issuing a non-blocking command, be sure to set an
appropriate interrupt message with SET_INTERRUPT_MESSAGE.
1: MEDIA_STATUS_INTERRUPT - if set, the device will raise an
interrupt when the media status changes: new media is inserted
or current media ejected.
Before enabling media status interrupts, be sure to set an
appropriate interrupt message with SET_INTERRUPT_MESSAGE.
The default value is all bits set to zero.
The device will indicate the type of interrupt that it last raised
by placing one of the following values into the B register:
0x0000: NONE - No interrupts have been raised yet.
0x0001: MEDIA_STATUS - Media status changed.
0x0002: READ_COMPLETE - Read operation completed.
0x0003: WRITE_COMPLETE - Write operation completed.
The value of the A register will be changed to the error status of
the event in question, not the error status of the
QUERY_INTERRUPT_TYPE command itself.
Specifies the message the device should use for software interrupts.
Takes one parameter:
B = Interrupt number to use when interrupting the DCPU.
If the device raises an interrupt before the message is set, it will
default to using 0xFFFF.
Reads a contiguous range of sectors into memory. The parameters
B = Initial sector to read.
C = Number of sectors to read.
X = Start of in-memory buffer to read into.
The length of time this command will take depends on the state of
the drive and the physical parameters of the media in use.
This operation may be performed in non-blocking mode.
Writes a contiguous range of sectors to disk. The parameters are:
B = Initial sector to write.
C = Number of sectors to write.
X = Start of in-memory buffer to read from.
The length of time this command will take depends on the state of
the drive and the physical parameters of the media in use.
This operation may be performed in non-blocking mode.
Determines the quality of the media inserted into the drive. It
places this value into the B register. It has the following values:
0x7FFF: Authentic HIT media.
0xFFFF: Media from other companies.
All commands replace the contents of the A register with a flag indicating
whether the command succeeded or failed. The following result codes are
0x0000: ERROR_NONE - The operation either completed or (for non-blocking
operations) begun successfully.
0x0001: ERROR_NO_MEDIA - Operation requires media to be present. In long
operations, this can occur if the media is ejected during the
0x0002: ERROR_INVALID_SECTOR - Attempted to read or write to an invalid
sector number.
0x0003: ERROR_PENDING - Attempted to perform a non-blocking operation
whilst a conflicting operation was already in progress: the most
recent operation has been aborted.
Full-stroke: 200 ms
Spindle speed: 300 RPM, 5 Hz using Constant Angular Velocity
Maximum data transfer speed: 768 kbit/s, 48 kw/s
Head position on media insertion: innermost track
Head mode: full duplex [1]
Time to seek to sector =
floor( abs(target sector - current sector)
/ (disk sectors per track) )
* full stroke time / (disk tracks - 1)
Time to read/write a sector =
1 / (spindle speed * disk sectors per track)
Example times:
1.44 MB 3.5" Disk:
Time to seek to adjacent track = 2.5 ms
Time to read/write a sector = 11 ms
Time to read/write entire disk = 16 s
[1] The head is capable of reading/writing both sides of the disc at the
same time.
__ __
|| ||
||==|| I T
_|| ||_
Harold Innovation Technologies
"If it ain't a HIT, it's a piece of..."
Media Info:
Name: HMU1440 - 1.44 MB 3.5" Harold Media Unit
Document version: 1.1
The HMU1440 is the latest effort on the part of Harold Innovation
Technologies to futurise the computing landscape of tomorrow; today!
It is a high-density, double-sided magnetic storage device. That's right,
it uses MAGNETS to store DATA. Isn't technology amazing?
It packs a whopping 1,440 512-word sectors into 80 beautifully delineated
tracks for a total stuff-icity of 1,474,560 octets.
It also comes complete with a precision Write Lock slide-switch to protect
your many and varied files and a super high-quality Label, pre-lined for
your convenience and compatible with most writing implements on the market
today! It is also available in a wide variety of colors including Blue and
White, but NOT Red.
This disc is of such high quality of construction and design that it can
only be reliably WRITTEN to by Harold Innovation Technologies' HMD2043
Harold Media Drive. However, this disc is of such high quality of
construction and design that it can be reliably READ from by even the most
basic and technologically backward of disk drives.
So enjoy, and may this happy little disk provide you years of faithful
service before inexplicably failing, but not so fast that you cannot buy a
new disk and save almost all of your data.
-- Harold Lam, Founder and Chief Innovationist.
Data surfaces: 2
Tracks: 80
Sectors per track: 18
Total sectors: 1440
Note: sectors are spread across both data surfaces; specifically, even bits
of a sector are stored on the "top" data surface, odd bits on the "bottom"
data surface. This doubles effective read/write speed.
Author's Note:
A. I wanted a floppy spec.
B. I wanted a little bit of Cave Johnson.
I tried to write Harold Lam as an antagonistic, blindly patriotic man who
is none the less a savvy businessman who has managed to build up an IT
empire despite his at-times dogmatic approach.
Plus, I figured it could be a source of fun in the game's backstory to have
at least two, at-odds technology companies (all gone and turned to dust by
now) taking pot shots at one another through the eloquent medium of spec
sheets. Or at least *one* technology company at-odds with and taking pot-
shots at *everyone else*.
In response to this, the engineers do their best to subtly mock him. Like
the result of command 0xFFFF: they don't specify whether it's signed or
not. The command is only there at all because Lam decreed it thus.
Also, originally I mistakenly thought that Nya Elektriska was Russian. I
have no excuses for why; that's just what popped into my head when I first
saw the name. I'd like to apologise to everyone for the mistake. I've
since revised Lam's introduction to the HMD2043.
As for implementation, I've tried to include enough explicit timing
information to make working out how many cycles to "block" for relatively
easy. The only possibly tricky bit is the non-blocking mode. For that to
be efficiently implemented, the emulator will need some kind of event queue
for keeping track of upcoming events.
Although it would be more realistic to have the data trickle into memory
during a non-blocking operation, I think we can probably get away with just
doing it all-at-once at the end of the wait time for now.
Incidentally, the design of the disks *more or less* matches that of the
real 1.44 MB 3.5" disks. In order to make them more DCPU-16 friendly, I
specified that the sectors on both sides of the disc are really one, giving
us sectors that are twice the size (by number of bits), but with the same
overall physical configuration and capacity.

Incidentally, this document was a great help in writing this up:

I think "Set interrupt number" command is missing a description of the new interrupt number parameter, presumably in register B? I made an edit here:, but can't see how to send a gist pull request.


jonpovey: Thanks, fixed.

Cool, glad to help!

rmmh commented

" If interrupts are disabled, the device will wait until they are re-enabled again and then raise the interrupt. Until the interrupt is raised, the device will NOT consider the non- blocking operation "complete"."

With the queued interrupts (IAQ) in 1.5, this could probably be removed.


rmmh: You're right. I've removed that, but kept the line about the operation not being complete until the interrupt is raised since it might possibly make things a little clearer for someone down the line. :P

Although, given that Notch has apparently already taken a copy of this, I'm not sure if there's any point in updating this...

Hooray for IAQ! ;)

rmmh commented

Assume you can poke him with a few simplifications.

Are variably-sized sectors worthwhile at all? Why not just standardize on some power of 2 words? (256 or 512 words would probably be good).

If you attempt to write to a writelocked disk, does it fail silently or should it return an error code?


Hmm, I read the write-protect signal as a flag one needed to check before attempting to write -- that it was up to the software to respect it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.