home *** CD-ROM | disk | FTP | other *** search
- ===========================================================================
- BBS: The Abacus * HST/DS * Potterville, MI
- Date: 04-07-93 (16:07) Number: 267
- From: MARK BUTLER Refer#: NONE
- To: WAYNE VENABLES Recvd: NO
- Subj: Memcopy Conf: (35) Quick Basi
- ---------------------------------------------------------------------------
- Once upon a time Wayne Venables uttered these sage words to All:
-
- WV> I really need a good memory copy routine with...
-
- WV> Source Segment/Offset
- WV> Destination Segment/Offset
- WV> Number of bytes to copy
-
- WV> I remember a memcopy.obj that was posted here a while ago,
- WV> can anybody repost!!!
-
- Coming right up! This little ASM goodie was written by Brent Ashley and
- has work extremely well for me and the QB declaration is precisely what
- you said you wanted.
-
- ==========================8< Cut Here 8<=============================
- PAGE 56,132
- TITLE MemCopy.ASM - QuickBasic callable memory block copy bin file
- ;
- ; MemCopy.ASM - (C)1991 by Brent Ashley
- ; Copies blocks of memory quickly - to be used for screen saves.
- ;
- ; QB/QBX declaration:
- ;
- ; DECLARE SUB MemCopy (FromSeg%, FromOfs%, ToSeg%, ToOfs%, Count%)
-
- .MODEL medium, BASIC
- .CODE
-
- MemCopy PROC USES si di ds es, FromSeg:PTR WORD, FromOfs:PTR WORD, \
- ToSeg:PTR WORD, ToOfs:PTR WORD, \
- Count:PTR WORD
-
- ; load ds:si with source, es:di with destination
- mov bx,FromOfs
- mov si,[bx]
- mov bx,ToSeg
- mov es,[bx]
- mov bx,ToOfs
- mov di,[bx]
- mov bx,Count
- mov cx,[bx]
-
- ; ds last (used to access data)
- mov bx,FromSeg
- mov ds,[bx]
-
- ; do the copy
- cld
- rep movsb
-
- ret
-
- MemCopy ENDP
-
- END
- ==========================8< Cut Here 8<=============================
- Now, if you don't happen to have MASM or TASM to assemble it with
- here's a little PostIt! script to recompile MEMCOPY.OBJ
- ==========================8< Cut Here 8<=============================
- '** Save this script to a file, edit out all of the non-QB related
- '** text and execute it in a QB environment to retrieve MEMCOPY.OBJ
- CLS:?STRING$(50,177):?"Creating:MEMCOPY.OBJ with PostIt! v2.9f"
- DEFINT A-Z:FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "B",1,"MEMCOPY.OBJ"
- T$="abcdefghijklmnopqrstuvwxyz":T$=T$+UCASE$(T$)+"0123456789()"
- G"a2aal0wzTn2BWLNlHnxB)Bjlaaadnvutd9euz9fvfHfvf8frbrvqgq0rs9uvqvW
- G"xuvewurarbrvqem0tevuoyEaaibaafCqamG5baGeaamGbb8aMhaasRaGahea5As
- G"aae8VaDbPdaaWah0urnn0tqLfaaaGpisaaaiAard6lamaaau1ISB1vEyWIEXWI3
- G"SOxk44bl6fcl(ZIEzWIpSOxo44h8ppPh8XxE1LYkaWWkkaaaqh"
- N=179:K=255:IF LEN(C$)<>239 THEN ?"Incomplete script file!":BEEP:END
- FOR A=1 TO N:IF L=0 THEN GOSUB G:L=6:LOCATE 1:?STRING$((51&*A)\N,8)
- W=T\P(6-L):GOSUB G:W=W OR T*P(L):L=L-2:B$=CHR$(W AND K):PUT 1,,B$:NEXT
- ?:IF C<>22 THEN ?"Bad checksum!":BEEP:END ELSE ?"Success!":END
- G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C\256+(C AND 255):RETURN
- SUB G(A$):SHARED C$:C$=C$+LEFT$(A$,63):END SUB
- ==========================8< Cut Here 8<=============================
-
- Hope this helps :-)
-
- ·∙■[-M-H-B-]■∙·
-
- --- timEd/B8 * "Milhouse, we live in the age of cooties!" -Bart Simpson
- * Origin: MotherShip Portholes, Portland OR (1:105/330.5)
- SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
- SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 575 950 203/23 209/209
- SEEN-BY: 280/1 390/1 396/1 15 397/2 2230/100 3603/20
-