You've already forked CS-Box
All checks were successful
Changelog + Release on main / changelog_and_release (push) Successful in 29s
Signed-off-by: Alexander Lyall <alex@adcm.uk>
334 lines
21 KiB
HTML
334 lines
21 KiB
HTML
<!DOCTYPE html>
|
|
<html data-bs-theme="auto" lang="en" style="background: rgb(45,44,56);">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<!-- Matomo -->
|
|
<script>
|
|
var _paq = window._paq = window._paq || [];
|
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
_paq.push(["setCookieDomain", "*.www.computingbox.co.uk"]);
|
|
_paq.push(["setDomains", ["*.www.computingbox.co.uk","*.csbox.mrdaviscsit.uk","*.csbox.mrlyall.co.uk","*.csbox.mrlyall.uk"]]);
|
|
_paq.push(["enableCrossDomainLinking"]);
|
|
_paq.push(["disableCookies"]);
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="//analytics.adcmnetworks.co.uk/";
|
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
|
_paq.push(['setSiteId', '2']);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
|
})();
|
|
</script>
|
|
<noscript><p><img referrerpolicy="no-referrer-when-downgrade" src="//analytics.adcmnetworks.co.uk/matomo.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>
|
|
<!-- End Matomo Code -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
|
<title>Two's Complement Binary Simulator - CS:Box</title>
|
|
<link rel="canonical" href="https://www.computingbox.co.uk/twos-compliment-binary.html">
|
|
<meta property="og:url" content="https://www.computingbox.co.uk/twos-compliment-binary.html">
|
|
<meta property="og:type" content="website">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta property="og:image" content="https://www.computingbox.co.uk/assets/img/ComputingBox-Logo.webp">
|
|
<script>
|
|
(function() {
|
|
|
|
// JavaScript snippet handling Dark/Light mode switching
|
|
|
|
const getStoredTheme = () => localStorage.getItem('theme');
|
|
const setStoredTheme = theme => localStorage.setItem('theme', theme);
|
|
const forcedTheme = document.documentElement.getAttribute('data-bss-forced-theme');
|
|
|
|
const getPreferredTheme = () => {
|
|
|
|
if (forcedTheme) return forcedTheme;
|
|
|
|
const storedTheme = getStoredTheme();
|
|
if (storedTheme) {
|
|
return storedTheme;
|
|
}
|
|
|
|
const pageTheme = document.documentElement.getAttribute('data-bs-theme');
|
|
|
|
if (pageTheme) {
|
|
return pageTheme;
|
|
}
|
|
|
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
}
|
|
|
|
const setTheme = theme => {
|
|
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
document.documentElement.setAttribute('data-bs-theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-bs-theme', theme);
|
|
}
|
|
}
|
|
|
|
setTheme(getPreferredTheme());
|
|
|
|
const showActiveTheme = (theme, focus = false) => {
|
|
const themeSwitchers = [].slice.call(document.querySelectorAll('.theme-switcher'));
|
|
|
|
if (!themeSwitchers.length) return;
|
|
|
|
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
|
|
element.classList.remove('active');
|
|
element.setAttribute('aria-pressed', 'false');
|
|
});
|
|
|
|
for (const themeSwitcher of themeSwitchers) {
|
|
|
|
const btnToActivate = themeSwitcher.querySelector('[data-bs-theme-value="' + theme + '"]');
|
|
|
|
if (btnToActivate) {
|
|
btnToActivate.classList.add('active');
|
|
btnToActivate.setAttribute('aria-pressed', 'true');
|
|
}
|
|
}
|
|
}
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
const storedTheme = getStoredTheme();
|
|
if (storedTheme !== 'light' && storedTheme !== 'dark') {
|
|
setTheme(getPreferredTheme());
|
|
}
|
|
});
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
showActiveTheme(getPreferredTheme());
|
|
|
|
document.querySelectorAll('[data-bs-theme-value]')
|
|
.forEach(toggle => {
|
|
toggle.addEventListener('click', (e) => {
|
|
e.preventDefault();
|
|
const theme = toggle.getAttribute('data-bs-theme-value');
|
|
setStoredTheme(theme);
|
|
setTheme(theme);
|
|
showActiveTheme(theme);
|
|
})
|
|
})
|
|
});
|
|
})();
|
|
</script>
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1">
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1" media="(prefers-color-scheme: dark)">
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1">
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1" media="(prefers-color-scheme: dark)">
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1">
|
|
<link rel="icon" type="image/webp" sizes="1024x1024" href="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1">
|
|
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css?h=bec7173809e9299f24e368ea574911e3">
|
|
<link rel="stylesheet" href="/assets/css/DSEG7%20Classic%20Regular.css">
|
|
<link rel="stylesheet" href="/assets/css/IEC%20symbols%20Unicode.css?h=f58bcc159dfcde3a8902f3c3e5961248">
|
|
<link rel="stylesheet" href="/assets/css/Inter.css?h=60f7751edc3ab55acc7880f1e25e45d3">
|
|
<link rel="stylesheet" href="/assets/css/Open%20Sans.css?h=ce1e3121e620675940c895d202b884b3">
|
|
<link rel="stylesheet" href="/assets/css/Seven%20Segment.css?h=f58bcc159dfcde3a8902f3c3e5961248">
|
|
<link rel="stylesheet" href="/assets/css/bss-overrides.css?h=3dbfe72d968bc29929e6342eb303e930">
|
|
<link rel="stylesheet" href="/assets/css/Slider-Range.css?h=f8e9df474f99934e8bddde82bea5ff22">
|
|
<link rel="stylesheet" href="/assets/css/styles.css?h=88201532374cf4b4d8d775d23183d357">
|
|
</head>
|
|
|
|
<body>
|
|
<header class="bg-dark">
|
|
<!-- Start: Site Navigation -->
|
|
<nav class="navbar navbar-expand-md sticky-top py-3 navbar-dark" id="mainNav" style="background: rgb(45, 44, 56);">
|
|
<div class="container"><img src="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1" style="width: 32px;margin: 5px;"><a class="navbar-brand d-flex align-items-center" href="/"><span>Computing:Box</span></a><button data-bs-toggle="collapse" class="navbar-toggler" data-bs-target="#navcol-5"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
|
|
<div class="collapse navbar-collapse" id="navcol-5">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="about">About</a></li>
|
|
<li class="nav-item dropdown"><a class="dropdown-toggle nav-link active" aria-expanded="false" data-bs-toggle="dropdown" data-bs-auto-close="false" href="#">Binary</a>
|
|
<div class="dropdown-menu"><a class="dropdown-item" href="unsigned-binary">Unsigned Integers</a><a class="dropdown-item active" href="twos-compliment-binary">Two's Compliment</a></div>
|
|
</li>
|
|
<li class="nav-item dropdown"><a class="dropdown-toggle nav-link" aria-expanded="false" data-bs-toggle="dropdown" data-bs-auto-close="false" href="#">Hexadecimal</a>
|
|
<div class="dropdown-menu"><a class="dropdown-item" href="gcse-hexadecimal">GCSE</a><a class="dropdown-item" href="a-level-hexadecimal">A Level</a></div>
|
|
</li>
|
|
<li class="nav-item"><a class="nav-link" href="hex-colours">Hex Colours</a></li>
|
|
<li class="nav-item dropdown"><a class="dropdown-toggle nav-link" aria-expanded="false" data-bs-toggle="dropdown" data-bs-auto-close="false" href="#">Logic Gates</a>
|
|
<div class="dropdown-menu"><a class="dropdown-item" href="not-gate">NOT</a><a class="dropdown-item" href="and-gate">AND</a><a class="dropdown-item" href="or-gate">OR</a><a class="dropdown-item" href="nor-gate">NOR</a><a class="dropdown-item" href="nand-gate">NAND</a><a class="dropdown-item" href="xor-gate">XOR</a><a class="dropdown-item" href="xnor-gate">XNOR</a></div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav><!-- End: Site Navigation -->
|
|
</header><!-- Start: Hero Banner Color -->
|
|
<section class="d-print-none d-lg-none d-xl-none d-xxl-none py-4 py-xl-5">
|
|
<div class="container h-100">
|
|
<div class="text-white border rounded border-0 p-1 bg-danger">
|
|
<div class="row h-100">
|
|
<div class="col-md-10 col-xl-8 text-center d-flex d-sm-flex d-md-flex justify-content-center align-items-center justify-content-md-start align-items-md-center justify-content-xl-center mx-auto">
|
|
<div>
|
|
<h1 class="text-uppercase fw-bold text-white mb-3" style="font-size: 24pt;">SITE Not Suitable for DEVICES WITH SMALLER SCREENS</h1>
|
|
<p class="mb-4">This site is not suitable for mobile devices and tablets, please try accessing this site on a desktop or laptop.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section><!-- End: Hero Banner Color -->
|
|
<section style="background: rgb(39,38,46);">
|
|
<!-- Start: 1 Row 2 Columns -->
|
|
<div class="container" style="width: 100%;margin-top: 15px;">
|
|
<div class="row">
|
|
<div class="col centred" style="width: 35%;">
|
|
<div class="centred reset" style="position: relative;">
|
|
<p class="resetButton">Reset bit:box</p>
|
|
<div style="position: absolute;"><img class="overlay resetIcon" src="/assets/img/BitBoxLogo.png?h=a50b3ddb5614299b0c00dd4f01bc402e" onclick="resetBinarySimulator()"></div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xl-12 bottomSpacer"></div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6" style="width: 60%;">
|
|
<div class="row">
|
|
<div class="col">
|
|
<h1 class="simHeading">Denary</h1>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
<h1 id="denaryNumber" class="simData">0</h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6" style="width: 20%;">
|
|
<div class="row">
|
|
<div class="col hexadecimalButtons"><button class="btn btn-primary binaryButtons customiserButtons" type="button" onclick="requestBinary()">Custom Binary</button></div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col hexadecimalButtons"><button class="btn btn-primary binaryButtons customiserButtons" type="button" onclick="requestDenary()">Custom Denary</button></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col centred" style="width: 35%;">
|
|
<div class="row">
|
|
<div class="col-xl-12 bottomSpacer"></div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6" style="width: 60%;">
|
|
<div class="row">
|
|
<div class="col">
|
|
<h1 class="simHeading">Binary</h1>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
<h1 id="binaryNumber" class="simData">00000000</h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6" style="width: 20%;">
|
|
<div class="row">
|
|
<div class="col hexadecimalButtons"><button class="btn btn-primary binaryButtons customiserButtons" type="button" onclick="shiftTwosComplement("left")">Left Shift</button></div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col hexadecimalButtons"><button class="btn btn-primary binaryButtons customiserButtons" type="button" onclick="shiftTwosComplement("right")">Right Shift</button></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col spacer" style="width: 100%;"></div>
|
|
</div>
|
|
</div><!-- End: 1 Row 2 Columns -->
|
|
<div class="container d-xl-flex justify-content-xl-center centred">
|
|
<div class="text-center d-xl-flex justify-content-xl-center" style="width: 100%;">
|
|
<table class="table table-borderless">
|
|
<thead>
|
|
<tr>
|
|
<th class="tableCells">
|
|
<h1 id="blbN128" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb64" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb32" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb16" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb8" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb4" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb2" class="poweredOff" style="text-align: center;font-size: 48px;">💡<br></h1>
|
|
</th>
|
|
<th class="tableCells">
|
|
<h1 id="blb1" class="poweredOff" style="text-align: center;font-size: 48px;">💡</h1>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">-128</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">64</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">32</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">16</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">8</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">4</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">2</h1>
|
|
</td>
|
|
<td class="tableCells">
|
|
<h1 class="simColumns">1</h1>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swtN128" type="button" onclick="changeBit(-128)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt64" type="button" onclick="changeBit(64)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt32" type="button" onclick="changeBit(32)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt16" type="button" onclick="changeBit(16)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt8" type="button" onclick="changeBit(8)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt4" type="button" onclick="changeBit(4)">⏼<br></button></td>
|
|
<td class="text-center tableCells"><button class="btn btn-primary buttonMiddle" id="swt2" type="button" onclick="changeBit(2)">⏼<br></button></td>
|
|
<td class="text-center"><button class="btn btn-primary buttonMiddle" id="swt1" type="button" onclick="changeBit(1)">⏼<br></button></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="container d-xl-flex justify-content-xl-center centred" style="height: 120px;"></div>
|
|
</section><!-- Start: Footer Multi Column -->
|
|
<footer style="background: rgb(45,44,56);">
|
|
<div class="container py-4 py-lg-5">
|
|
<div class="row justify-content-center">
|
|
<!-- Start: About Project -->
|
|
<div class="col-sm-4 col-md-3 text-center text-lg-start d-flex flex-column">
|
|
<div class="fw-bold d-flex align-items-center mb-2"><img src="/assets/img/ComputingBox-Logo.webp?h=6ac4a5bf6a143a74e3e10fd9455bcce1" style="width: 32px;margin: 5px;" width="32" height="32"><span>Computing:Box</span></div>
|
|
<p class="text-muted">Computing Concept Simulators</p>
|
|
</div><!-- End: About Project -->
|
|
</div>
|
|
<hr>
|
|
<div class="col text-center d-block"><a href="https://www.computingbox.co.uk">Computing:Box</a> © 2024 by <a href="https://git.adcmnetworks.co.uk/alexander.lyall">Alexander Lyall</a> is licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a><br><img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" alt="" style="max-width: 1.5em;max-height:1.5em;margin-left: .2em;"><img src="https://mirrors.creativecommons.org/presskit/icons/by.svg" alt="" style="max-width: 1.5em;max-height:1em;margin-left: .2em;"><img src="https://mirrors.creativecommons.org/presskit/icons/nc.svg" alt="" style="max-width: 1.5em;max-height:1em;margin-left: .2em;"><img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" alt="" style="max-width: 1.5em;max-height:1em;margin-left: .2em;"><br><a href="copyright">Copyright Notice</a></div>
|
|
<div class="text-muted d-flex justify-content-center"></div>
|
|
<p class="mb-0"><noscript><!-- Matomo Image Tracker-->
|
|
<img referrerpolicy="no-referrer-when-downgrade" src="https://analytics.adcmnetworks.co.uk/matomo.php?idsite=2&rec=1" style="border:0" alt="" />
|
|
<!-- End Matomo --></noscript>Built for UK Computing Curriculum<br>Powered By ADCM Networks</p>
|
|
</div>
|
|
</footer><!-- End: Footer Multi Column -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="/assets/js/binary.js?h=122236ea60351806f6898510a67d196b"></script>
|
|
<script src="/assets/js/boldAndDark.js?h=78569998362133b84a76614652f3624f"></script>
|
|
<script src="/assets/js/hexadecimal.js?h=1d88c5f7da86e237fdac8a16a6958a73"></script>
|
|
<script src="/assets/js/hexColours.js?h=c64f15434dac1c095562a6a5fe8b155b"></script>
|
|
<script src="/assets/js/logicGates.js?h=cb132aa615fb58918ab65db03c7face7"></script>
|
|
</body>
|
|
|
|
</html> |