Re: READABLE CODE IN COMP

 BBS: Inland Empire Archive
Date: 02-09-93 (20:00)             Number: 332
From: MARK BUTLER                  Refer#: NONE
  To: GLEN PANNICKE                 Recvd: NO  
Subj: Re: READABLE CODE IN COMP      Conf: (2) Quik_Bas
Once upon a time Glen Pannicke uttered these sage words to Matthew Miller:

 MM> Do you think you can give me a copy of your "pulldown.bas" program
 MM> I am having alot of trouble with it.

 GP> You don't want a copy of MY code. ;-)  It's got so many bugs
 GP> in it! Would you like a copy of the code MHB posted?  It's
 GP> very good & takes up 1\2 of the mem mine does?  His requires
 GP> compilation through BC and cannot be run through QB4 because
 GP> of some library calls.  Lemme know and I'll send it Net.

 Thanx for the compliment Glen :-)

 Here's a nice little ASM MemCopy that will plug right into the code
 with only minor modifications to the declaration and calls for
 MemCopy. Compile the ASM code below to memcopy.obj and use it in a
 QLB in order to run 'pulldown' in the QB/QBX IDE.

 The declaration for MemCopy in the pulldown code should be changed
 from...
 DECLARE SUB MemCopy ALIAS B$ASSN (BYVAL blah%, etc etc...
 to...
 DECLARE SUB MemCopy (FromSeg%, FromOfs%, ToSeg%, ToOfs%, Nbytes%)
 and...
 ...any calls to MemCopy throughout the code also will need altering
 to reflect the parameter list in the declaration.

==========================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%, Nbytes%)

        .MODEL medium, BASIC
        .CODE

MemCopy PROC USES si di ds es, FromSeg:PTR WORD, FromOfs:PTR WORD, \
                               ToSeg:PTR WORD, ToOfs:PTR WORD, \
                               Nbytes: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,Nbytes
        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<=============================
 For those of you who do not have MASM or TASM here is a little debug
 script to reconstruct MEMCOPY.OBJ. Just save the following snippet to
 a file called MEMCOPY.SCR and enter...
                        DEBUG < MEMCOPY.SCR
==========================8< Cut Here 8<=============================
n MEMCOPY.OBJ
e100 80 D 0 B 6D 65 6D 63 6F 70 79 2E 61 73 6D FF 96 2C 0 0 C 4D 45 4D
e118 43 4F 50 59 5F 54 45 58 54 5 5F 44 41 54 41 6 44 47 52 4F 55 50 5
e12F 5F 54 45 58 54 4 44 41 54 41 4 43 4F 44 45 39 98 7 0 48 0 0 5 7 1
e148 C 98 7 0 48 0 0 3 6 1 F 98 7 0 48 2B 0 2 7 1 E4 9A 4 0 4 FF 2 5D
e164 90 E 0 0 3 7 4D 45 4D 43 4F 50 59 0 0 0 3E 88 4 0 0 A2 1 D1 A0 2F
e17E 0 3 0 0 55 8B EC 56 57 1E 6 8B 5E C 8B 37 8B 5E A 8E 7 8B 5E 8 8B
e197 3F 8B 5E 6 8B F 8B 5E E 8E 1F FC F3 A4 7 1F 5F 5E 5D CA A 0 C3 8A
e1AF 2 0 0 74
Rcx
B3
W
Q
==========================8< Cut Here 8<=============================

 That's all there is to it. :-)


[-M-H-B-]

--- timEd/B7 * TSR Tagline v1.3 - press <ctrl><alt><del> to activate.
 * Origin:  Terminal Oasis, Portland OR  (1:105/330.5)
Outer Court
Echo Basic Postings

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