Conversor a Ensamblador
body {
font-family: monospace;
background-color: #ffffff;
}
textarea, input {
width: 100%;
margin-bottom: 10px;
font-size: 16px;
}
pre {
padding: 10px;
color: darkgrey;
background-color: rgba(0, 0, 0, 0);
}
button{
color: #ffffff;
background-color: black;
}
const tabla = {
"+": 70, ",": 4, "-": 64, ".": 128, "0": 63, "1": 6, "2": 91,
"3": 79, "4": 102, "5": 109, "6": 125, "7": 7, "8": 127, "9": 103,
":": 65, ";": 136, "=": 114,
"A": 119, "B": 124, "C": 57, "D": 94, "E": 121, "F": 113, "G": 111,
"H": 118, "I": 25, "J": 30, "K": 122, "L": 56, "M": 55, "N": 84,
"O": 63, "P": 115, "Q": 103, "R": 80, "S": 109, "T": 120, "U": 28,
"V": 62, "W": 29, "X": 112, "Y": 110, "Z": 73, "Ñ": 85, "°": 99
};function convertir() {
const texto = document.getElementById("entrada").value.toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
let salida = "Salida:\nTABLA ADDWF PCL, F\n";
for (let char of texto) {
if (tabla[char]) {
salida += ` RETLW .${tabla[char]} ; ${char}\n`;
}
}document.getElementById("salida").textContent = salida+`\nAgrega -> MOVLW .${texto.length} ;`;
}