Created
November 30, 2021 22:03
-
-
Save SegHaxx/1850f1b6741f00e8765ee0de9dc80cd2 to your computer and use it in GitHub Desktop.
PC bootsector string spewer in NASM
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
; vi:ft=nasm | |
cpu 8086 | |
org 0x0 | |
jmp start | |
rulz db 'seg rulz ok ',0 | |
start: cli ; disable interrupts because lolbugs | |
mov ax,0x7c0 ; BIOS loads code at 0000:7C00 | |
mov ds,ax | |
mov es,ax | |
; set up stack | |
xor ax,ax | |
mov ss,ax | |
mov sp,0xffff | |
sti | |
xor bx,bx ; attrib | |
mov cx,1 ; just one thanks | |
.again: inc bx ; next attrib | |
and bl,0x7F ; no flashing please | |
mov si,rulz | |
.loop: lodsb ; load next char | |
test al,al | |
jz .again | |
mov ah,09h ; write char with attrib | |
int 10h ; BIOS | |
mov ah,0Eh ; write char and advance | |
int 10h ; BIOS | |
jmp .loop | |
times 510-($-$$) db 0 | |
dw 0xAA55 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment