Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .8086
- .model small
- .stack 2048
- dseg segment para public 'data'
- fromLine db 9 ;from line we will copy
- toColumn db 35 ;to column we will copy
- inLine db 0 ;which line are we?
- dseg ends
- cseg segment para public 'code'
- assume cs:cseg, ds:dseg
- Main proc
- mov ax, dseg
- mov ds, ax
- mov ax,0b800h ;B800 is the video memory adress
- mov es,ax ;move that adress to es
- ;es stands for "extra segment"
- mov bl, 00100000b ;[0][010][0000]b -> binary (*see below)
- newLine:
- mov cx, 24 ;how much chars we will copy?
- ;24 is the maximum, because there are just 24 lines
- mov ax, 160 ;every line has 80 columns, but in video memory it has word size
- mov bh, fromLine ;so 80*2 = 160
- add bh, inLine
- mul bh
- mov di, ax ;calculate and put in di the index to start copy
- mov ax, 2 ;every column is word sized
- mov bh, toColumn ;to comun 25 for exemplo, we need 35*2, same thing above
- add bh, inLine
- mul bh
- mov si, ax ;calculate and put in si the index to where we will copy
- ciclo:
- mov bh, es:[di] ;get the text from screen
- mov es:[si], bh ;move the space to video adreess (in other words, write a space on screen)
- mov es:[si+1], bl ;change color
- add di, 2
- add si, 160
- loop ciclo ;repeat until cx = 0, In every loop, cx is decremented
- inc inLine
- cmp inLine, 2 ;2 is the number os lines we will copy
- jne newLine
- mov ah,4CH
- int 21H
- main endp
- cseg ends
- end main
- ;the first 0 means static, if 1, text will be blinking
- ;the next 3 digits is for brackground color [000-111]
- ;the next 4 digits is for text color [000-1111]
- ;colors
- ;black 0000
- ;blue 0001
- ;gren 0010
- ;cyan 0011
- ;red 0100
- ;magenta 0101
- ;brown 0110
- ;light grey 0111
- ;dark grey 1000
- ;light blue 1001
- ;light green 1010
- ;light cyan 1011
- ;light red 1100
- ;light magenta 1101
- ;yellow 1110
- ;white 1111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement