JSFiddle - React, Tailwind, and code Playground
by thirdender
HTML
<xmp></xmp>
CSS
xmp {
margin: 1em;
}
JavaScript
function outportb(port, value) {
var b = value.toString(2);
$("xmp").append(("00000000" + b).slice(-8) + "\n");
}
var x, y,
pow = Math.pow;
for (x = 0; x < 8; x += 2) {
y = pow(2, x) - 1;
outportb (0x378, y);
}
for (; x < 16; x += 2) {
y = 256 - pow(2, x - 8);
outportb (0x378, y);
}