Advertisement
obernardovieira

Clear Screen with Video Memory [Intel 8086]

Jun 15th, 2015
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .8086
  2. .model small
  3. .stack 2048
  4.  
  5. ;there's no data segment because it's not needed
  6. cseg    segment para public 'code'
  7. assume  cs:cseg
  8.  
  9. Main  proc
  10.     mov ax,0b800h   ;B800 is the video memory adress
  11.     mov es,ax       ;move that adress to es
  12.                     ;es stands for "extra segment"
  13.  
  14.  
  15.     mov bx, ' '     ;space to bx. A space is what we will write in screen (to clean)
  16.     xor di, di      ;di -> 0
  17.     mov cx, 24*80   ;24*80 is the size of window! 24 lines,80 columns
  18.  
  19. ciclo:
  20.     mov es:[di], bx ;move the space to video adreess (in other words, write a space on screen)
  21.     add di, 2       ;every video adress have a size of word, so let's add 2
  22.     loop ciclo      ;repeat until cx = 0, In every loop, cx is decremented
  23.  
  24.  
  25.     mov ah,4CH
  26.     int 21H
  27. main    endp
  28.  
  29. cseg    ends
  30. end     main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement