Advertisement
obernardovieira

Green background and black text [Intel 8086]

Jun 15th, 2015
558
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.     mov bl, 00100000b   ;[0][010][0000]b -> binary (*see below)
  19. ciclo:
  20.     mov bh, es:[di] ;get screen data (text)
  21.  
  22.     mov es:[di], bh     ;move the space to video adreess (in other words, write a space on screen)
  23.     mov es:[di+1], bl
  24.     add di, 2           ;every video adress have a size of word, so let's add 2
  25.     loop ciclo          ;repeat until cx = 0, In every loop, cx is decremented
  26.  
  27.  
  28.     mov ah,4CH
  29.     int 21H
  30. main    endp
  31.  
  32. cseg    ends
  33. end     main
  34.  
  35. ;the first 0 means static, if 1, text will be blinking
  36. ;the next 3 digits is for brackground color [000-111]
  37. ;the next 4 digits is for text color [000-1111]
  38. ;colors
  39. ;black          0000
  40. ;blue           0001
  41. ;gren           0010
  42. ;cyan           0011
  43. ;red            0100
  44. ;magenta        0101
  45. ;brown          0110
  46. ;light grey     0111
  47. ;dark grey      1000
  48. ;light blue     1001
  49. ;light green    1010
  50. ;light cyan     1011
  51. ;light red      1100
  52. ;light magenta  1101
  53. ;yellow         1110
  54. ;white          1111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement