[net.micro.apple] PD Software

kamath@reed.UUCP (Sean Kamath) (02/10/86)

Well, there seems to be at least a few people interested in posting PD
software.  I can understand easily enogh how to post BASIC programs, but
what about ML programs?  I suppose you could send the source file, but
that might not be possible either from the fact it's not available or
for a funny assembler.  Come up with a good answer and I'm interested
(BASIC just isn't so hot anymore :-) ).  (I know Apple's but not to much
about VAX's & UN*X.)

For those of you that are interested in PD software, send me e-mail on
what you might be interested in.  If and when I get enough answers I'll
post to the net.  Possible things are disk zappers, file maintance,
graphics routine, ML number crunching routines, etc.

BTW:  If we do get this going, I hope it doesn't turn into net.sources.
Man, those people are going crazy :-)

Sean Kamath


-- 
________________________________________________________________________________

UUCP {ihnp4,decvax,ucbcad}!tektronix!reed!kamath

And I looked again
And the monster was me...

kamath@reed.UUCP (Sean Kamath) (02/25/86)

Soon, so soon, I shall be posting some PD software I wrote.  They are
for getting you existing programs (both Basic & ML) into text files in
order to be downloaded and uploaded.  A note on them.  It is important I
believe to load the text files into a wordprocessor and save them before
trying to exec them.  I tried to anyway with the DOS Kermit, and all I
got were errors untill I did this.  I'll send them as soon as I get a
modem hooked up to my apple at home (wouldn'tcha know they'd take out
the Apple from work the day I'm gonna upload...:-).

Sean Kamath

p.s.  Maybe this'll get people interested in posting thier little
programs of use....

-- 
________________________________________________________________________________

UUCP {ihnp4,decvax,ucbcad}!tektronix!reed!kamath

And I looked again
And the monster was me...

kamath@reed.UUCP (Sean Kamath) (02/26/86)

        Well, here it is.  I know you've all been hanging on the edge of
your seat waiting for this, and now it's here!!!
 
        First of all, I'd like to say that this is a direct response
from someone on the net about how to get downloadable programs onto the
net.  Is there some sort of BinHex for the ]['s?  I don't know.  I
figure that there most be some standard way of doing it.  I've been on
BBS's that have "mega downloads" but never gotten around to downloading
them.  I haven't got the expertise in that area.  What I do have the
ability to do is write the following assembly language program.  I got
the idea from a one-liner in Nibble Magazine and a similar program in
Open-Apple.  The original authors are Keith Stattenfield (Nibble Oct.
'85)  and I believe Tom Weishaar (Open-Apple Feb. 85).
 
        The Applesoft program came out of May '85 Open-Apple.  I didn't
exactly get permission to copy it, but it's one measly line and I doubt
anyone's gonna get upset about it.
 
        Anyway, I hope that this will encourage people to post their own
programs to the net for the benefit of others who either don't have a
program like that, didn't realize that that could be done, or didn't
know a neat trick. Grammar was never my strong point.
 
        Enough of my chattering, here they are.  Just cut 'em out,
download em, and exec them.
 
---------------------------------Cut-Here------------------------------------
0 D$=CHR$(4):POKE 33,33:INPUT "FILE NAME";F$:PRINT D$;"OPEN";F$:PRINT D$;"DELETE ";F$:PRINT D$;"OPEN";F$:PRINT D$;"WRITE";F$:PRINT "NEW":LIST 1,:PRINT D$;"CLOSE";F$:TEXT:END
 
 
RUN
---------------------------------Cut-Here------------------------------------
 
        Important, there should only be three carriage returns, two
after the end, and 1 after the run.  Then just exec this when you have
you program loaded.  It will save a text file with all the lines in it,
except line zero, in a sequential text file.
 
        This differs from the one in Open-Apple in that I deleted an
extra 'close' which was after the first 'open' command.  Also, I have it
print a 'new' at the beginning of the created text file.  This way, when
you EXEC the resulting text file, if you happen to have an already
resident applesoft program in memory, you don't get a hodgepodge of that
program with the one you're EXECing.
 
 
---------------------------------Cut-Here------------------------------------
 
 
                1    ********************************
                2    *                              *
                3    * MAKE EXEC                    *
                4    *                              *
                5    *------------------------------*
                6    * By   Sean Kamath             *
                7    * 395 Reed College             *
                8    * Portland, OR  97202          *
                9    *------------------------------*
                10   * A program to take a range    *
                11   * and make an execable file    *
                12   * from that range              *
                13   *------------------------------*
                14   * This program is in the       *
                15   * public domain.  2/23/86      *
                16   * Merlin-Pro Assembler         *
                17   ********************************
                18
                19   *-------------------------------
                20   * Note:  This program will not allow you to
                21   * make a text file out of any of the $Cx00 space.
                22   *-------------------------------
                23
                24   *-------------------------------
                25   * moniter routines
                26   *-------------------------------
                27
                28   PRBYTE   =     $FDDA      ; Print a hex byte
                29   PRNTYX   =     $F940      ; Print two hex bytes (Y,X)
                30   CROUT    =     $FD8E      ; Print a CR to the KSWL hook
                31   COUT     =     $FDED      ; Print accumulator to the hook
                32
                33   *-------------------------------
                34   * miscellaneous address equates
                35   *-------------------------------
                36
                37   YVEC     =     $3F8       ; ^Y vector
                38
                39   A1L      =     $FA        ; A1 is the start
                40   A1H      =     A1L+1      ; A2 is the end
                41   A2L      =     A1L+2      ; Normally these are $3C-3F
                42   A2H      =     A1H+2      ; But DOS uses these.
                43
                44   ADDRESS  =     $3C        ; The real start/stop locations
                45
                46   ASRUN    =     $76        ; Hibyte of AS line counter
                47   PROMPT   =     $33        ; Prompt character stored here
                48
                49   *-------------------------------
                50   * and whatever else is left
                51   *-------------------------------
                52
                53   SPACE    =     $A0        ; ASCII Space
                54   COLON    =     $BA        ; ASCII Colon
                55   LENGTH   =     %00001111  ; Mask for length
                56   SOFTS    =     $C0        ; Softswitch page
                57
                58
                59            ORG   $8000
                60
                61   *-------------------------------
                62   * Set the ^Y vector to the program and return
                63   *-------------------------------
                64
8000: A9 4C     65            LDA   #$4C       ; JMP opcode
8002: 8D F8 03  66            STA   YVEC       ; store it at ^Y vector
8005: A9 10     67            LDA   #BEGIN     ; vector to beginning of
8007: 8D F9 03  68            STA   YVEC+1     ; EXEC MAKER
800A: A9 80     69            LDA   #>BEGIN
800C: 8D FA 03  70            STA   YVEC+2
800F: 60        71            RTS
                72
                73   *-------------------------------
                74   * The program begins!!!
                75   *-------------------------------
                76
8010: A5 3C     77   BEGIN    LDA   ADDRESS    ; Move the starting address
8012: 85 FA     78            STA   A1L        ; out of DOS's way, otherwise
8014: A5 3D     79            LDA   ADDRESS+1  ; they get clobbered and we
8016: 85 FB     80            STA   A1H        ; only get $40 bytes put out.
8018: A5 3E     81            LDA   ADDRESS+2  ; Likewise the ending address.
801A: 85 FC     82            STA   A2L
801C: A5 3F     83            LDA   ADDRESS+3
801E: 85 FD     84            STA   A2H
                85
                86   *-------------------------------
                87   * Get ready to fool DOS into thinking Applesloth
                88   * is running in order to use the open and write commands.
                89   *-------------------------------
                90   * This is done by setting the hibyte of the applesoft
                91   * program line counter to something other than $FF.
                92   * Also, the applesoft prompt must not be ']'.
                93   *-------------------------------
                94
8020: A9 0A     95            LDA   #10        ; Something other than $FF & $DD
8022: 85 76     96            STA   ASRUN      ; (ASCII ']') stored in these
8024: 85 33     97            STA   PROMPT     ; addresses fool DOS.
                98
                99   *-------------------------------
                100  * DOS now fooled, so issue the open and write commands
                101  *-------------------------------
                102
8026: A2 00     103           LDX   #00        ; Get ready to send the commands
8028: BD 35 80  104  LOOP     LDA   DATA,X     ; to DOS.
802B: 20 ED FD  105           JSR   COUT
802E: E8        106           INX
802F: E0 37     107           CPX   #DOIT-DATA
8031: D0 F5     108           BNE   LOOP       ; Keep going 'til they're done.
8033: F0 37     109           BEQ   DOIT       ; (always taken)
8035: 8D 84     110  DATA     HEX   8D84
8037: CF D0 C5  111           ASC   "OPEN EFILE"8D
803A: CE A0 C5
803D: C6 C9 CC
8040: C5 8D
8042: 8D 84     112           HEX   8D84
8044: C4 C5 CC  113           ASC   "DELETE EFILE"8D
8047: C5 D4 C5
804A: A0 C5 C6
804D: C9 CC C5
8050: 8D
8051: 8D 84     114           HEX   8D84
8053: CF D0 C5  115           ASC   "OPEN EFILE"8D
8056: CE A0 C5
8059: C6 C9 CC
805C: C5 8D
805E: 8D 84     116           HEX   8D84
8060: D7 D2 C9  117           ASC   "WRITE EFILE"8D
8063: D4 C5 A0
8066: C5 C6 C9
8069: CC C5 8D
                118
                119  *-------------------------------
                120  * Write the desired address range out to disk!
                121  *-------------------------------
                122
806C: 20 B1 80  123  DOIT     JSR   PRA1       ; A modified monitor routine.
                124
                125  *-------------------------------
                126  * Check for softswitch range and avoid if found.
                127  *-------------------------------
                128
806F: A5 FB     129           LDA   A1H        ; Load start HI
8071: C9 C0     130           CMP   #SOFTS     ; Compare to softswitch area
8073: D0 02     131           BNE   HOP        ; if not, OK
8075: E6 FB     132           INC   A1H        ; if so, then clear area
                133
                134  *-------------------------------
                135  * The following is the actual write routine.
                136  *-------------------------------
                137
8077: A0 00     138  HOP      LDY   #00
8079: B1 FA     139           LDA   (A1L),Y    ; Print a byte
807B: 20 DA FD  140           JSR   PRBYTE
807E: A9 A0     141           LDA   #SPACE     ; Print a space
8080: 20 ED FD  142           JSR   COUT
8083: 20 C2 80  143           JSR   NXTA1      ; A modified monitor routine.
8086: B0 09     144  OK       BCS   EXIT       ; Exit if done with range
8088: A5 FA     145           LDA   A1L        ; Check the lobyte of the range
808A: 29 0F     146           AND   #LENGTH    ; if ending in $xxx0 then do CR.
808C: D0 E9     147           BNE   HOP
808E: 4C 6C 80  148           JMP   DOIT       ; Keep going 'til range finished
                149
                150  *-------------------------------
                151  * After finishing range, then close the file
                152  *-------------------------------
                153
8091: A2 00     154  EXIT     LDX   #00        ; Get ready to send the 'close'
8093: BD A0 80  155  LOOP2    LDA   DATA2,X    ; command.
8096: 20 ED FD  156           JSR   $FDED
8099: E8        157           INX
809A: E0 0E     158           CPX   #LEAVE-DATA2
809C: D0 F5     159           BNE   LOOP2      ; Keep going 'til done.
809E: F0 0E     160           BEQ   LEAVE      ; (always taken)
80A0: 8D 84     161  DATA2    HEX   8D84
80A2: C3 CC CF  162           ASC   "CLOSE EFILE"8D
80A5: D3 C5 A0
80A8: C5 C6 C9
80AB: CC C5 8D
80AE: 4C D0 03  163  LEAVE    JMP   $3D0       ; Return to DOS!
                164
                165  *-------------------------------
                166  * A modified PRA1
                167  *-------------------------------
                168
80B1: A4 FB     169  PRA1     LDY   A1H        ; This is PRA1 from the
80B3: A6 FA     170           LDX   A1L        ; monitor, rewritten to
80B5: 20 8E FD  171           JSR   CROUT      ; print the address and a colon
80B8: 20 40 F9  172           JSR   PRNTYX     ; rather than the standard dash.
80BB: A0 00     173           LDY   #$00
80BD: A9 BA     174           LDA   #COLON
80BF: 4C ED FD  175           JMP   COUT       ; Use the RTS after COUT.
                176
                177  *-------------------------------
                178  * This is a modified monitor routine called NXTA1.
                179  * This allows incrementing $FA-FD instead of $3C-3F
                180  *-------------------------------
                181
80C2: A5 FA     182  NXTA1    LDA   A1L        ; this is the monitor subroutine
80C4: C5 FC     183           CMP   A2L        ; rewritten to use my A1 & A2
80C6: A5 FB     184           LDA   A1H        ; rather than $3C-3F
80C8: E5 FD     185           SBC   A2H        ; called NXTA1
80CA: E6 FA     186           INC   A1L        ; Carry set if done with range.
80CC: D0 B8     187           BNE   OK
80CE: E6 FB     188           INC   A1H
80D0: 60        189           RTS
 
 
--End assembly, 209 bytes, Errors: 0
 
 
Symbol table - alphabetical order:
 
   A1H     =$FB        A1L     =$FA        A2H     =$FD        A2L     =$FC
   ADDRESS =$3C        ASRUN   =$76        BEGIN   =$8010      COLON   =$BA
   COUT    =$FDED      CROUT   =$FD8E      DATA    =$8035      DATA2   =$80A0
   DOIT    =$806C      EXIT    =$8091      HOP     =$8077      LEAVE   =$80AE
   LENGTH  =$0F        LOOP    =$8028      LOOP2   =$8093      NXTA1   =$80C2
   OK      =$8086      PRA1    =$80B1      PRBYTE  =$FDDA      PRNTYX  =$F940
   PROMPT  =$33        SOFTS   =$C0        SPACE   =$A0        YVEC    =$03F8
 
 
 
Symbol table - numerical order:
 
   LENGTH  =$0F        PROMPT  =$33        ADDRESS =$3C        ASRUN   =$76
   SPACE   =$A0        COLON   =$BA        SOFTS   =$C0        A1L     =$FA
   A1H     =$FB        A2L     =$FC        A2H     =$FD        YVEC    =$03F8
   BEGIN   =$8010      LOOP    =$8028      DATA    =$8035      DOIT    =$806C
   HOP     =$8077      OK      =$8086      EXIT    =$8091      LOOP2   =$8093
   DATA2   =$80A0      LEAVE   =$80AE      PRA1    =$80B1      NXTA1   =$80C2
   PRNTYX  =$F940      CROUT   =$FD8E      PRBYTE  =$FDDA      COUT    =$FDED
 
 
The following is the routine performed on itself.
To get it running, just trim off the junk (namely this and any trailers)
and save it as a text file.  Then EXEC it.
 
NOTE:  I added the "call -151" and the "BSAVE MAKE EXEC,A$8000,L$D1"
 
------------------------------CUT-HERE-----------------------------------------
 
CALL -151
 
8000:A9 4C 8D F8 03 A9 10 8D F9 03 A9 80 8D FA 03 60 
8010:A5 3C 85 FA A5 3D 85 FB A5 3E 85 FC A5 3F 85 FD 
8020:A9 0A 85 76 85 33 A2 00 BD 35 80 20 ED FD E8 E0 
8030:37 D0 F5 F0 37 8D 84 CF D0 C5 CE A0 C5 C6 C9 CC 
8040:C5 8D 8D 84 C4 C5 CC C5 D4 C5 A0 C5 C6 C9 CC C5 
8050:8D 8D 84 CF D0 C5 CE A0 C5 C6 C9 CC C5 8D 8D 84 
8060:D7 D2 C9 D4 C5 A0 C5 C6 C9 CC C5 8D 20 B1 80 A5 
8070:FB C9 C0 D0 02 E6 FB A0 00 B1 FA 20 DA FD A9 A0 
8080:20 ED FD 20 C2 80 B0 09 A5 FA 29 0F D0 E9 4C 6C 
8090:80 A2 00 BD A0 80 20 ED FD E8 E0 0E D0 F5 F0 0E 
80A0:8D 84 C3 CC CF D3 C5 A0 C5 C6 C9 CC C5 8D 4C D0 
80B0:03 A4 FB A6 FA 20 8E FD 20 40 F9 A0 00 A9 BA 4C 
80C0:ED FD A5 FA C5 FC A5 FB E5 FD E6 FA D0 B8 E6 FB 
80D0:60 00 
 
BSAVE MAKE EXEC,A$8000,L$D1
 
------------------------------CUT-HERE-----------------------------------------
 
Well, enjoy these.  Send any bug reports to me at
 
{ihnp4,decvax,ucbcad}!tektronix!reed!kamath
 
Sean Kamath
 
The Apple // Forever!!!!!!!!!!!!!!
-- 
________________________________________________________________________________

UUCP {ihnp4,decvax,ucbcad}!tektronix!reed!kamath

And I looked again
And the monster was me...