delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/20/13:01:58

Message-ID: <376C3676.D6883917@geocities.com>
From: Sahab Yazdani <beyonder69 AT geocities DOT com>
Organization: MASC Productions
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Well, gee thats weird
Lines: 81
Date: Sat, 19 Jun 1999 20:31:50 -0400
NNTP-Posting-Host: 209.103.48.162
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: newscontent-02.sprint.ca 929838810 209.103.48.162 (Sat, 19 Jun 1999 20:33:30 EDT)
NNTP-Posting-Date: Sat, 19 Jun 1999 20:33:30 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello, Iif you've been following this newsgroup, you've probably read my
plea for a Assembly Function which cuts a small part of a bigger
bitmap??  Anyway I finally found some code (I had to tweak it to work
with NASM) that claimed that it did this.  So I used it, and a wierd
thing happens.  If the x and y values are bigger than a certain number
(i've tried up to 35) the program crashes (wierd no?).  Anyway I was
hoping that someone could help me (the code is attached below):

; Prototype: void ClipperFunction( void *source,
;                                   void *dest,
;                                   int x,
;                                   int y,
;                                   int maxx,
;                                   int maxy,
;                                   int IncrementA,
;                                   int IncrementB )

CLIPPER_Source						equ 8
CLIPPER_Dest						equ 12
CLIPPER_Left						equ 16
CLIPPER_Top							equ 20
CLIPPER_Right						equ 24
CLIPPER_Bottom						equ 28
CLIPPER_SourceIncrement			equ 32
CLIPPER_DestinationIncrement	equ 36

_ClipperFunction:
; Pointers have already been treated with offset implications in C++
   push ebp
   mov ebp, esp

   push ds

   push edx
   push ebx
   push ecx
   push esi
   push edi

; Get Region that you want to cut!
	mov edx, [ebp + CLIPPER_Right]
   sub edx, [ebp + CLIPPER_Left]
   mov ebx, [ebp + CLIPPER_Bottom]
   sub ebx, [ebp + CLIPPER_Top]

; Get Pointers that you want to Copy
; VirtualScreen
   mov esi, [ebp + CLIPPER_Source]
   mov edi, [ebp + CLIPPER_Dest]

; Do actual copying and stuff
.rowloop:
	mov ecx, edx
   shr ecx, 1
   rep movsw
   adc ecx, 0
   rep movsb
   add esi, [ebp + CLIPPER_SourceIncrement]
   add edi, [ebp + CLIPPER_DestinationIncrement]
   dec ebx

   jnz .rowloop

; All accessed registers should have push signal

   pop edi
   pop esi
   pop ecx
   pop ebx
   pop edx

   pop ds

	mov esp, ebp
   pop ebp

   ret

sorry if this code is messy but its the best I could do.

Anyways Thanks for any light you may be able to shine on this!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019