BBS: Inland Empire Archive Date: 04-07-93 (16:07) Number: 299 From: MARK BUTLER Refer#: NONE To: WAYNE VENABLES Recvd: NO Subj: Memcopy Conf: (2) Quik_Bas
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)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET