[comp.binaries.amiga] v02i002: WarpText 2.0

billk@pnet01.UUCP (Bill Kelly) (07/18/87)

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	README
#	WarpText.doc
#	Warp.uu
#	WarpText.obj.uu
# This archive created: Sat Jul 18 02:45:52 1987
# By:	Craig Norborg (Purdue University Computing Center)
cat << \SHAR_EOF > README
ReadMe for WarpText version 2.0                         Bill Kelly  07Jul87

        Hi.  I've been having a few problems with my assembler.  I wrote
    an example program to open up a window and a screen and then do some
    WarpText into it.  For some reason, the assembler would do strange
    things to the code on the second pass, including not assembling
    the data.  After a while it would give up with some "Error 500" which
    it said was an unknown error and that I should report it.  I didn't
    see anything about this kind of thing in the manual and haven't
    been able to make it work.  It did assemble WarpText, however, and
    I was able to test the routines interactively with Forth.  They all
    work fine.

        Here is a list of the files that should be in WarpText.ARC:

            WarpText.doc        WarpText.asm        WarpText.h
            WarpText.i          Warp.C              WarpC.asm
            Warp                WarpText.obj        README

        WarpText.doc:   A small bit of documentation on the routines,
                        plus a copyright notice, thank-you notes,
                        information on distributing WarpText,
                        my address, etc.   Please read this file.
                        (At least the first part, anyway...)  Thanks.

        WarpText.asm:   The WarpText routines.  There is documentation
                        telling how to call each routine at the beginning
                        of each routine.

        WarpText.h:     The 'C' include for WarpText, written by Anson Mah.

        WarpText.i:     The assembler include for WarpText.

        Warp.C:         A quick test of the original WarpText routines,
                        written by Anson Mah.

        WarpC.asm:      A 'C' interface to the WarpText routines.  Makes
                        them easily callable from 'C' -- written by
                        Anson Mah.

        Warp:           Executable for the file "Warp.C" -- this program
                        only demonstrates the pre-release WarpText routines.
                        The NewWarp (version 2.0) routines did not exixt
                        when Anson wrote Warp.C.  NewWarp is close to
                        twice as fast as the routines demoed by this
                        program.

        WarpText.obj:   Assembley of the file "WarpText.asm" -- assembled
                        with the symbols, and ready to link!  :-)

        README:         Exactly.  That's just what you're doing.


                                                Enjoy the routines --
                                                I hope they will be useful!

                                                Bill Kelly.

SHAR_EOF
cat << \SHAR_EOF > WarpText.doc
WarpText.doc                      WT 2.0                        Bill Kelly
                                                                07/06/87

       //     // ////// //////  //////    //////// ////// ||//  ////////
      //     // //  // //  //  //  //       //    //      |//     //
     //  /  // ////// //////  //////       //    /////    //     //
    // /// // //  // //  //  //           //    //       //|    //
   ///   /// //  // //   // //           //    //////   //||   //

THANK YOU'S: (in alphabetical order)

  Thanks to Anson Mah for writing the WarpText 'C' interface.
  Without him, there wouldn't be one -- I don't speak C!

  Thanks to Aaron Avery for taking my original unreleased WarpText routine,
  which was fast but not fancy, and speeding it up immensely.  This routine,
  (after I sped it up even more by rearranging the font data), and Aaron's
  cursor routine, are WarpText 2.0.

  Thanks to Hayes C. Haugen who, by writing Blitz, reminded me of what
  text on a computer like this *ought* to be like and so got me started
  on WarpText.

  Thanks to Leon Frankel (sorry if I got the name wrong -- that's what it
  sounded like over the phone) for reporting a bug in the wi_Width handling
  in the WarpText prerelease routines.
  (Please see "BUGS:" for more information.)

  If I forgot anyone -- sorry.  Thanks to you, too!

COPYRIGHT NOTICE:

                The WarpText code, and the name "WarpText,"
                    is Copyright 1987 by Bill W. Kelly.

DISTRIBUTION INFORMATION:

  Feel free to distribute this code, complying with the following
  restriction:

       Since there are many files in this release of WarpText,
       please distribute them in ARCed form so that no files get lost.
       (If you need to UUEncode, please UUEncode the ARC file.)
       Thanks!

  NOTE: IF YOU ARE GOING TO MODIFY THE CODE, please make a little note
        containing the date, your comments, and what the original code was.
        Thanks.

USING WARPTEXT IN A PROGRAM:

  That's why I wrote it!

  If you are going to distribute the WarpText source code with your program
  please also follow the directions under "DISTRIBUTION INFORMATION."

  It would be neat, especially if you aren't distributing the source
  with your program, if you could find a place somewhere in your program
  (the "ABOUT" menu, for instance) to say something like,
  "Using Bill Kelly's WarpText routines for speed!," however if you
  don't seem to be able to do this... don't worry about it.  I would
  really appreciate it, though!  Thanks!

  PLEASE CONTACT ME BEFORE USING THIS CODE IN A COMMERCIAL PROGRAM!
           (My address can be found at the end of this file.)

GENERAL INFORMATION:

  The "Old Warp" routines use the WarpInfo structure to keep track
  of which bitplane they're writing into, the current X and Y locations,
  the TextFont data, etc.

  STRUCTURE   WarpInfo,0      ; ...the <I> denotes internal use.
      APTR    wi_TextFont     ;     Pointer to a TextFont structure.
      APTR    wi_BitMap       ;     Pointer to a BitMap structure.
      WORD    wi_WhichPlane   ;     Which bitplane to render into.
      WORD    wi_Left         ;     Left edge of 'window' in char loc's.
      WORD    wi_Top          ;     Top edge of 'window' in char loc's.
      WORD    wi_Width        ;     Width of 'window' in char loc's.
      WORD    wi_Height       ;     Height of 'window' in char loc's.
      APTR    wi_WindowTop    ; <I> Address of top of 'window.'
      APTR    wi_CurLine      ; <I> Address of start of current line.
      APTR    wi_LastLine     ; <I> Address of start of last line.
      WORD    wi_CurX         ; <I> Current X position.
      WORD    wi_LastX        ; <I> Maximum X position on a line.
      WORD    wi_BPMod        ; <I> # total possible chars on a line in bp
      WORD    wi_Modulo       ; <I> Add this to get to next line.
      LABEL   wi_SIZE

  Call the InitWarpInfo routine before calling any of the other "Old Warp"
  routines.  The WarpInfo structure you pass InitWarpInfo must be partially
  initialized before calling InitWarpInfo.  InitWarpInfo prepares
  the parts WarpInfo structure marked with "<I>" so that the WarpInfo
  structure can be used with GetXY, GotoXY, and WarpText.

  The "New Warp" routines use NewWarpInfo structure.  It's a lot smaller
  than WarpInfo because the new routines have sacrificed features for speed.

    STRUCTURE   NewWarpInfo,0
        WORD    nwi_XLoc        ; Current X position in char. loc's.
        WORD    nwi_YLoc        ; Current Y position in char. loc's.
        APTR    nwi_BitPlane    ; Address of bitplane to render text into.
        APTR    nwi_FontData    ; Address of 2048 byte array for font data.
        LABEL   nwi_SIZE

  Call the SetupFont routine before calling any of the other "New Warp"
  routines.  SetupFont unpacks the font passed to it into the 2048 byte
  array, the address of which is kept in nwi_FontData.  You must allocate
  this 2048 byte array and store its address into nwi_FontData before
  calling SetupFont.  Pass the pointer to an open font to SetupFont on
  the stack.  The 2048 byte array does not have to be in CHIP ram because
  the routines do not use the blitter.  After calling SetupFont, the
  NewWarpInfo structure can be used with NewWarp and XORCursor.

  Please see the file "WarpText.asm" for more information about each
  routine.

BUGS:

    Known Bugs:                                         Fixed:
    -----------                                         ------

      WarpText writes to two more columns per line         /
      than it should.  If you specify 10 for wi_Width    \/        Yes.
      you will get 12 characters per line.
                                                               _
      If WarpText encounters a character that has not    |\ | / \
      been defined in the font it's using it will not    | \| \_/  Not yet.
      output the empty-box character.  A garbage
      character-pattern will appear.

BUG REPORTS:

  I would really appreciate hearing about any problems you find in
  my code!  Please don't hesitate to drop me a line or send me mail
  if you have any suggestions, questions, or comments.  I welcome
  your input.
                                                    Enjoy,
                                                    Bill Kelly.

MY ADDRESS:

  NAME: Bill W. Kelly
  UUCP: {hplabs!hp-sdd, sdcsvax, ihnp4}!crash!pnet01!billk
  ARPA: crash!pnet01!billk@nosc
  INET: billk@pnet01.CTS.COM    | For UUCP, don't do just pnet01!billk;
  USPS: 2507 Caminito La Paz    | please include the crash!pnet01!billk.
        La Jolla, CA  92037     | Thanks!
  FONE: (619) 454-1307

* --------------------- *
* End of "WarpText.doc" *
* --------------------- *
SHAR_EOF
cat << \SHAR_EOF > Warp.uu
begin 644 Warp
M   #\P         $          ,    "    $@   1@   (1   #Z0    ).
M^0           ^P    !     P    (        #\@   ^L    2   #\@  
M ^H   $8                                                    
M                                                            
M                     &1O<RYL:6)R87)Y                 '1O<&%Z
M+F9O;G0      'P "  !5V%R<%1E>'0@5&5S=        H  R  !   "    
M$ X              )                 "@ #(  %I;G1U:71I;VXN;&EB
M<F%R>0!G<F%P:&EC<RYL:6)R87)Y $AI+"!":6QL(0H (" @5&AA;G@@9F]R
M('EO=7(@5V%R<%1E>'0@<F]U=&EN97,N("!!<R!Y;W4@8V%N('-E92P@=&AI
M<PH :7,@82!Q=6EC:R!T97-T(&]F("=E;2X@(%1H92!O;FQY(')O=71I;F4@
M22!D;VXG="!U<V4@:7,* $=E=%A9+B @06QS;R!N;W1E('1H870@22!H879E
M(&-R96%T960@82!787)P5&5X="YH(&9I;&4@9F]R"@!#('!R;V=R86UM97)S
M(&QI:V4@>6]U<G,@=')U;'D@86YD(&%L<V\@82!#(&EN=&5R9F%C90H ;6]D
M=6QE(&9O<B!T:&4@<V%M92!P96]P;&4A("!0;&5A<V4@9&\@=VAA="!Y;W4@
M=VEL;"!W:71H"@!T:&5M+@H (" @4FEG:'0N("!))W9E(&QO;VME9"!O=F5R
M('EO=7(@8V]D92!A;F0@8V%N)W0@<V5E(&%N>0H :6UM961I871E(&EM<')O
M=F5M96YT<RP@8G5T($D@;6%Y(&EF($D@<W1U9'D@=&AE;2!L;VYG97(N"@!!
M8W1U86QL>2P@22!B96QI979E('EO=2!M:6=H="!G86EN('-O;64@;6]R92!S
M<&5E9"!I9B!Y;W4* '-T87)T('5S:6YG('1H92!";&ET=&5R(&EN<W1E860N
M("!)="!W87,@;6%D92!T;R!H86YD;&4* '-T=69F(&QI:V4@=&AI<RX@(%EO
M=2!S:&]U;&0@8F4@86)L92!T;R!G970@=7!W87)D(&]F"@ S,"PP,# @8VAA
M<G,O<V5C(&EF('EO=2!U<V4@:70N("!4:&ES(&YU;6)E<B!W87,@;65A<W5R
M960* '=I=&@@=&AE('-E="!O9B!R;W5T:6YE<R!M>2!F<FEE;F1S(&-A;64@
M=7 @=VET:"!A('=H:6QE"@!B86-K+B @270G<R!F86ER;'D@86-C=7)A=&4N
M"@ @("!!;GEW87DL(&UO<F4@=VAE;B!)(&AA=F4@;6]R92!T:6UE('1O(&AA
M8VLA"@ @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
M("!!;G-O;@!(97DL($DG;2!H97)E(0!!;F0@:&5R92$A                
M     ^P    "     @   +@   "(         _     "7T1/4T)A<V4   1<
M    !%]-871H5')A;G-"87-E"     18     U]-871H0F%S90@     !%0 
M       #\@   ^D   (1(\    !0(\@   !4( ](YW[^*D L>0    0CS@  
M $ CSP   $Q"N0   $B3R4ZN_MHH0"/L )@    X2JP K&<  (H@#9"M  0C
MP     1A  ',0J=.N0  !WA8CR! (&@ K-'(T<@B:  0T\G3R2 Y    4'( 
M$ADCR0   %S0@5* 0F=2@ ) __Z?P%6 0G<( " Y    4"!Y    5"0 4X#4
M@1^P   @ %."4<C_]A^\ " @ %."'[$@ "  4<K_^")/+PE@  !T(^P .@  
M  1A  %(80 !,B/     2"\ )$ @*@ D9Q8L>0  !%P@0"(H   CP0   #A.
MKO^"(BH (&<<)#P   /M3J[_XB/     6&<*Y8@@0"EH  @ I"!Y    2"\(
M2'D     (&@ )"/H  0   !<3?D   1@(#P     9PI3@'( +,%1R/_\3?D 
M    3KD   42< !@!" O  0O " Y    +&<$($!.D$ZY   '1BQY    0")Y
M   $7$ZN_F)*N0  !%1G"B)Y   $5$ZN_F)*N0  !%AG"B)Y   $6$ZN_F)*
MN0   &!G"B)Y    8$ZN_F)*N0   $AG+"(Y    /&<$3J[_W"(Y    6&<$
M3J[_W"QY    !$ZN_WPB>0   $A.KOZ&(!\N>0   $Q,WW]^3G5P9&  _V!!
M[ !<3J[^@$'L %Q.KOZ,3G5#^0   &1P $ZN_=@CP   !%QGU$YU2.?X8'@ 
M,40 'C%H  X (")H  1T #0I   Q0@ B."@ ".6$(G%("'8 )&@  #8J !1R
M "("PL,Q00 D>  H <CH  S8:  *)$G5Q"%* !(A2@ 6=  T*  ,U&@ $"@!
MR,+8:  *)$G5Q"%* !I,WP8?3G4Q0  >PN@ )-*H !(A00 63G4B*  6DJ@ 
M$H+H "1P # H !Y.=4CG?3QX #@H !YZ #HH " O!3HH "0O!21H  !T !0J
M "!V !8J "$Z*@ F+P4Z*@ 4+P4D:@ B*&@ $B\,*&@ &B\,)F@ %GX /B@ 
M(E- <@!31%)$$AD, 0 @9P  *K(";0  1K(#;0  -BA*DH+9P2I+V\0J+P (
M4X4:E-GO  S;QU'-__:XKP 4;P  0G@ M]=G  !"U^\ $&   #HH2MG\   !
M &#(#($    *9]X,@0    QG   ,#($    -9\Y@VG@ )F\ !&    I1R/^"
M8   !E'(_WQ0CU"/4(\Q1  >(4L %DS?/+Y.=0  (&\ !$ZY   "-$YU(&\ 
M!" O  @B+P ,3KD   *H3G4@;P $3KD   *Z(&\ "#" (&\ ##"!3G4@;P $
M(F\ "" O  Q.N0   LY.=4JY    >&<2<"8O "\Y    >$ZY   '8%"/2KD 
M  !T9PXO.0   '1.N0  "!Q8CTJY    <&<.+SD   !P3KD   ?(6(]*N0  
M  !G#B\Y     $ZY   'R%B/0J=.N0   698CTYU<"$O $AY    SDZY   '
MW%"/(\      2H!F!&$ _WIP(2\ 2'D   #@3KD   ?<4(\CP    '!*@&8$
M80#_6G !+P!R)B\!3KD   =(4(\CP    'A*@&8$80#_/$AY    GDZY   (
M,%B/(\    !T2H!F!&$ _R!.=4Y5__Q"K?_\(&T "%*M  A*$&<&4JW__&#N
M("W__$Y=3G5.5?_N2.< (&$ _U@C_    /$    $(_P   #\    ""/\   !
M.     PC_    7(    0(_P   &O    %"/\   !Y@   !@C_    B$    <
M(_P   (H    ("/\   "80   "0C_    IP    H(_P   +7    +"/\   #
M$    # C_    T<    T(_P   ."    ."/\   #O    #PC_    ]H   ! 
M(_P   0*    1$AY    B$ZY   ']%B/('D   !X(( D>0   '0B:@ NTOP 
MN" )('D   !X(4  !$)H  @@>0   '@Q?  *  H@>0   '@Q?  #  P@>0  
M '@Q?  \  X@>0   '@Q?  5 ! O.0   'A.N0   \!8CT)M__8P+?_V#$  
M$60^2,#E@"! T?P    $(D#3_     0O$2](  QA /Z,6(\O "!O  PO$"\Y
M    >$ZY   #^$_O  Q2;?_V8+AP$R\ <ADO 2\Y    >$ZY   #S$_O  QP
M#B\ 2'D   0Z+SD   !X3KD   /X3^\ #' 4+P!R"B\!+SD   !X3KD   /,
M3^\ #' *+P!(>0  !$DO.0   'A.N0   _A/[P ,('D   !X+Q!.N0  " A8
MCR!Y    ="\H %9.N0  ![18CR!Y    ="\H %9.N0  !XQ8CR\ *T#__$ZY
M   'H%B/(&W__" H !0K0/_X#(    ( 9KIA /S*8+1.=2\.+'D   ! 3.\ 
M P (3J[_.BQ?3G4  "\.+'D   ! (F\ "" O  Q.KO\N+%].=2\.+'D   ! 
M(F\ "$ZN_MHL7TYU+PXL>0   $ @;P (3J[^C"Q?3G4O#BQY    0")O  A.
MKOZ&+%].=2\.+'D   ! (&\ "$ZN_H L7TYU+PXL>0   $ B;P (3J[^8BQ?
M3G4O#BQY    0")O  @@+P ,3J[]V"Q?3G4O#BQY    <"!O  A.KO^X+%].
M=2\.+'D   !P(F\ "$ZN_[(L7TYU+PXL>0     @;P (3J[_N"Q?3G4O#BQY
M     "!O  A.KO\T+%].=0   ^P    8     0  "#0   @@   &6   !E  
M  7$   %N@  !;    6F   %G   !9(   6(   %?@  !70   5J   %8   
M!58   5,   %0@  !3@   4N   %)   !(@   1<   $5    %\    "   (
M#   !_@   ?@   'S   ![@   >D   'D   !WP   =D   '3   !PX   ;\
M   &[   !MP   ;6   &P@  !JH   :D   &D   !G(   8N   &(@  !A8 
M  8*   %_@  !?    7@   %V   !<H   7    %M@  !:P   6B   %F   
M!8X   6$   %>@  !7    5F   %7   !5(   5(   %/@  !30   4J   %
M(   !.(   34   $Q@  !*@   2:   $>@  !$8   0^   $,   !"@   0:
M   $#@   :H   &B   !F    9    %8   !0    BP   &&    [@   B  
M  '\   !\    =H   '.   !Q@   ;P   &T   !@    6X   $Z   !+@  
M 28   $4    ^@   -X   #0    G    )8   !\    <@   $P    X    
M*    "(    <    "     (    ;     P  !R8   <8   '!@  !O0   ;(
M   &E@  !N(   :P   &>   !C0   70   $V@  !+X   2@   $@   !&P 
M  1B   $3   !#8   0@   #Q@   ]H   /F   $!@   7H   %>    6   
M      /P     U]/<&5N5VEN9&]W"   "#     #7T-L;W-E5VEN9&]W   (
M'     -?0VQO<V5&;VYT"     @(     U]/<&5N1F]N= @     !_0    #
M7T]P96Y,:6)R87)Y   'W     1?0VQO<V5,:6)R87)Y"      'R     -?
M5V%I=%!O<G0(      >T     U]297!L>4US9P@     !Z     "7T=E=$US
M9P@   >,     U]&:6YD5&%S:P@     !W@    "7T9R965-96T   =@    
9 U]!;&QO8TUE;0@     !T@        #\G@ 
 
end
SHAR_EOF
cat << \SHAR_EOF > WarpText.obj.uu
begin 644 WarpText.obj
M   #YP        /I    NDCG^&!X #%$ !XQ:  . " $:  ! " B:  $=  T
M*0  ,4( (C@H  CEA")Q2 AV "1H   V*@ 4<@ B L+#,4$ )'@ * '(Z  ,
MV&@ "B1)U<0A2@ 2(4H %G0 -"@ #-1H ! H <C"V&@ "B1)U<0A2@ :3-\&
M'TYU,4  'L+H "32J  2(4$ %DYU(B@ %I*H !*"Z  D<  P*  >3G5(YWT\
M>  X*  >>@ Z*  @+P4Z*  D+P4D:   =  4*@ @=@ 6*@ A.BH )B\%.BH 
M%"\%)&H (BAH !(O#"AH !HO#"9H !9^ #XH ")30'( 4T121!(9# $ (&< 
M "JR FT  $:R VT  #8H2I*"V<$J2]O$*B\ "%.%&I39[P ,V\=1S?_VN*\ 
M%&T  $)X +?79P  0M?O !!@   Z*$K9_    0!@R R!    "F?>#($    ,
M9P  # R!    #6?.8-IX "9O  1@   *4<C_@F    91R/]\4(]0CU"/,40 
M'B%+ !9,WSR^3G5(YX#P)&\ &")O !P@:0 ((#P    ?$/P _A#\ ,80_ #&
M$/P QA#\ ,80_ #&$/P _A#\  !1R/_>)&H (B9*< #4P!#2U/P P!#2U/P 
MP!#2U/P P!#2U/P P!#2U/P P!#2U/P P!#2U/P P!#2)$M2  Q  -]OR$S?
M#P%.=4CG\/@F+P H)&\ +"AO # P+   UVP  %-#,BP  B!L  0B;  ()DGO
M030!Y4'20M) T,%P ! :YT#2P!"9T/P 4!"9T/P 4!"9T/P 4!"9T/P 4!"9
MT/P 4!"9T/P 4!"9T/P 4!"9D/P"+R)+4<O_Q$S?'P].=4CGP, B;P 4,"D 
M B!I  3O0#( Y4#00=!I  #0P H0 /_0_ !0"A  _]#\ % *$ #_T/P 4 H0
M /_0_ !0"A  _]#\ % *$ #_T/P 4 H0 /_0_ !0"A  _TS? P-.=0   ^\!
M   #6$]20W5R<V]R       "B $   ).97=787)P     A !   #4V5T=7!&
M;VYT       !D $   )787)P5&5X=    * !   "1V5T6%D       ", 0  
M D=O=&]860      >@$   -);FET5V%R<$EN9F\              _     #
M1&].97AT4VEN061D    ]@    )$;TYO0VAA<@   4     !1&]&1@   68 
M   #0F]F9F]#:&%R       !2@    %$;T-2   !,@    %$;TQ&   !,   
M  )';W1O6%D      'H    #4V5T=7!&;VYT       !D     ).97=787)P
M     A     #1V]T;T1O3F5X=      !<     -83U)#=7)S;W(       *(
M     T1O06YO=&AE<@       =(    #5&AE56Y#;VQA       !I@    )"
M;&%N:P       2@    "36]V94-H87(   $<     D1O0VAA<@     !$@  
M  -$;TYE>'1#:&%R      #T     TEN:71787)P26YF;P         #3VYC
M94%G86EN       "1     )'971860       (P    "5V%R<%1E>'0   "@
H     E=I;F15<      !?     )';W1O3E-!     7@        #\G0 
 
end
SHAR_EOF
#	End of shell archive prin  ;