hello. i need to write a code that can save entire screen(80*25) to a file(the screen filled by some words by the user like a notepad) . actually i dont know how to put rows and columns to a 80*25 array or should do something else for that buffer variable and then put that variable to DX for save file. can any one help me please?
the screen buffer resides at 0B800h
each character takes 2 bytes - one for the char and one for the attribute byte
the fastest way is to read it directly from the buffer
if you only want the characters, you need 80x25 = 2000 bytes
you may want to add carriage return/line feed pairs to the end of each line
it depends on what you intend to do with the data
if you just want the characters, something like this should work
.DATA?
ScnBuf db 2000 dup(?)
.CODE
mov ax,@DATA
mov es,ax
mov ax,0B800h
mov ds,ax
xor si,si
mov di,offset ScnBuf
mov cx,2000
RdLoop: mov al,[si]
stosb
add si,2
loop RdLoop
push es
pop ds
Hi,
Look for the Snipper utility from PC Magazine. Using it may
give you some ideas. Version 2.6 was written by Tom Kihlken
in 1987. A variation on Dave's code below with chages in
uppercase.
Regards,
Steve
.DATA?
ScnBuf db 2000 dup(?)
.CODE
PUSH ES
mov ax,@DATA
mov es,ax
mov ax,0B800h
mov ds,ax
xor si,si
mov di,offset ScnBuf
mov cx,2000
RdLoop:
LODSW
stosb
loop RdLoop
push es
pop ds
POP ES
ok thanks a lot guys:) i should try those