Last active
September 15, 2022 00:33
-
-
Save falsovsky/f053431696e5c91e8298a2cf242fe91b to your computer and use it in GitHub Desktop.
FUCK YOU bootloader
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
bits 16 ; 16 bits por favor | |
org 0x7c00 ; a bios executa o bootloader em 0x7c00 | |
start: | |
mov si, FuckYouString ; Pointer para FuckYou em SI | |
call writeString ; Imprime String | |
jmp start ; LOOP FOREVERRRRRRRRRRr | |
;; --------------------------------------------------- | |
;; Interrupt 10H Service 14 : Write Character In Teletype (TTY) Mode | |
;; Writes on character at the current cursor location and advances the cursor. | |
;; Input: | |
;; AH = 0eh | |
;; AL = Character to write | |
;; BL = Foreground color (graphics modes only) | |
;; BH = Display page number (text modes only) | |
writeCharTTY: | |
mov ah, 0x0e ; Service 14 | |
mov bl, 0x07 ; Cor do texto | |
mov bh, 0x0 ; Page? | |
int 0x10 ; Interrupt 0x10 | |
ret ; VOLTA! | |
;; --------------------------------------------------- | |
;; Pointer para a string tem que estar em SI | |
writeString: | |
nextChar: | |
mov al, [si] ; Letra a imprimir | |
inc si ; Incrementa Pointer | |
OR al, al ; Verifica se AL é 0 | |
jz endString ; Se for chegamos ao final da string | |
call writeCharTTY ; Imprime letra em AL | |
jmp nextChar ; LOOOOOOOOOOP | |
endString: | |
ret ; VOLTA! | |
;; --------------------------------------------------- | |
FuckYouString db 'FUCK YOU on the bootloader!', 0 | |
;; o bootloader tem que ter no maximo 512 bytes e os ultimos | |
;; dois byte têm que ser 0xaa55 | |
times 510 - ($ - $$) db 0 ; encher tudo de zeros até ocupar 510 bytes | |
DW 0xaa55 ; adicionar a *signature* de bootloader |
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
## | |
# FUCK YOU on the bootloader | |
# | |
# @file | |
# @version 0.1 | |
# end | |
main: fuckyou.bin | |
floppy: main floppy.img | |
qemu: floppy | |
qemu-system-i386 -blockdev driver=file,node-name=f0,filename=floppy.img -device floppy,drive=f0 | |
fuckyou.bin: | |
nasm fuckyou.asm -fbin -o fuckyou.bin | |
floppy.img: | |
dd bs=512 count=2880 if=/dev/zero of=floppy.img | |
dd if=fuckyou.bin bs=512 of=floppy.img conv=notrunc | |
clean: | |
rm -f fuckyou.bin floppy.img |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment