Skip to content

Instantly share code, notes, and snippets.

@Costava
Created September 28, 2020 23:29
Show Gist options
  • Save Costava/9d5f7690c90846a1df87b0e1906cf017 to your computer and use it in GitHub Desktop.
Save Costava/9d5f7690c90846a1df87b0e1906cf017 to your computer and use it in GitHub Desktop.
Continuously print 'A' at boot
; Continuously print 'A' at boot
;
; Tested with NASM version 2.15.04
; and QEMU emulator version 5.1.0
;
; To compile:
; nasm -f bin real_mode_boot_to_A.asm -o real_mode_boot_to_A.bin
;
; To run:
; qemu-system-x86_64 real_mode_boot_to_A.bin
;
; To run and avoid seeing a warning:
; qemu-system-x86_64 -drive format=raw,file=real_mode_boot_to_A.bin
;
; ( https://unix.stackexchange.com/questions/276480/ )
;
; Resource: https://github.com/cfenollosa/os-tutorial
start:
mov ah, 0x0e ; Teletype output ( https://en.wikipedia.org/wiki/INT_10H )
mov al, 'A' ; The character to print
print:
int 0x10
jmp print
times 510 - ($-$$) db 0 ; Pad the remaining of the first 510 bytes with 0
dw 0xaa55 ; Magic bytes required at end of boot sector
; License: Zero Clause BSD
; Copyright (C) 2020 by Costava
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment