Last active
June 3, 2017 06:54
-
-
Save cbmeeks/d38d2ddca700e5dd9bea to your computer and use it in GitHub Desktop.
ZX Spectrum Pixel Address Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addr = function(L, C, R) { | |
return 16384 + 2048 * Math.floor(L / 8) + 32 * (L - 8 * Math.floor(L / 8)) + 256 * R + C; | |
}; | |
hexString = addr.toString(16);
and reverse the process with:
yourNumber = parseInt(hexString, 16);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L = Line Number
C = Column Number
R = Row Number (0 - 7) within the Line