Mail Archives: djgpp/1995/11/20/03:44:59
>>Okay, here's is what I want to do. I have an unsigned char global
>>variable and want to store it the *entire* vga memory. I'm using mode
>>13h, so it's a 64000 byte memory buffer. I've looked at movedata and
>>memset and both have segfaulted on me. I want to call one function that
>>takes care of this instead of looping 64000 times farpoking the
>>variable. Thanks for any info - this might even be a question for the
>>faq, I'm not sure, I checked it but did not find anything enlightening.
>>
>
>This ought to get ya started. I hope you know a little ASM.
>It takes as an argument the address of a buffer (64000 bytes long) and
copies it to the mode13h screen (assuming, that is, you've already
initialized that mode). Here goes:
>
>.text
>.extern __d_selectr
>.align 2
>
>.globl _putbuff
>
>_putbuff:
> pushl %ebp
> movl %esp, %ebp
>
> pushl %ebx
> pushl %edi
> pushl %es
> pushl %eax
> pushl %edx
> pushl %esi
> pushl %ecx
>
> movl 8(%ebp), %edx #Get buff address off stack
> movl %edx, %esi
> movl $0xa0000, %edi #offset of vga
>
> movw __d_selectr, %bx
> movw %bx, %es #put DOS mem selector into es
>
> movl $16000, %ecx #gonna copy 16000 DWORDS
> cld
> rep
> movsl #copy'em
>
> popl %ecx
> popl %esi
> popl %edx
> popl %eax
> popl %es
> popl %edi
> popl %ebx
> popl %ebp
>
> ret
>
>In yer C prog. do the following:
>
>(make this global)
>unsigned short _d_selectr;
>
>(sometime before you call putbuff do this)
>_d_selectr = _dos_ds;
>
>call putbuff like this:
>
> putbuff(buffer); (NOTE: There's no error checking as you can see
so make sure you've allocated a 64000 byte block of memory.)
>
>It's late here, so please forgive any typos. E-mail me if you need anymore
help.
>
>************************************************************************
>If anyone else is reading this, please answer a couple questions I have.
>
>Does the value (address) returned by _dos_ds ever change? ( I mean upon
subsequent calls) If so, what are the conditions for that change. And If
not, where EXACTLY does it point in DOS mem? (I assume it points to the
first byte of mem. Because the offset to vid.mem. in the previous function
would NOT point to vid.mem. when used in conjunction with _d_selectr.)
>
>
>
>
>
>
- Raw text -