Mail Archives: djgpp/1999/09/17/19:02:31
"Santosh H." wrote:
>
> Hi,
> I was trying today to port some of my graphics functions I'd written for
> borland C to DJGPP(why prot mode u knucklehead!sorry:-)).Right , So i have
> a procedure which i converted from TASM to NASM syntax.the procedure is as
> below
>
> _Drawhorizline:
> push ebp
> mov ebp,esp
> push es
> push ds
>
> mov es,_VideoSegmentSelector ;which I get by push word 0a000h
> call ___dpmi_segment_to_descriptor
> mov [_Videosegmentselector],ax
> mov di,0 ;0 just for eg
> mov cx,80
> rep stosb "BANG!"<-generates a gpf
You're in 32-bit mode now, but you're only loading the low 16 bits of
edi. The high half still contains garbage. The same goes for ecx. You
want to do:
mov edi, 0
mov ecx, 80
Btw, "rep stosd" will be on the order of 4 times faster, since it moves
4 bytes at a time instead of 1. You'll just have to duplicate the value
to be stored (from al) 4 times in eax. This is left as an exercise for
the reader. :)
--
Nate Eldredge
neldredge AT hmc DOT edu
- Raw text -