Skip to content

Instantly share code, notes, and snippets.

@INeddHelp
Created February 14, 2023 08:16
Show Gist options
  • Save INeddHelp/1308b6e410f2efce0cf716d9ab58abcd to your computer and use it in GitHub Desktop.
Save INeddHelp/1308b6e410f2efce0cf716d9ab58abcd to your computer and use it in GitHub Desktop.
section .data
screen db 0x13 ; Video mode 0x13 is 320x200 256-color mode
section .text
global _start
_start:
; Set video mode
mov ah, 0x00
mov al, [screen]
int 0x10
; Get the number of pixels on the screen
mov bx, 320 ; Number of pixels in a row
mov cx, 200 ; Number of rows
imul bx, cx ; Total number of pixels
; Set all pixels to black
mov ah, 0x0C ; Set the video memory write function
mov al, 0x00 ; Color code for black
mov cx, bx
xor di, di ; Destination index, initially 0
cld ; Clear the direction flag
rep stosb ; Fill video memory with the specified color
; Halt the program
mov ah, 0x4C
xor al, al
int 0x21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment