Created
November 16, 2022 23:44
-
-
Save william-lohan/624d0a4eb2fca468beab56124f38dacb to your computer and use it in GitHub Desktop.
Unholy abomination
This file contains 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
const fs = require('fs'); | |
const MOV_AH = 0xb4; | |
const MOV_BH = 0xb7; | |
const MOV_BL = 0xb3; | |
const MOV_AL = 0xb0; | |
const INT = 0xcd; | |
const JMP = 0xeb; | |
const bin = new Uint8Array(512); | |
const code = [ | |
MOV_AH, 0x0e, | |
MOV_BH, 0x00, | |
MOV_BL, 0x07, | |
MOV_AL, 'h'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 'e'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 'l'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 'l'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 'o'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, ' '.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 'j'.charCodeAt(0), | |
INT, 0x10, | |
MOV_AL, 's'.charCodeAt(0), | |
INT, 0x10, | |
JMP, 0x26, | |
]; | |
code.forEach((ins, index) => { | |
bin[index] = ins; | |
}); | |
bin[510] = 0x55; | |
bin[511] = 0xaa; | |
fs.createWriteStream("out.bin").write(Buffer.from(bin.buffer)); | |
console.log(bin); | |
// run qemu-system-x86_64 out.bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment