;ProfiPacket - packet radio terminal program
;Copyright (C) 1999  Alexander Feigl
;
;This program is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
;the Free Software Foundation; either version 2 of the License, or
;(at your option) any later version.
;
;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.
;
;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
;
;Author:
;
;Alexander Feigl
;Burachstraße 51
;
;D-88250 Weingarten
;
;EMail : Alexander.Feigl@gmx.de

                CPU M68000
                SNMAOPT Q+,P+,A+,B-,S+,M+,E+
                nolist
                
AJUMP                   MACRO
                        dc.w $4ef9
                        dc.l \1
                        ENDM
                
                        incdir "sys:include/"
                        include "exec/exec_lib.i"
                        include "libraries/dos_lib.i"
                        include "utility/utility_lib.i"
                        include "libraries/dos.i"
                        include "/global.i"
                                
_Nil                    moveq #0,d0
                        rts
                        dc.b "ProfCmds"
                
                
                        dc.l ABR_Name
                        dc.l 1
                        dc.l ABR_Init
                        dc.l A7P_Head
                        dc.l 1                  ;Subtype (Bit 0=Fileaccess write)

A7P_Head                dc.l A7P_Name
                        dc.l 1
                        dc.l A7P_Init
                        dc.l ABS_Head
                        dc.l 1                  ;Subtype (Bit 0=Fileaccess write)

ABS_Head                dc.l ABS_Name
                        dc.l 1
                        dc.l ABS_Init
                        dc.l DIR_Head
                        dc.l 2                  ;Subtype (Bit 1=Fileaccess read)

DIR_Head                dc.l DIR_Name
                        dc.l 1
                        dc.l DIR_Init
                        dc.l DIR_Head_2
                        dc.l 4                  ;Subtype (Bit 2=Fileaccess examine)

DIR_Head_2              dc.l DIR_Name_2
                        dc.l 1
                        dc.l DIR_Init
                        dc.l CD_Head
                        dc.l 4                  ;Subtype (Bit 2=Fileaccess examine)

CD_Head                 dc.l CD_Name
                        dc.l 1
                        dc.l CD_Init
                        dc.l RT_Head_Bin
                        dc.l 4                  ;Subtype (Bit 2=Fileaccess examine)

RT_Head_Bin             dc.l RB_Name
                        dc.l 1
                        dc.l RT_Init_Bin
                        dc.l RT_Head_Plus
                        dc.l 2                  ;Subtype (Bit 1=Fileaccess read)

RT_Head_Plus            dc.l R7_Name
                        dc.l 1
                        dc.l RT_Init_Plus
                        dc.l RT_Head
                        dc.l 2                  ;Subtype (Bit 1=Fileaccess read)


RT_Head                 dc.l RT_Name
                        dc.l 1
                        dc.l RT_Init
                        dc.l RT_Head_2
                        dc.l 2                  ;Subtype (Bit 1=Fileaccess read)

RT_Head_2               dc.l RT_Name_2
                        dc.l 1
                        dc.l RT_Init
                        dc.l WT_Head
                        dc.l 2                  ;Subtype (Bit 1=Fileaccess read)

WT_Head                 dc.l WT_Name
                        dc.l 1
                        dc.l WT_Init
                        dc.l WT_Head_2
                        dc.l 1                  ;Subtype (Bit 0=Fileaccess write)

WT_Head_2               dc.l WT_Name_2
                        dc.l 1
                        dc.l WT_Init
                        dc.l WB_Head
                        dc.l 1                  ;Subtype (Bit 1=Fileaccess write)

WB_Head                 dc.l WB_Name
                        dc.l 1
                        dc.l WT_Init_Bin
                        dc.l WTA_Head
                        dc.l 1                  ;Subtype (Bit 1=Fileaccess write)

WTA_Head                dc.l WTA_Name
                        dc.l 1
                        dc.l WT_Init_Amiga
                        dc.l WAB_Head
                        dc.l 1                  ;Subtype (Bit 1=Fileaccess write)
WAB_Head                dc.l WAB_Name
                        dc.l 1
                        dc.l WT_Init_AutoBin
                        dc.l W7P_Head
                        dc.l 1                  ;Subtype (Bit 1=Fileaccess write)
W7P_Head                dc.l W7P_Name
                        dc.l 1
                        dc.l WT_Init_7Plus
                        dc.l 0
                        dc.l 1                  ;Subtype (Bit 1=Fileaccess write)





                        
ABR_Name                dc.b "Autobin Save Server",0
A7P_Name                dc.b "7plus Save Server",0
ABS_Name                dc.b "RP",$1,"RG",0
DIR_Name                dc.b "DIR",$1,"ECTORY",0
DIR_Name_2              dc.b "CAT",$1,"ALOG",0
CD_Name                 dc.b "CD",$1,"IR",0
RB_Name                 dc.b "RB",$1,"INARY",0
R7_Name                 dc.b "R7",$1,"PLUS",0
RT_Name                 dc.b "RT",$1,"EXT",0
RT_Name_2               dc.b "R",$1,"EAD",0
WT_Name                 dc.b "WT",$1,"EXT",0
WT_Name_2               dc.b "W",$1,"RITE",0
WB_Name                 dc.b "WB",$1,"INARY",0
WTA_Name                dc.b "WTA",$1,"MIGA",0
WAB_Name                dc.b "WP",$1,"RG",0
W7P_Name                dc.b "W7",$1,"PLUS",0
                        even

ABR_Init                movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l a3,a6
                        move.l #ABR_Functions-ABR_FunctionsBegin,d0
                        move.l #abr_Size,d1
                        lea ABR_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,abr_QSOBase(a6)
                        move.l d7,abr_OldServer(A6)
                        move.l d6,abr_Channel(a6)
                        move.l a4,abr_ThisQSO(a6)
                        move.l a2,abr_Parameter(A6)
                        move.l a6,qso_Server(a4)


                        move.l abr_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .Error_Serv
                        GOQSO ConvertToAmiga
                        move.l abr_Parameter(a6),a0
                        cmp.b #"#",(a0)
                        bne .Error_Serv
                        cmp.b #"B",1(a0)
                        bne .Error_Serv
                        cmp.b #"I",2(a0)
                        bne .Error_Serv
                        cmp.b #"N",3(a0)
                        bne .Error_Serv
                        cmp.b #"#",4(a0)
                        bne .Error_Serv
                        
                        move.l abr_ThisQSO(a6),a0
                        tst.l qso_TransferMode(a0)
                        beq .No_Other_Transmit
                        tst.l qso_OnlyPrepared(a0)
                        beq .Other_Transmit
                        cmp.l #1,qso_TransferMode(a0)
                        bne .Other_Transmit
.No_Other_Transmit      move.l a2,a0
                        bsr ABR_ParseLine
                        tst.l d0
                        bne .Error_Serv
                        move.l abr_Parameter(a6),a0
                        clr.b (a0)
                        tst.l abr_BadFileMode(a6)
                        beq .No_BadFileStr
                        bsr ABR_HandleBadFile
.No_BadFileStr          
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_OkString,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        bsr ABR_ReceivePacket
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.Other_Transmit         moveq #0,d0
                        bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_RejectString,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        cmpa.l #0,a4
                        beq .Error_Serv_3
                        move.l d2,-(sp)
                        move.l a4,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           
                        move.l abr_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abr_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abr_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr ABR_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts

ABR_Cleanup_Out         movem.l d2-d3/a2-a3/d7,-(sp)
                        tst.l abr_BytesInBuffer(a6)
                        beq .No_FinishTrans
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d2
                        move.l abr_ThisQSO(A6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BytesInBuffer(a6),d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOWrite(a6)
                        move.l (sp)+,a6
                        cmp.l abr_BytesInBuffer(a6),d0
                        bne .Transfer_Error
.No_FinishTrans         move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(A0),d1
                        clr.l qso_FileID(a0)
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        movem.l (sp)+,d2-d3/d7/a2-a3
                        move.l abr_ThisQSO(a6),a0
                        GOQSO SetFileInfos
.Transfer_Error         bra ABR_Cleanup

ABR_Cleanup             move.l abr_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abr_OldServer(a6),d0
                        move.l abr_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #ABR_Functions-ABR_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts

ABR_ConnectProced       rts

ABR_HandleBadFile       movem.l d2-d7/a2-a6,-(sp)
                        sub.l #64,a7
                        move.l abr_BadFilePointer(a6),d0
                        sub.l abr_BadFileBackStep(a6),d0
                        tst.l d0
                        bge .Good_Pointer
                        moveq #0,d0
.Good_Pointer           move.l d0,abr_BadFilePointer(a6)
                        tst.l abr_BadFilePointer(a6)
                        beq .Give_Up
                        move.l abr_ThisQSO(a6),a0
                        lea qso_FileName(a0),a0
                        move.l abr_BadFilePointer(a6),d0
                        GOQSO CRCFileUntil
                        cmp.l #-1,d0
                        beq .Give_Up
                        move.l d0,abr_BadFileCRC(a6)
                        move.l abr_BadFilePointer(a6),d0
                        lsr.l #4,d0
                        cmp.l #128,d0
                        bge .Good_Backstep
                        move.l #128,d0
.Good_Backstep          add.l d0,abr_BadFileBackStep(a6)
                        
                        move.l a7,a0
                        move.l #"#CRC",(a0)+
                        move.w #"?#",(a0)+
                        move.l abr_BadFilePointer(a6),d0
                        GOQSO LongToString
                        move.l a7,a0
.SearchEnd              tst.b (a0)+
                        bne .SearchEnd
                        subq.l #1,a0
                        move.b #$d,(a0)+
                        clr.b (a0)+
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l a7,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        add.l #64,a7
                        movem.l (sp)+,d2-d7/a2-a6
                        rts
.Give_Up                add.l #64,a7
                        movem.l (sp)+,d2-d7/a2-a6
                        bsr ABR_GiveUpBadfile
                        rts

ABR_GiveUpBadfile       movem.l d2-d7/a2-a6,-(sp)
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(a0),d1
                        moveq #0,d2
                        moveq #-1,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOSetFileSize(a6)
                        move.l (sp)+,a6
                        clr.l abr_BadFileMode(a6)
                        tst.l abr_BadFileBackStep(a6)
                        beq .No_Message
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_GiveUpString,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abr_Channel(A6),a0
                        GOQSO ForceTransmit
.No_Message             clr.l abr_BadFileMode(a6)
                        movem.l (sp)+,d2-d7/a2-a6
                        rts
                        
                        
ABR_ParseLine           movem.l d2-d7/a2-a6,-(sp)
                        clr.l abr_BadFileMode(a6)
                        move.l #1,abr_ExternFilename(a6)
                        move.l abr_ThisQSO(a6),a3
                        move.l a0,a4
                        lea 5(a4),a4
                        clr.l -(sp)
                        move.l sp,d2
                        move.l a4,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOStrToLong(a6)
                        move.l (Sp)+,a6
                        move.l (sp)+,d1
                        tst.l d0
                        ble .Error
                        move.l d1,qso_TransferTotBytes(a3)
                        add.l d0,a4
.MainParse_Loop         tst.b (A4)
                        beq .Line_Parsed
                        cmp.b #"#",(A4)
                        bne .Error
                        addq.l #1,a4
                        cmp.b #"|",(A4)
                        beq .Parse_CRC
                        cmp.b #"$",(A4)
                        beq .Parse_FileDate
                        tst.b (a4)
                        beq .Line_Parsed
                        bra .Parse_Path
.Parse_CRC              addq.l #1,a4
                        clr.l -(sp)
                        move.l sp,d2
                        move.l a4,d1
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOStrToLong(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        tst.l d0
                        ble .Error
                        move.l d1,qso_TransferCRC(a3)
                        add.l d0,a4
                        bra .MainParse_Loop
.Parse_FileDate         addq.l #1,a4
                        moveq #0,d1
                        moveq #7,d2
.Parse_FileDate_L       bsr .RHex
                        cmp.l #-1,d0
                        beq .Error
                        asl.l #4,d1
                        or.b d0,d1
                        dbf d2,.Parse_FileDate_L
                        move.l d1,d0
                        lea qso_TransferFileDate(a3),a0
                        GOQSO MsDateAmiga
                        cmp.b #"?",(A4)
                        bne .MainParse_Loop
                        addq.l #1,a4
                        bra .MainParse_Loop                     
.Parse_Path             tst.b qso_FileName(a3)
                        bne .Line_Parsed
                        clr.l abr_ExternFilename(a6)
                        move.l a4,a0
                        move.l a4,a2
.Parse_Path_L           tst.b (a0)
                        beq .Parse_Path_Done
                        move.b (a0)+,d0
                        cmp.b #92,d0        ;Backslash - C Preproc compat
                        beq .Parse_Path_Sub
                        cmp.b #"/",d0
                        beq .Parse_Path_Sub
                        cmp.b #":",d0
                        beq .Parse_Path_Sub
                        bra .Parse_Path_L
.Parse_Path_Sub         move.l a0,a2
                        bra .Parse_Path_L
.Parse_Path_Done        move.l abr_ThisQSO(a6),a0
                                        GOQSO GetSaveDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Parse_Path_Copy        move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Parse_Path_Copy
                        move.l a2,d2
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        cmp.l #-1,d0
                        bne .Parse_Path_Wrong
.Test_Incomplete        lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        movem.l a2/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        movem.l (Sp)+,a6/a2
                        tst.l d0
                        beq .Parse_Path_OK
                        move.l d0,d1
                        move.l d1,-(sp)
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        move.l a0,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOExamine(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        move.l d0,-(sp)
                        
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (Sp)+,a6
                        move.l (sp)+,d0
                        tst.l d0
                        beq .Parse_Path_Wrong
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        lea fib_Comment(a0),a0
.Parse_For_BadFile      tst.b (a0)
                        beq .Parse_Path_Wrong
                        cmp.b #" ",(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"B",1(a0)
                        beq .Parse_For_BADCRC
                        cmp.b #"I",1(a0)
                        beq .Parse_For_INCOMP
                        bra .Parse_For_BadFile_N
.Parse_For_BADCRC       cmp.b #"A",2(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"D",3(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",4(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"R",5(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",6(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"!",7(a0)
                        bne .Parse_For_BadFile_N
                        bra .BadFile_Idented
.Parse_For_INCOMP       cmp.b #"N",2(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",3(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"O",4(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"M",5(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"P",6(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"!",7(a0)
                        bne .Parse_For_BadFile_N
                        bra .BadFile_Idented
.Parse_For_BadFile_N    addq.l #1,a0
                        bra .Parse_For_BadFile
.BadFile_Idented        move.l #1,abr_BadFileMode(a6)
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        move.l fib_Size(a0),abr_BadFilePointer(a6)
                        clr.l abr_BadFileBackStep(a6)
                        bra .Parse_Path_OK
.Parse_Path_Wrong       tst.l abr_ExternFilename(a6)
                        bne .Error
                        clr.b qso_FileName(a3)
                        bra .Line_Parsed
.Parse_Path_OK          clr.l abr_ExternFilename(a6)
                        bra .Line_Parsed

.RHex                   move.b (a4)+,d0
                        cmp.b #$30,d0
                        blt .RHexError
                        cmp.b #$46,d0
                        bgt .RHexError
                        cmp.b #$41,d0
                        bge .RHexGood_Lett
                        cmp.b #$39,d0
                        bgt .RHexError
                        and.l #$f,d0
                        rts
.RHexGood_Lett          sub.b #$37,d0
                        and.l #$ff,d0
                        rts
.RHexError              moveq #-1,d0
                        rts
                        
.Line_Parsed            tst.b qso_FileName(a3)
                        bne .Filename_Available
                        move.l #2,abr_ExternFilename(a6)
                        moveq #1,d6

.Tryafile               move.l abr_ThisQSO(a6),a0
                                GOQSO GetSaveDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Tryafile_CopDir        move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Tryafile_CopDir
                        sub.l #16,a7
                        move.l a7,a1
                        lea qso_Call(a3),a0
.Tryafile_CopCall       cmp.b #"-",(a0)
                        beq .Tryafile_CopCallEn
                        tst.b (a0)
                        beq .Tryafile_CopCallEn
                        move.b (a0)+,(a1)+
                        bra .Tryafile_CopCall
.Tryafile_CopCallEn     move.b #".",(a1)+
                        move.l d6,d0
                        divu #100,d0
                        move.l d0,d1
                        and.l #$f,d0
                        or.b #$30,d0
                        move.b d0,(a1)+
                        swap d1
                        move.w d1,d0
                        divu #10,d0
                        or.l #$00300030,d0
                        move.b d0,(A1)+
                        swap d0
                        move.b d0,(a1)+
                        clr.b (a1)+
                        move.l a7,d2
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (Sp)+,a6
                        add.l #16,a7
                        cmp.l #-1,d0
                        bne .Error
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (Sp)+,a6
                        tst.l d0
                        beq .Filename_Available
                        move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (Sp)+,a6
                        addq.l #1,d6
                        cmp.l #1000,d6
                        bge .Error
                        bra .Tryafile
.Filename_Available     tst.l abr_ExternFilename(a6)
                        bne .Test_Incomplete
                        move.l #1,qso_TransferMode(a3)
                        lea qso_TransferStart(a3),a0
                        move.l a0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateStamp(A6)
                        move.l (sp)+,a6
                        clr.l qso_TransferRBytes(a3)
                        clr.l qso_TransferBytes(a3)
                        clr.l qso_OnlyPrepared(A3)
                        move.l #1,qso_WriteMode(a3)
                        tst.l abr_BadFileMode(a6)
                        beq .No_BadFileOpen
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l #1005,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .Error
                        bra .BadFile_Opened
.No_BadFileOpen         lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .Good_NonExist
                        move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6                 
                        bra .Error
.Good_NonExist          lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l #1006,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .Error
.BadFile_Opened         move.l d0,qso_FileID(a3)
                        clr.l abr_BytesInBuffer(a6)
                        move.l abr_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        moveq #0,d0
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
.Error                  moveq #-1,d0
                        bra .Exit
ABR_ReceivePacket       move.l abr_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_TransferTotBytes(a0),d1
                        sub.l qso_TransferBytes(a0),d1
                        cmp.l d1,d0
                        blt .No_WholeTrans
                        move.l d1,d0
.No_WholeTrans          cmp.l #256,d0
                        ble .No_FullPacket
                        move.l #256,d0
.No_FullPacket          lea abr_PacketBuffer(a6),a0
                        move.l a0,abr_PacketPointer(a6)
                        move.l abr_ThisQSO(A6),a1
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,abr_BytesInPacket(a6)
                        cmp.l #8,d0
                        bne .No_AbortPacket
                        lea abr_PacketBuffer(a6),a0
                        cmp.b #"#",(a0)
                        bne .No_AbortPacket
                        cmp.b #"A",1(a0)
                        bne .No_AbortPacket
                        cmp.b #"B",2(a0)
                        bne .No_AbortPacket
                        cmp.b #"O",3(a0)
                        bne .No_AbortPacket
                        cmp.b #"R",4(a0)
                        bne .No_AbortPacket
                        cmp.b #"T",5(a0)
                        bne .No_AbortPacket
                        cmp.b #"#",6(a0)
                        bne .No_AbortPacket
                        cmp.b #$0D,7(a0)
                        bne .No_AbortPacket
                        bra .Abort_Server_Out
                        
.No_AbortPacket         move.l abr_BytesInPacket(a6),d0
                        cmp.l #4,d0
                        blt .No_InWrite_Packet
                        lea abr_PacketBuffer(a6),a0
                        cmp.b #"S",(a0)
                        bne .No_InWrite_Packet
                        cmp.b #"P",1(a0)
                        bne .No_InWrite_Packet
                        cmp.b #92,2(a0)        ;Backslash
                        bne .No_InWrite_Packet
                        cmp.b #"-",3(a0)
                        bne .No_InWrite_Packet
                        movem.l d2-d7/a2-a6,-(sp)
                        move.l abr_BytesInPacket(a6),d7
                        lea abr_PacketBuffer(a6),a4
                        subq.l #4,d7
                        addq.l #4,a4
.InWrite_Packet_L       tst.l d7
                        beq .InWrite_Packet_L_NextGather
                        move.l d7,d0
                        move.l abr_Channel(a6),d1
                        move.l a4,a0
                        GOQSO WriteTerminal
.InWrite_Packet_L_NextGather
                        move.l abr_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit_InlineWrite
                        cmp.l #256,d0
                        ble .No_FullInWrite
                        move.l #256,d0
.No_FullInWrite         lea abr_PacketBuffer(a6),a0
                        move.l a0,abr_PacketPointer(a6)
                        move.l abr_ThisQSO(A6),a1
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit_InlineWrite
                        move.l d0,d7
                        lea abr_PacketBuffer(a6),a4
                        bra .InWrite_Packet_L
.Exit_InlineWrite       movem.l (sp)+,d2-d7/a2-a6
                        bra .Exit
                        
.No_InWrite_Packet      tst.l abr_BadFileMode(a6)
                        beq .No_BadFilePac
                        lea abr_PacketBuffer(a6),a0
                        cmp.b #"#",(a0)
                        bne .No_BadFilePac_X
                        cmp.b #"C",1(a0)
                        bne .No_BadFilePac_X
                        cmp.b #"R",2(a0)
                        bne .No_BadFilePac_X
                        cmp.b #"C",3(a0)
                        bne .No_BadFilePac_X
                        cmp.b #"!",4(a0)
                        bne .No_BadFilePac_X
                        cmp.b #"#",5(a0)
                        bne .No_BadFilePac_X
                        movem.l d2-d7/a2-a5,-(sp)
                        clr.l -(sp)
                        move.l sp,d2
                        lea 6(a0),a0
                        move.l a0,d1
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOStrToLong(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        movem.l (sp)+,d2-d7/a2-a5
                        tst.l d0
                        ble .No_BadFilePac_X
                        cmp.l abr_BadFileCRC(a6),d1
                        beq .BadFile_GOOD
                        bsr ABR_HandleBadFile
                        bra ABR_ReceivePacket
.BadFile_GOOD           movem.l d2-d7/a2-a6,-(sp)
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BadFilePointer(a6),d2
                        moveq #-1,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOSetFileSize(a6)
                        move.l (sp)+,a6
                        cmp.l #-1,d0
                        beq .BadFile_D
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BadFilePointer(a6),d2
                        moveq #-1,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOSeek(a6)
                        move.l (sp)+,a6
                        cmp.l #-1,d0
                        beq .BadFile_D
                        sub.l #64,a7
                        move.l a7,a0
                        move.l #"#CON",(a0)+
                        move.w #"T#",(a0)+
                        move.l abr_BadFilePointer(a6),d0
                        GOQSO LongToString
                        move.l a7,a0
.SearchEnd              tst.b (a0)+
                        bne .SearchEnd
                        subq.l #1,a0
                        move.b #$d,(a0)+
                        clr.b (a0)+
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l a7,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        add.l #64,a7
                        
                        movem.l (sp)+,d2-d7/a2-a6
                        move.l abr_BadFilePointer(a6),d0
                        move.l abr_ThisQSO(a6),a0
                        move.l d0,qso_TransferBytes(a0)
                        move.l d0,qso_TransferRBytes(a0)
                        move.l d0,qso_TransferOffset(a0)
                        clr.l abr_BadFileMode(a6)
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_TransferTotBytes(a0),d0
                        sub.l qso_TransferBytes(a0),d0
                        tst.l d0
                        beq .Fullfilled_Transfer
                        move.l abr_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        bra ABR_ReceivePacket
.BadFile_D              movem.l (sp)+,d2-d7/a2-a6
                        bsr ABR_GiveUpBadfile
                        bra ABR_ReceivePacket
.No_BadFilePac_X        clr.l abr_BadFileBackStep(a6)
                        bsr ABR_GiveUpBadfile
.No_BadFilePac                          
.ABR_ReceiveLoop        move.l abr_BytesInPacket(a6),d0
                        tst.l d0
                        beq ABR_ReceivePacket
                        move.l #4096,d1
                        sub.l abr_BytesInBuffer(a6),d1
                        cmp.l d1,d0
                        blt .No_WholeTrans_2
                        move.l d1,d0
.No_WholeTrans_2        
                        lea abr_FileBuffer(a6),a0
                        add.l abr_BytesInBuffer(a6),a0
                        move.l abr_PacketPointer(a6),a1
                        move.l d0,d1
                        tst.l d0
                        beq .NoCopy
.Copy_Bufferision       move.b (A1)+,(a0)+
                        subq.l #1,d1
                        bne .Copy_Bufferision
.NoCopy                 add.l d0,abr_PacketPointer(a6)
                        sub.l d0,abr_BytesInPacket(a6)
                        tst.l d0
                        beq .Exit
                        movem.l d2-d3/a2-a3/d7,-(sp)
                        move.l d0,d7
                        add.l d7,abr_BytesInBuffer(a6)
                        move.l abr_ThisQSO(a6),a0
                        add.l d7,qso_TransferBytes(a0)
                        add.l d7,qso_TransferRBytes(a0)
                        move.l abr_BytesInBuffer(a6),d0
                        cmp.l #4096,d0
                        blt .No_FullBuffer
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d2
                        move.l abr_ThisQSO(A6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BytesInBuffer(a6),d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOWrite(a6)
                        move.l (sp)+,a6
                        cmp.l abr_BytesInBuffer(a6),d0
                        bne .Transfer_Error
                        clr.l abr_BytesInBuffer(a6)                     
.No_FullBuffer          movem.l (sp)+,d2-d3/d7/a2-a3
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_TransferTotBytes(a0),d0
                        sub.l qso_TransferBytes(a0),d0
                        tst.l d0
                        beq .Fullfilled_Transfer
                        bra .ABR_ReceiveLoop
                        
.Transfer_Error         movem.l (sp)+,d2-d3/d7/a2-a3
                        bra .Abort_Server
                
.Exit                   move.l abr_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        rts
.Fullfilled_Transfer    movem.l d2-d3/a2-a3/d7,-(sp)
                        tst.l abr_BytesInBuffer(a6)
                        beq .No_FinishTrans
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d2
                        move.l abr_ThisQSO(A6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BytesInBuffer(a6),d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOWrite(a6)
                        move.l (sp)+,a6
                        cmp.l abr_BytesInBuffer(a6),d0
                        bne .Transfer_Error
.No_FinishTrans         move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(A0),d1
                        clr.l qso_FileID(a0)
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        movem.l (sp)+,d2-d3/d7/a2-a3
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(A0)
                        GOQSO SetFileInfos
                        bsr FILETR_DisplayInfo
                        move.l abr_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abr_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr ABR_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit_Sv
                        jsr _SVOReceivePacket(A6)
.Exit_Sv                rts

.Abort_Server           bsr ABR_AbortServer
                        rts
.Abort_Server_Out       bsr ABR_AbortServer_Out
                        rts
                        
ABR_DoPoll              move.l abr_Channel(A6),d0
                        GOQSO RecalcFileTransfer
                        move.l abr_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        rts

ABR_TerminalInput
                        move.l abr_Channel(A6),d1

                        movem.l d0/d1/a0,-(sp)
                        GOQSO TransmitData
                        movem.l (sp)+,d0/d1/a0
                        moveq #2,d2
                        GOQSO WriteTerminalUni

                        rts     


ABR_GetServerType       moveq #1,d0
                        rts

ABR_AbortServer         move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_AbortString,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
ABR_AbortServer_Uni     movem.l d2-d3/a2-a3/d7,-(sp)
                        tst.l abr_BytesInBuffer(a6)
                        beq .No_FinishTrans
                        lea abr_FileBuffer(a6),a0
                        move.l a0,d2
                        move.l abr_ThisQSO(A6),a0
                        move.l qso_FileID(a0),d1
                        move.l abr_BytesInBuffer(a6),d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOWrite(a6)
                        move.l (sp)+,a6
                        cmp.l abr_BytesInBuffer(a6),d0
                        bne .Transfer_Error
.No_FinishTrans         move.l abr_ThisQSO(a6),a0
                        move.l qso_FileID(A0),d1
                        clr.l qso_FileID(a0)
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        movem.l (sp)+,d2-d3/d7/a2-a3
                        move.l abr_ThisQSO(a6),a0
                        GOQSO SetFileInfos
.Transfer_Error         bsr FILETR_DisplayInfo
                        move.l abr_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abr_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abr_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr ABR_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit_Sv
                        jsr _SVOReceivePacket(A6)
.Exit_Sv                rts
                        
ABR_AbortServer_Out     move.l d2,-(sp)
                        lea ABR_AbortString,a0
                        move.l abr_Channel(a6),d1
                        moveq #8,d0
                        GOQSO WriteTerminal
                        move.l (sp)+,d2
                        bra ABR_AbortServer_Uni



ABR_Nop                 rts




                        rsreset
abr_ThisQSO             rs.l 1
abr_Channel             rs.l 1
abr_OldServer           rs.l 1
abr_QSOBase             rs.l 1
abr_Parameter           rs.l 1
abr_BytesInBuffer       rs.l 1
abr_BytesInPacket       rs.l 1
abr_PacketPointer       rs.l 1
abr_BadFileMode         rs.l 1
abr_BadFilePointer      rs.l 1
abr_BadFileCRC          rs.l 1
abr_BadFileBackStep     rs.l 1
abr_ExternFilename      rs.l 1
abr_FileBuffer          rs.b 4096
abr_PacketBuffer        rs.b 256
abr_Size                rs.b 0


ABR_FunctionsBegin      
                        AJUMP GEN_AskAudioPass          ;-54
                        AJUMP ABR_AbortServer           ;-48
                        AJUMP ABR_GetServerType         ;-42
                        AJUMP ABR_TerminalInput         ;-36
                        AJUMP ABR_ReceivePacket         ;-30
                        AJUMP ABR_DoPoll                ;-24
                        AJUMP ABR_ConnectProced         ;-18
                        AJUMP ABR_Cleanup_Out           ;-12
                        AJUMP ABR_Init                  ;-6
ABR_Functions         



ABS_FunctionsBegin      
            AJUMP GEN_AskAudioPass              ;-54            
            AJUMP ABS_AbortServer               ;-48
                        AJUMP ABS_GetServerType         ;-42
                        AJUMP ABS_TerminalInput         ;-36
                        AJUMP ABS_ReceivePacket         ;-30
                        AJUMP ABS_DoPoll                ;-24
                        AJUMP ABS_Nop                   ;-18
                        AJUMP ABS_Cleanup               ;-12
                        AJUMP ABS_Init                  ;-6
ABS_Functions           

ABS_Nop                 rts
ABS_GetServerType       moveq #2,d0
                        rts
ABS_AbortServer         movem.l d2-d7/a2-a6,-(sp)
                        move.l abs_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_AbortString,a0
                        move.l abs_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abs_Channel(A6),d0
                        GOQSO ForceTransmit
                        bsr FILETR_DisplayInfo
                        move.l abs_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abs_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abs_OldServer(a6),-(sp)
                        bsr ABS_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
                        bra .Exit

.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        moveq #0,d0
                        rts

ABS_Init                movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l a3,a6
                        move.l #ABS_Functions-ABS_FunctionsBegin,d0
                        move.l #abs_Size,d1
                        lea ABS_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,abs_QSOBase(a6)
                        move.l d7,abs_OldServer(A6)
                        move.l d6,abs_Channel(a6)
                        move.l a4,abs_ThisQSO(a6)
                        move.l a2,abs_Parameter(A6)
                        move.l a6,qso_Server(a4)
                        
                        clr.l abs_SysopMode(a6)
                        move.l abs_Parameter(a6),a0
                        cmp.l #0,a0
                        beq .SysMode
                        cmp.b #$0d,(a0)
                        bne .No_SysMode
                        move.l #1,abs_SysopMode(a6)
                        addq.l #1,a0
                        move.l a0,abs_Parameter(a6)
                        bra .SysMode
.No_SysMode             GOQSO ConvertToAmiga
.SysMode                move.l abs_Parameter(a6),a0
                        GOQSO ParseComLine
                        move.l d0,d1
                        moveq #2,d0
                        tst.l d1
                        beq .Error_Serv_Txt
                        moveq #15,d0
                        cmp.l #1,d1
                        bne .Error_Serv_Txt
                        
                        
                        move.l abs_ThisQSO(a6),a0
                        tst.l qso_TransferMode(a0)
                        bne .Other_Transmit
                        move.l abs_Parameter(a6),a0
                        bsr ABS_ParseLine
                        tst.l d0
                        bne .Error_Serv_Txt
                        move.l abs_Parameter(a6),a0
                        clr.b (a0)
                        
                        bsr ABS_LaunchTransmit
                        Tst.l d0
                        bne .Error_Serv_Txt
                        
                        
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.Other_Transmit         moveq #0,d0
                        bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv_Txt         bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        move.l d2,-(sp)
                        move.l a4,a0
                        move.l abs_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           
                        move.l abs_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abs_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr ABS_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts


ABS_Cleanup             move.l abs_OldServer(a6),d0
                        move.l abs_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #ABS_Functions-ABS_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts


ABS_LaunchTransmit      clr.l abs_BadFileMode(a6)
                        movem.l d2-d7/a2-a6,-(sp)
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Emptied
.Empty_Loop             cmp.l #4096,d0
                        ble .Not_Full
                        move.l #4096,d0
.Not_Full               move.l abs_ThisQSO(a6),a1
                        lea abs_FileBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Emptied
                        move.l abs_Channel(a6),d1
                        lea abs_FileBuffer(a6),a0
                        GOQSO WriteTerminal
                        bra .Empty_Loop
                        
.Emptied                move.l abs_ThisQSO(a6),a4
                        lea qso_FileName(a4),a0
                        GOQSO CRCFile
                        move.l d0,qso_TransferCRC(a4)
                        lea qso_FileName(a4),a0
                        move.l a0,d1
                        move.l #1005,d2
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .NotFound
                        move.l d0,qso_FileID(a4)
                        cmp.l #-1,qso_TransferCRC(a4)
                        beq .ReadError
                        move.l #2,qso_TransferMode(A4)
                        lea qso_TransferStart(a4),a0
                        move.l a0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateStamp(A6)
                        move.l (sp)+,a6
                        clr.l qso_TransferRBytes(a4)
                        clr.l qso_TransferBytes(a4)
                        clr.l qso_OnlyPrepared(a4)
                        clr.l qso_WriteMode(a4)
                        sub.l #256,a7
                        move.l a7,a1
                        move.l a4,a0
                        GOQSO GetFileInfo
                        tst.l d0
                        bne .Exit_Gaga
                        tst.l qso_TransferTotBytes(a4)
                        beq .ReadError
                        lea abs_FileBuffer(a6),a3
                        move.b #"#",(a3)+
                        move.b #"B",(a3)+
                        move.b #"I",(a3)+
                        move.b #"N",(a3)+
                        move.b #"#",(a3)+
                        move.l qso_TransferTotBytes(a4),d0
                        bsr .LSSub
                        move.b #"#",(a3)+
                        move.b #"|",(a3)+
                        move.l qso_TransferCRC(a4),d0
                        bsr .LSSub
                        move.b #"#",(A3)+
                        move.b #"$",(A3)+
                        lea qso_TransferFileDate(a4),a0
                        GOQSO AmigaDateMs
                        move.l d0,d6
                        moveq #7,d5
.Hexout                 rol.l #4,d6
                        move.l d6,d0
                        and.l #$f,d0
                        add.b #$30,d0
                        cmp.l #$3a,d0
                        blt .Ziffout
                        add.l #7,d0
.Ziffout                move.b d0,(a3)+
                        dbf d5,.Hexout
                        move.b #"#",(a3)+
                        move.l a7,a0
                        moveq #-1,d0
.Search_ToLongBin       addq.l #1,d0
                        cmp.b #":",(a0)
                        bne .Search_NoDoubDot
                        addq.l #1,d0
.Search_NoDoubDot       tst.b (A0)+
                        bne .Search_ToLongBin
                        move.l a7,a0
                        cmp.l #40,d0
                        ble .BinLine_IsOK
                        sub.l #40,d0
                        add.l d0,a0
.BinLine_CutDown        cmp.b #":",(a0)
                        beq .BinLine_IsOK
                        tst.b (a0)
                        beq .BinLine_NoGoodCut
                        cmp.b #"/",(a0)
                        beq .BinLine_IsOK
                        addq.l #1,a0
                        bra .BinLine_CutDown
.BinLine_NoGoodCut      move.l a7,a0
                        add.l d0,a0
                        bra .BinLine_IsOK
.BinLine_IsOK           
.Copy_Path              move.b (a0)+,d0
                        tst.b d0
                        beq .Copy_Path_End
                        cmp.b #"/",d0
                        bne .Copy_Path_NoSla
                        move.b #92,d0       ;Baskslash
.Copy_Path_NoSla        cmp.b #":",d0
                        bne .Copy_Path_NoCol
                        move.b #":",(a3)+
                        move.b #92,d0        ;Backslash
.Copy_Path_NoCol        move.b d0,(A3)+
                        bra .Copy_Path
.Copy_Path_End          move.b #$d,(a3)+
                        clr.b (A3)+
                        add.l #256,a7
                        lea abs_FileBuffer(a6),a0
                        GOQSO ConvertToPC
                        move.l abs_Channel(a6),d0
                        GOQSO ForceTransmit
                        move.l abs_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        lea abs_FileBuffer(a6),a0
                        GOQSO TransmitText
                        move.l abs_Channel(a6),d0
                        GOQSO ForceTransmit
                        move.l #1,abs_WaitingAck(a6)
                        move.l abs_Channel(A6),d0
                        GOQSO RecalcFileTransfer
                        move.l abs_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        
                        moveq #0,d0
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
.LSSub                  move.l a3,a0
                        GOQSO LongToString
                        lea abs_FileBuffer(a6),a3
.LSSubLoop              tst.b (a3)+
                        bne .LSSubLoop
                        subq.l #1,a3
                        rts
.NotFound               moveq #4,d0
                        bra .Exit
.ReadError              moveq #5,d0
                        bra .Exit
.Exit_Gaga              add.l #256,a7
                        bra .Exit
                                                
ABS_ParseLine           movem.l d2-d7/a2-a6,-(sp)
                        move.l a0,a4
                        tst.l abs_SysopMode(a6)
                        bne .Filename_Easy
                        move.l abs_ThisQSO(a6),a3
                        tst.b (A4)
                        beq .No_Filename
                        lea qso_CurrentDir(a3),a0
                        sub.l #256,a7
                        move.l a7,a1
.Copy_HardName          move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_HardName
                        move.l a7,a0
                        move.l a4,a1
                        move.l #256,d0
                        GOQSO ProcessPathName
                        tst.l d0
                        bne .Exit_2
                        move.l abs_ThisQSO(a6),a0
                        GOQSO GetRemoteDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Copy_HardRemote        move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Copy_HardRemote
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l a7,d2
                        move.l #256,d3
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        add.l #256,a7
                        cmp.l #-1,d0
                        bne .Filename_Long
                        moveq #0,d0
                        bra .Exit
                
                        
.Exit_2                 add.l #256,a7
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts                     
.Filename_Easy          move.l a4,a0
                        move.l abs_ThisQSO(a6),a1
                        lea qso_FileName(a1),a1
                        move.l a1,-(sp)
.Filename_Easy_Cop      move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Filename_Easy_Cop
                        move.l (sp)+,a1
                        tst.b (A1)
                        beq .No_Filename
                        moveq #0,d0
                        bra .Exit
.No_Filename            moveq #2,d0
                        bra .Exit
.Filename_Long          clr.b qso_FileName(a3)
                        moveq #3,d0
                        bra .Exit


ABS_ReceivePacket       movem.l d2-d7/a2-a6,-(sp)
.Loop                   move.l abs_ThisQSO(a6),a0
                        move.l qso_TransferTotBytes(A0),d0
                        cmp.l qso_TransferBytes(a0),d0
                        beq .Exit
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit
                        cmp.l #256,d0
                        ble .Goodpac
                        move.l #256,d0
.Goodpac                move.l abs_ThisQSO(a6),a1               
                        lea abs_PacketBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d6
                        moveq #0,d7
                        lea abs_PacketBuffer(a6),a0
.Abort_Redo             cmp.b #"#",(a0)
                        bne .No_Acknowledge
                        cmp.b #"O",1(a0)
                        bne .No_Acknowledge
                        cmp.b #"K",2(a0)
                        bne .No_Acknowledge
                        cmp.b #"#",3(a0)
                        bne .No_Acknowledge
                        moveq #1,d7
                        bra .Packet_Recog
.No_Acknowledge         cmp.b #"#",(a0)
                        bne .No_Reject
                        cmp.b #"N",1(a0)
                        bne .No_Reject
                        cmp.b #"O",2(a0)
                        bne .No_Reject
                        cmp.b #"#",3(a0)
                        bne .No_Reject
                        moveq #2,d7
                        bra .Packet_Recog
.No_Reject              cmp.b #"#",(a0)
                        bne .No_Abort
                        cmp.b #"A",1(a0)
                        bne .No_Abort
                        cmp.b #"B",2(a0)
                        bne .No_Abort
                        cmp.b #"O",3(a0)
                        bne .No_Abort
                        cmp.b #"R",4(a0)
                        bne .No_Abort
                        cmp.b #"T",5(a0)
                        bne .No_Abort
                        cmp.b #"#",6(a0)
                        bne .No_Abort
                        moveq #3,d7
                        bra .Packet_Recog
.No_Abort               cmp.b #"#",(a0)
                        bne .No_CRCA
                        cmp.b #"C",1(a0)
                        bne .No_CRCA
                        cmp.b #"R",2(a0)
                        bne .No_CRCA
                        cmp.b #"C",3(a0)
                        bne .No_CRCA
                        cmp.b #"?",4(a0)
                        bne .No_CRCA
                        cmp.b #"#",5(a0)
                        bne .No_CRCA
                        moveq #4,d7
                        bra .Packet_Recog
.No_CRCA                cmp.b #"#",(a0)
                        bne .No_Conti
                        cmp.b #"C",1(a0)
                        bne .No_Conti
                        cmp.b #"O",2(a0)
                        bne .No_Conti
                        cmp.b #"N",3(a0)
                        bne .No_Conti
                        cmp.b #"T",4(a0)
                        bne .No_Conti
                        cmp.b #"#",5(a0)
                        bne .No_Conti
                        moveq #5,d7
                        bra .Packet_Recog
.No_Conti               tst.l d7
                        bne .Packet_Recog
                        tst.l d0
                        beq .Packet_Recog
                        sub.l #1,d0
                        move.b (a0)+,d1
                        cmp.b #$d,d1
                        bne .No_Abort
                        bra .Abort_Redo
.Packet_Recog           move.l d6,d0
                        move.l abs_Channel(A6),d1
                        lea abs_PacketBuffer(a6),a0
                        GOQSO WriteTerminal
                        tst.l d7
                        beq .Loop
                        tst.l abs_WaitingAck(a6)
                        bne .Waiting_For_Acknow
                        cmp.l #1,d7
                        bne .Abort_Transfer_B
                        bra .Loop
.Special_Packet         cmp.l #5,d7
                        beq .Go_On_Here
                        cmp.l #4,d7
                        bne .Loop
                        move.l #1,abs_BadFileMode(a6)
                        lea abs_PacketBuffer(a6),a0
                        lea 6(a0),a0
                        movem.l d2-d7/a2-a6,-(sp)
                        clr.l -(sp)
                        move.l sp,d2
                        move.l a0,d1
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOStrToLong(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        movem.l (sp)+,d2-d7/a2-a6
                        tst.l d0
                        ble .Abort_Transfer_B
                        move.l d1,d0
                        move.l abs_ThisQSO(a6),a0
                        lea qso_FileName(a0),a0
                        GOQSO CRCFileUntil
                        cmp.l #-1,d0
                        beq .Abort_Transfer_B
                        movem.l d2-d7/a2-a6,-(sp)
                        sub.l #64,a7
                        move.l a7,a0
                        move.l #"#CRC",(a0)+
                        move.w #"!#",(a0)+
                        GOQSO LongToString
                        move.l a7,a0
.SearchEnd_CRCS         tst.b (a0)+
                        bne .SearchEnd_CRCS
                        subq.l #1,a0
                        move.b #$d,(a0)+
                        clr.b (a0)+
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l a7,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l abr_Channel(A6),d0
                        GOQSO ForceTransmit
                        add.l #64,a7
                        movem.l (sp)+,d2-d7/a2-a6
                        bra .Loop
.Go_On_Here             tst.l abs_BadFileMode(a6)
                        beq .Loop
                        lea abs_PacketBuffer(a6),a0
                        lea 6(a0),a0
                        movem.l d2-d7/a2-a6,-(sp)
                        clr.l -(sp)
                        move.l sp,d2
                        move.l a0,d1
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOStrToLong(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        movem.l (sp)+,d2-d7/a2-a6
                        tst.l d0
                        ble .Abort_Transfer_B
                        move.l d1,d0
                        move.l abs_ThisQSO(A6),a0
                        move.l d0,qso_TransferOffset(a0)
                        move.l d0,qso_TransferRBytes(a0)
                        move.l d0,qso_TransferBytes(a0)
                        movem.l d2-d7/a2-a6,-(sp)
                        move.l d0,d2
                        moveq #-1,d3
                        move.l qso_FileID(a0),d1
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOSeek(a6)
                        movem.l (sp)+,d2-d7/a2-a6
                        cmp.l #-1,d0
                        beq .Abort_Transfer_B
                        clr.l abs_BadFileMode(a6)
                        bra .RealStart_Transfer
                        
.Waiting_For_Acknow     cmp.l #4,d7
                        bge .Special_Packet
                        cmp.l #1,d7
                        beq .RealStart_Transfer_Tst
                        bra .Abort_Transfer_B
.RealStart_Transfer_Tst tst.l abs_BadFileMode(a6)
                        bne .Loop
.RealStart_Transfer     clr.l abs_WaitingAck(a6)
                        move.l #4096,abs_BufferPointer(a6)
                        bsr ABS_DoPoll
                        bra .Loop
.Abort_Transfer_B       move.l abs_ThisQSO(a6),a0
                        tst.l qso_TransferBytes(a0)
                        beq .No_Info
                        bsr FILETR_DisplayInfo
.No_Info                move.l abs_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abs_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abs_OldServer(a6),-(sp)
                        bsr ABS_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts

ABS_DoPoll              movem.l d2-d7/a2-a6,-(sp)
                        tst.l abs_WaitingAck(a6)
                        bne .Exit_Ref
                        moveq #0,d5
                        move.l abs_Channel(a6),d0
                        GOQSO GetOutstanding
                        move.l d0,d7
                        move.l abs_Channel(A6),d0
                        GOQSO GetPacLen
                        move.l d0,d6
                        move.l d6,d4
                        mulu d7,d6
                        move.l abs_ThisQSO(a6),a4
                        move.l qso_TransferBytes(a4),d0
                        sub.l d6,d0
                        tst.l d0
                        bge .NoNegReal
                        moveq #0,d0
.NoNegReal              move.l d0,qso_TransferRBytes(a4)
                        move.l abs_Channel(A6),d0
                        GOQSO GetMaxFrame
                        asl.l #1,d0
                        move.l d0,d5
                        sub.l d7,d5
                        tst.l d5
                        ble .Exit_Ref
                        move.l qso_TransferBytes(a4),d0
                        cmp.l qso_TransferTotBytes(a4),d0
                        bge .No_More_Sendout
                        mulu d4,d5
                        move.l qso_TransferTotBytes(a4),d0
                        sub.l qso_TransferBytes(a4),d0
                        cmp.l d0,d5
                        ble .Sending_Loop
                        move.l d0,d5
.Sending_Loop           tst.l d5
                        beq .Exit_Ref_S
                        move.l abs_BufferPointer(a6),d0
                        move.l #4096,d1
                        sub.l d0,d1
                        tst.l d1
                        beq .Reload_Buffer
                        cmp.l d5,d1
                        ble .No_Once_Transmit
                        move.l d5,d1
.No_Once_Transmit       add.l d1,abs_BufferPointer(a6)
                        add.l d1,qso_TransferBytes(a4)
                        sub.l d1,d5
                        lea abs_FileBuffer(a6),a0
                        add.l d0,a0
                        move.l d1,d0
                        move.l abs_Channel(a6),d1
                        GOQSO TransmitData
                        bra .Sending_Loop
.Exit_Ref_S             ;move.l abs_Channel(a6),d0
                        ;GOQSO ForceTransmit
                        bra .Exit_Ref
                        

.Reload_Buffer          move.l qso_TransferTotBytes(A4),d0
                        sub.l qso_TransferBytes(a4),d0
                        cmp.l #4096,d0
                        ble .Reload_NotFull
                        move.l #4096,d0
.Reload_NotFull         move.l d0,d3
                        move.l qso_FileID(a4),d1
                        lea abs_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVORead(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        clr.l abs_BufferPointer(a6)
                        bra .Sending_Loop
.Packet_Error           bsr ABS_AbortServer
                        bra .Terminate_Server   

                        move.l abs_Channel(A6),d0
                        GOQSO ForceTransmit
                        move.l d2,-(sp)
                        lea ABR_AbortString,a0
                        move.l abs_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l abs_Channel(A6),d0
                        GOQSO ForceTransmit
                        bsr FILETR_DisplayInfo
                        move.l abs_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abs_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abs_OldServer(a6),-(sp)
                        bsr ABS_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
                        bra .Exit

.No_More_Sendout        tst.l d7
                        bne .Exit_Ref

.Terminate_Server       bsr FILETR_DisplayInfo
                        move.l abs_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l abs_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l abs_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abs_OldServer(a6),-(sp)
                        bsr ABS_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
                        bra .Exit
.Exit_Ref               move.l abs_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l abs_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
                        
ABS_TerminalInput       movem.l d2-d7/a2-a6,-(sp)
                        sub.l #260,a7
                        move.l d0,d7
                        move.l a0,a4
                        move.l abs_Channel(a6),d0
                        GOQSO GetPacLen
                        move.l d0,d6
                        cmp.l #5,d6
                        blt .Exit
                        subq.l #4,d6
                        move.l abs_Channel(a6),d0
                        GOQSO ForceTransmit
.Loop                   tst.l d7
                        beq .Exit
                        move.l d7,d0
                        cmp.l d6,d0
                        blt .Loop_FullTerm
                        move.l d6,d0
.Loop_FullTerm          move.l a7,a1
                        move.l a4,a0
                        add.l d0,a4
                        sub.l d0,d7
                        moveq #4,d1
                        add.l d0,d1
                        move.b #"S",(a1)+
                        move.b #"P",(a1)+
                        move.b #92,(a1)+       ;Backslash
                        move.b #"-",(a1)+
.Loop_CopyTerm          move.b (a0)+,(a1)+
                        subq.l #1,d0
                        bgt .Loop_CopyTerm
                        move.l d1,d0
                        move.l abs_Channel(a6),d1
                        move.l a7,a0
                        movem.l d0/d1/a0,-(sp)
                        move.l abs_ThisQSO(a6),a1
                        move.l qso_TransferBytes(a1),d2
                        cmp.l qso_TransferTotBytes(a1),d2
                        bne .No_EndOfFile
                        subq.l #4,d0
                        addq.l #4,a0
.No_EndOfFile           GOQSO TransmitData
                        movem.l (sp)+,d0/d1/a0
                        addq.l #4,a0
                        subq.l #4,d0
                        moveq #2,d2
                        GOQSO WriteTerminalUni
                        move.l abs_Channel(a6),d0
                        GOQSO ForceTransmit
                        bra .Loop
.Exit                   add.l #260,a7
                        movem.l (sp)+,d2-d7/a2-a6
                        rts


                        rsreset
abs_ThisQSO             rs.l 1
abs_Channel             rs.l 1
abs_OldServer           rs.l 1
abs_QSOBase             rs.l 1
abs_Parameter           rs.l 1
abs_BufferPointer       rs.l 1
abs_SysopMode           rs.l 1
abs_BadFileMode         rs.l 1
abs_FileBuffer          rs.b 4096
abs_PacketBuffer        rs.b 256
abs_WaitingAck          rs.l 1
abs_Size                rs.b 0


DIR_Init                movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l a3,a6
                        move.l #DIR_Functions-DIR_FunctionsBegin,d0
                        move.l #dir_Size,d1
                        lea DIR_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,dir_QSOBase(a6)
                        move.l a3,a5
                        move.l d7,dir_OldServer(A6)
                        move.l d6,dir_Channel(a6)
                        move.l a4,dir_ThisQSO(a6)
                        move.l a2,dir_Parameter(A6)
                        move.l a6,qso_Server(a4)
                        clr.l dir_ExAllControl(a6)
                        clr.l dir_DirLock(a6)
                        move.l dir_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .NoConvert
                        GOQSO ConvertToAmiga
.NoConvert

                        move.l dir_Parameter(a6),a0
                        GOQSO ParseComLine
                        move.l d0,d1
                        moveq #15,d0
                        tst.l d1
                        blt .Error_Serv_Txt
                        cmp.l #1,d1
                        bgt .Error_Serv_Txt
                        
                        
                        
                        
                        move.l dir_ThisQSO(a6),a0
                        lea qso_CurrentDir(a0),a0
                        sub.l #256,a7
                        move.l a7,a1
.Copy_CurrentDir        move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_CurrentDir
                        move.l a7,a0
                        move.l dir_Parameter(a6),a1
                        move.l #256,d0
                        GOQSO ProcessPathName
                        move.l dir_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .Catch_NoParam
                        clr.b (a0)
.Catch_NoParam          tst.l d0
                        bne .Error_Serv_Txt_2
                        move.l dir_ThisQSO(a6),a0
                        GOQSO GetRemoteDir
                        move.l d0,a0
                        lea dir_DirPath(a6),a1
.Copy_UserDir           move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_UserDir
                        move.l a7,d2
                        lea dir_DirPath(A6),a0
                        move.l a0,d1
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        add.l #256,a7
                        move.l d0,d1
                        moveq #3,d0
                        cmp.l #-1,d1
                        bne .Error_Serv_Txt
                        lea dir_DirPath(a6),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #6,d0
                        tst.l d1
                        beq .Error_Serv_Txt
                        move.l d1,dir_DirLock(a6)
                        
                        
                        moveq #1,d1
                        moveq #0,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAllocDosObject(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #7,d0
                        tst.l d1
                        beq .Error_Serv_Txt
                        move.l d1,dir_ExAllControl(a6)
                        
                        move.l dir_ExAllControl(a6),a0
                        clr.l (a0)
                        clr.l 4(a0)
                        clr.l 8(a0)
                        clr.l 12(a0)
                        clr.l dir_DirectorySum(a6)
                        clr.l dir_FilesSum(a6)
                        clr.l dir_BytesSum(a6)
                        movem.l d2-d7/a2-a6,-(sp)
                        moveq #0,d7
.Main_ExAllLoop         move.l dir_DirLock(a6),d1
                        lea dir_ExAllBuffer(a6),a0
                        move.l a0,d2
                        move.l #8192,d3
                        moveq #6,d4
                        move.l dir_ExAllControl(A6),d5
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOExAll(a6)
                        move.l (sp)+,a6
                        move.l d0,d6
                        move.l dir_ExAllControl(a6),a0
                        move.l (a0),d5
                        lea dir_ExAllBuffer(a6),a4
.ExAll_SubLoop          tst.l d5
                        beq .ExAll_SubDone
                        sub.l #256,a7
                        move.l a7,a3
                        move.l ed_Name(a4),a0
                        moveq #31,d0
.Copy_ObjectName        tst.b (A0)
                        beq .ONCopy_End
                        move.b (a0)+,(a3)+
                        subq.l #1,d0
                        bne .Copy_ObjectName
.ONCopy_End             tst.l d0
                        beq .ONSpacing_End
                        move.b #" ",(a3)+
                        subq.l #1,d0
                        bra .ONCopy_End
.ONSpacing_End          tst.l ed_Type(a4)
                        blt .Type_File
                        move.b #" ",(A3)+
                        move.b #" ",(A3)+
                        move.b #" ",(A3)+
                        move.b #" ",(A3)+
                        move.b #" ",(A3)+
                        move.b #" ",(A3)+
                        move.b #"D",(A3)+
                        move.b #"i",(A3)+
                        move.b #"r",(A3)+
                        move.b #" ",(A3)+
                        add.l #1,dir_DirectorySum(a6)
                        bra .Type_Directory
.Type_File              lea DIR_LongFormat,a0
                        move.l ed_Size(a4),-(sp)
                        move.l a7,a1
                        lea .PutCode,a2
                        move.l a6,-(sp)
                        move.l ppb_ExecBase(A5),a6
                        jsr _LVORawDoFmt(a6)
                        move.l (sp)+,a6
                        addq.l #4,a7
                        move.l a7,a3
                        bsr .SEOS
                        add.l #1,dir_FilesSum(a6)
                        move.l ed_Size(a4),d0
                        add.l d0,dir_BytesSum(a6)
                        move.b #" ",(a3)+
.Type_Directory         sub.l #26+16+16,a7
                        move.l a7,a0
                        move.l ed_Days(a4),(a0)
                        move.l ed_Mins(a4),4(a0)
                        move.l ed_Ticks(a4),8(a0)
                        clr.b 12(a0)
                        clr.b 13(a0)
                        clr.l 14(a0)
                        lea 26(a7),a1
                        move.l a1,18(a0)
                        lea 26+16(a7),a1
                        move.l a1,22(a0)
                        move.l a0,d1
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateToStr(a6)
                        move.l (sp)+,a6
                        lea 26(a7),a0
.Copy_Date              move.b (a0)+,(a3)+
                        tst.b -1(a0)
                        bne .Copy_Date
                        lea 26+16+16(a7),a3
                        bsr .SEOS
                        move.b #" ",(a3)+
                        lea 26+16(a7),a0
.Copy_Time              move.b (a0)+,(a3)+
                        tst.b -1(a0)
                        bne .Copy_Time
                        lea 26+16+16(a7),a3
                        bsr .SEOS
                        add.l #26+16+16,a7
                        
.No_DateAvail           move.b #$d,(a3)+
                        clr.b (a3)+
                        move.l a7,a0
                        GOQSO ConvertToPC
                        move.l a7,a0
                        move.l dir_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        
                        add.l #256,a7
                        
                        
                        
                        subq.l #1,d5
                        move.l (a4),a4
                        bra .ExAll_SubLoop
.SEOS                   tst.b (a3)+
                        bne .SEOS
                        subq.l #1,a3
                        rts
.PutCode                move.b d0,(a3)+
                        clr.b (a3)
                        rts
.ExAll_SubDone          cmp.l #-1,d6
                        bne .Examination_Ended
                        bra .Main_ExAllLoop                     
                        
                        
.Examination_Ended      move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOIoErr(a6)
                        move.l (sp)+,a6
                        cmp.l #$e8,d0
                        beq .No_ExAllErr
                        moveq #8,d7
.No_ExAllErr            move.l d7,d0
                        movem.l (sp)+,d2-d7/a2-a6
                        tst.l d0
                        bne .Error_Serv_Txt
                        
                        movem.l d2-d7/a2-a6,-(sp)
                        sub.l #256,a7
                        move.l a7,a3
                        moveq #9,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l dir_DirectorySum(A6),-(sp)
                        move.l dir_FilesSum(A6),-(sp)
                        move.l dir_BytesSum(a6),-(sp)
                        move.l a7,a1
                        lea .PutCode(pc),a2
                        move.l a6,-(sp)
                        move.l ppb_ExecBase(A5),a6
                        jsr _LVORawDoFmt(a6)
                        move.l (sp)+,a6
                        add.l #12,a7
                        move.l a7,a0
                        GOQSO ConvertToPC
                        move.l a7,a0
                        move.l dir_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        add.l #256,a7
                        movem.l (sp)+,d2-d7/a2-a6
                        
                        move.l a6,a0
                        movem.l (sp)+,a6/a4/d5-d7
                        BRA DIR_Leave_Server
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.Error_Serv_Txt_2       add.l #256,a7
.Error_Serv_Txt         bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        move.l d2,-(sp)
                        move.l a4,a0
                        move.l dir_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           move.l a6,a0
                        movem.l (sp)+,a6/a4/d5-d7
                        bra DIR_Leave_Server

DIR_Leave_Server        move.l a6,-(sp)
                        move.l a0,a6
                        move.l dir_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr DIR_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        moveq #0,d0
                        move.l (sp)+,a6
                        rts


DIR_Cleanup             tst.l dir_ExAllControl(a6)
                        beq .No_Exall
                        move.l dir_ExAllControl(a6),d2
                        clr.l dir_ExAllControl(a6)
                        moveq #1,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOFreeDosObject(a6)
                        move.l (sp)+,a6
.No_Exall               tst.l dir_DirLock(A6)
                        beq .No_DirLock
                        move.l dir_DirLock(a6),d1
                        clr.l dir_DirLock(a6)
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6
.No_DirLock             move.l dir_OldServer(a6),d0
                        move.l dir_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #DIR_Functions-DIR_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts
                        
DIR_Nop                 moveq #0,d0
                        rts


                        rsreset
ed_Next                 rs.l 1
ed_Name                 rs.l 1
ed_Type                 rs.l 1
ed_Size                 rs.l 1
ed_Prot                 rs.l 1
ed_Days                 rs.l 1
ed_Mins                 rs.l 1
ed_Ticks                rs.l 1
ed_Comment              rs.l 1
ed_Strings              rs.l 1


                        rsreset
dir_ThisQSO             rs.l 1
dir_Channel             rs.l 1
dir_OldServer           rs.l 1
dir_QSOBase             rs.l 1
dir_Parameter           rs.l 1
dir_ExAllControl        rs.l 1
dir_DirLock             rs.l 1
dir_DirectorySum        rs.l 1
dir_FilesSum            rs.l 1
dir_BytesSum            rs.l 1
dir_DirPath             rs.b 256
dir_ExAllBuffer         rs.b 8192
dir_Size                rs.b 0

DIR_FunctionsBegin      
                AJUMP GEN_AskAudioPass  ;-54
                AJUMP DIR_Nop                   ;-48
                        AJUMP DIR_Nop                   ;-42
                        AJUMP DIR_Nop                   ;-36
                        AJUMP DIR_Nop                   ;-30
                        AJUMP DIR_Nop                   ;-24
                        AJUMP DIR_Nop                   ;-18
                        AJUMP DIR_Cleanup                       ;-12
                        AJUMP DIR_Init                  ;-6
DIR_Functions           

CD_Init                 movem.l a6/a2-a4/d2-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l a3,a6
                        move.l #CD_Functions-CD_FunctionsBegin,d0
                        move.l #cd_Size,d1
                        lea CD_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,cd_QSOBase(a6)
                        move.l d7,cd_OldServer(A6)
                        move.l d6,cd_Channel(a6)
                        move.l a4,cd_ThisQSO(a6)
                        move.l a2,cd_Parameter(A6)
                        move.l a6,qso_Server(a4)
                        clr.l cd_DirLock(a6)
                        cmpa.l #0,a0
                        beq .No_Convert
                        move.l cd_Parameter(a6),a0
.No_Convert             GOQSO ConvertToAmiga
                        move.l cd_Parameter(a6),a0
                        GOQSO ParseComLine
                        move.l d0,d1
                        moveq #15,d0
                        tst.l d1
                        blt .Error_Serv_Txt
                        cmp.l #1,d1
                        bgt .Error_Serv_Txt
                        
                        
                        
                        move.l cd_ThisQSO(a6),a0
                        lea qso_CurrentDir(a0),a0
                        lea cd_DirPath2(a6),a1
.Copy_CurrentDir        move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_CurrentDir
                        lea cd_DirPath2(a6),a0
                        move.l cd_Parameter(a6),a1
                        move.l #256,d0
                        GOQSO ProcessPathName
                        move.l cd_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .No_ClearParam
                        clr.b (a0)
.No_ClearParam          tst.l d0
                        bne .Error_Serv_Txt
                        move.l cd_ThisQSO(a6),a0
                        GOQSO GetRemoteDir
                        move.l d0,a0
                        lea cd_DirPath(a6),a1
.Copy_UserDir           move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_UserDir
                        lea cd_DirPath2(a6),a0
                        move.l a0,d2
                        lea cd_DirPath(A6),a0
                        move.l a0,d1
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #3,d0
                        cmp.l #-1,d1
                        bne .Error_Serv_Txt
                        lea cd_DirPath(a6),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(A5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #6,d0
                        tst.l d1
                        beq .Error_Serv_Txt
                        move.l d1,cd_DirLock(a6)
                        
                        lea cd_FileInfo(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        move.l a0,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOExamine(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #6,d0
                        cmp.l #-1,d1
                        bne .Error_Serv_Txt
                        lea cd_FileInfo(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        tst.l fib_DirEntryType(a0)
                        blt .Error_Serv_Txt
                        lea cd_DirPath2(a6),a0
                        move.l cd_ThisQSO(a6),a1
                        lea qso_CurrentDir(a1),a1
.Copy_CurrentDirBack    move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_CurrentDirBack
                        sub.l #256,a7
                        move.l a7,d2
                        move.l cd_DirLock(a6),d1
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVONameFromLock(a6)
                        move.l (sp)+,a6
                        move.l d0,d1
                        moveq #5,d0
                        cmp.l #-1,d1
                        bne .Error_Serv_Txt_2   
                        sub.l #512,a7
                        move.l a7,a3
                        moveq #10,d0
                        bsr Get_Text
                        move.l d0,a0
                        lea 512(a7),a1
                        move.l a1,-(Sp)
                        move.l a7,a1
                        lea .PutCode(pc),a2
                        move.l a6,-(sp)
                        move.l ppb_ExecBase(A5),a6
                        jsr _LVORawDoFmt(a6)
                        move.l (sp)+,a6
                        addq.l #4,a7
                        move.l a7,a0
                        GOQSO ConvertToPC
                        move.l a7,a0
                        move.l dir_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        add.l #512+256,a7
                        
                        
                        
                        
                        move.l a6,a0
                        movem.l (sp)+,a6/a2-a4/d2-d7
                        BRA CD_Leave_Server
.PutCode                move.b d0,(a3)+
                        clr.b (a3)
                        rts
                        
.Cannot_Serve           movem.l (sp)+,a6/a2-a4/d2-d7
                        moveq #-1,d0
                        rts
.Error_Serv_Txt_2       add.l #256,a7
.Error_Serv_Txt         bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        move.l d2,-(sp)
                        move.l a4,a0
                        move.l cd_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           move.l a6,a0
                        movem.l (sp)+,a6/a2-a4/d2-d7
                        bra CD_Leave_Server

CD_Leave_Server         move.l a6,-(sp)
                        move.l a0,a6
                        move.l cd_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr CD_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        moveq #0,d0
                        move.l (sp)+,a6
                        rts


CD_Cleanup              tst.l cd_DirLock(A6)
                        beq .No_DirLock
                        move.l cd_DirLock(a6),d1
                        clr.l cd_DirLock(a6)
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6
.No_DirLock             move.l cd_OldServer(a6),d0
                        move.l cd_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #CD_Functions-CD_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts
                        
CD_Nop                  moveq #0,d0
                        rts




                        rsreset
cd_ThisQSO              rs.l 1
cd_Channel              rs.l 1
cd_OldServer            rs.l 1
cd_QSOBase              rs.l 1
cd_Parameter            rs.l 1
cd_DirLock              rs.l 1
cd_DirPath              rs.b 256
cd_DirPath2             rs.b 256
cd_FileInfo             rs.b fib_SIZEOF+4
cd_Size                 rs.b 0

CD_FunctionsBegin       
                        AJUMP GEN_AskAudioPass  ;-54
                        AJUMP CD_Nop                    ;-48
                        AJUMP CD_Nop                    ;-42
                        AJUMP CD_Nop                    ;-36
                        AJUMP CD_Nop                    ;-30
                        AJUMP CD_Nop                    ;-24
                        AJUMP CD_Nop                    ;-18
                        AJUMP CD_Cleanup                        ;-12
                        AJUMP CD_Init                   ;-6
CD_Functions            



RT_FunctionsBegin       
                        AJUMP GEN_AskAudioPass  ;-54
                        AJUMP RT_AbortServer            ;-48
                        AJUMP RT_GetServerType          ;-42
                        AJUMP RT_Nop                    ;-36
                        AJUMP RT_ReceivePacket          ;-30
                        AJUMP RT_DoPoll                 ;-24
                        AJUMP RT_Nop                    ;-18
                        AJUMP RT_Cleanup                        ;-12
                        AJUMP RT_Init                   ;-6
RT_Functions            

RT_Nop                  rts

RT_GetServerType        moveq #2,d0
                        rts

RT_Init_Bin             moveq #6,d1
                        bra RT_GeneralInit
RT_Init_Plus            moveq #4,d1
                        bra RT_GeneralInit                              
RT_Init                 moveq #8,d1
                
RT_GeneralInit          movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l d1,d5
                        move.l a3,a6
                        move.l #RT_Functions-RT_FunctionsBegin,d0
                        move.l #rt_Size,d1
                        lea RT_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,rt_QSOBase(a6)
                        move.l d7,rt_OldServer(A6)
                        move.l d6,rt_Channel(a6)
                        move.l a4,rt_ThisQSO(a6)
                        move.l a2,rt_Parameter(A6)
                        move.l d5,rt_WantMode(a6)
                        move.l a6,qso_Server(a4)
                        clr.l rt_SysopFlag(a6)
                        cmpa.l #0,a2
                        beq .No_SysopCall
                        cmp.b #$d,(a2)
                        bne .No_SysopCall
                        move.l #1,rt_SysopFlag(a6)
                        move.l rt_Parameter(a6),a0
                        addq.l #1,a0
                        move.l a0,rt_Parameter(a6)
                        bra .No_Conversion_Sys
.No_SysopCall           move.l rt_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .No_Conversion_Sys
                        GOQSO ConvertToAmiga
.No_Conversion_Sys      move.l rt_Parameter(A6),a0
                        GOQSO ParseComLine
                        move.l d0,d1
                        moveq #2,d0
                        tst.l d1
                        beq .Error_Serv_Txt
                        moveq #15,d0
                        cmp.l #1,d1
                        bne .Error_Serv_Txt
                        move.l rt_ThisQSO(a6),a0
                        tst.l qso_TransferMode(a0)
                        bne .Other_Transmit
                        moveq #2,d0
                        cmp.l #0,a2
                        beq .Error_Serv_Txt
                        move.l rt_Parameter(a6),a0
                        bsr RT_ParseLine
                        tst.l d0
                        bne .Error_Serv_Txt
                        move.l rt_Parameter(a6),a0
                        clr.b (a0)
                        
                        bsr RT_LaunchTransmit
                        Tst.l d0
                        bne .Error_Serv_Txt
                        cmp.l #6,rt_WantMode(a6)
                        bne .No_KillPrompt
                        move.l rt_ThisQSO(a6),a0
                        clr.l qso_SendPrompt(a0)
.No_KillPrompt                  
                        
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.Other_Transmit         moveq #0,d0
                        bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv_Txt         bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmp.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        tst.l rt_SysopFlag(a6)
                        beq .No_SysopError
                        move.l a4,a0
                        GOQSO DisplayMsgWin
                        bra .Error_Serv_3
                        
.No_SysopError          move.l d2,-(sp)
                        move.l a4,a0
                        move.l rt_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           
                        move.l rt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l rt_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr RT_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts


RT_Cleanup              move.l rt_OldServer(a6),d0
                        move.l rt_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #RT_Functions-RT_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts


RT_LaunchTransmit       movem.l d2-d7/a2-a6,-(sp)
                        move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Emptied
.Empty_Loop             cmp.l #4096,d0
                        ble .Not_Full
                        move.l #4096,d0
.Not_Full               move.l rt_ThisQSO(a6),a1
                        lea rt_FileBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Emptied
                        move.l rt_Channel(a6),d1
                        lea rt_FileBuffer(a6),a0
                        GOQSO WriteTerminal
                        bra .Empty_Loop
                        
.Emptied                lea qso_FileName(a4),a0
                        move.l a0,d1
                        move.l #1005,d2
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .NotFound
                        move.l d0,qso_FileID(a4)
                        move.l rt_WantMode(a6),qso_TransferMode(A4)
                        lea qso_TransferStart(a4),a0
                        move.l a0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateStamp(A6)
                        move.l (sp)+,a6
                        clr.l qso_TransferRBytes(a4)
                        clr.l qso_TransferBytes(a4)
                        clr.l qso_OnlyPrepared(a4)
                        clr.l qso_WriteMode(a4)
                        sub.l #256,a7
                        move.l a7,a1
                        move.l a4,a0
                        GOQSO GetFileInfo
                        tst.l d0
                        bne .Exit_Gaga
                        add.l #256,a7
                        move.l qso_TransferMode(a4),d0
                        cmp.l #8,d0
                        bne .No_PCFont_File
                        tst.l d1
                        bne .No_NilIdent
                        lea qso_FileName(a4),a0
                        GOQSO Test7PlusName
                        tst.l d0
                        beq .No_PCFont_File
                        bra .7Plus_File
.No_NilIdent            
                        cmp.l #9,d1
                        beq .PCFont_File
                        cmp.l #3,d1
                        bne .No_PCFont_File
.7Plus_File             move.l #4,qso_TransferMode(a4)
                        move.l #4,rt_WantMode(a6)
                        bra .No_PCFont_File
.PCFont_File            move.l #10,qso_TransferMode(a4)
                        move.l #10,rt_WantMode(a6)
.No_PCFont_File         tst.l qso_TransferTotBytes(a4)
                        beq .ReadError
                        move.l #4096,rt_BufferPointer(a6)
                        bsr RT_DoPoll
                        moveq #0,d0
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
.LSSub                  move.l a3,a0
                        GOQSO LongToString
                        lea rt_FileBuffer(a6),a3
.LSSubLoop              tst.b (a3)+
                        bne .LSSubLoop
                        subq.l #1,a3
                        rts
.NotFound               moveq #4,d0
                        bra .Exit
.ReadError              moveq #5,d0
                        bra .Exit
.Exit_Gaga              add.l #256,a7
                        bra .Exit
                                                
RT_ParseLine            movem.l d2-d7/a2-a6,-(sp)
                        move.l a0,a4
                        tst.l rt_SysopFlag(a6)
                        bne .Filename_Easy
                        move.l rt_ThisQSO(a6),a3
                        tst.b (A4)
                        beq .No_Filename
                        lea qso_CurrentDir(a3),a0
                        sub.l #256,a7
                        move.l a7,a1
.Copy_HardName          move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_HardName
                        move.l a7,a0
                        move.l a4,a1
                        move.l #256,d0
                        GOQSO ProcessPathName
                        tst.l d0
                        bne .Exit_2
                        move.l rt_ThisQSO(a6),a0
                        GOQSO GetRemoteDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Copy_HardRemote        move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Copy_HardRemote
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l a7,d2
                        move.l #256,d3
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        add.l #256,a7
                        cmp.l #-1,d0
                        bne .Filename_Long
                        moveq #0,d0
                        bra .Exit
                
                        
.Exit_2                 add.l #256,a7
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts                     
.Filename_Easy          move.l a4,a0
                        move.l rt_ThisQSO(a6),a1
                        lea qso_FileName(a1),a1
                        move.l a1,-(sp)
.Filename_Easy_Cop      move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Filename_Easy_Cop
                        move.l (sp)+,a1
                        tst.b (A1)
                        beq .No_Filename
                        moveq #0,d0
                        bra .Exit
.No_Filename            moveq #2,d0
                        bra .Exit
.Filename_Long          clr.b qso_FileName(a3)
                        moveq #3,d0
                        bra .Exit

RT_ReceivePacket        movem.l d2-d7/a2-a6,-(sp)
.Loop                   move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d2
                        move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBufferLin
                        tst.l d0
                        bne .No_Gagapac
                        move.l d2,d0
.No_Gagapac             cmp.l #256,d0
                        ble .Goodpac
                        move.l #256,d0
.Goodpac                move.l rt_ThisQSO(A6),a0
                        move.l rt_ThisQSO(a6),a1                
                        lea rt_PacketBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d6
                        lea rt_PacketBuffer(a6),a4
                        moveq #0,d5
.Main_Loop              move.l #256,d0
                        move.l d6,d1
                        moveq #1,d2
                        lea rt_LineBuffer(a6),a0
                        move.l a4,a1
                        GOQSO LineParse
                        cmp.l #-1,d0
                        beq .Main_LoopEnd
                        add.l d6,a4
                        sub.l d0,a4
                        move.l d0,d6
                        
                        
                        lea rt_LineBuffer(a6),a0
                        moveq #-1,d0
.Count_Loop             addq.l #1,d0
                        tst.b (a0)+
                        bne .Count_Loop
                        cmp.b #$d,-2(a0)
                        bne .No_Abortion
                        lea rt_LineBuffer(a6),a0
                        cmp.b #"/",(a0)
                        bne .No_Abortion
                        move.b 1(a0),d0
                        and.b #$df,d0
                        cmp.b #"C",d0
                        bne .No_Abortion
                        move.b 2(a0),d0
                        and.b #$df,d0
                        cmp.b #"U",d0
                        bne .No_Abortion
                        move.b 3(a0),d0
                        and.b #$df,d0
                        cmp.b #"T",d0
                        bne .No_Abortion
                        cmp.b #$d,4(a0)
                        bne .No_Abortion
.Abortion               moveq #1,d5
.No_Abortion            lea rt_LineBuffer(a6),a0
                        move.l rt_Channel(A6),d1
                        GOQSO WriteTerminal
                        clr.b rt_LineBuffer(a6)
                        bra .Main_Loop
.Main_LoopEnd           tst.l d5
                        beq .Loop
                        
                        bsr RT_AbortServer
                        bra .Exit
                        


.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts

RT_AbortServer          move.l rt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l rt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l d2,-(sp)
                        moveq #11,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l rt_OldServer(a6),-(sp)
                        bsr RT_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
.Exit                   move.l a6,a0
                        rts

RT_DoPoll               movem.l d2-d7/a2-a6,-(sp)
                        moveq #0,d5
                        move.l rt_Channel(a6),d0
                        GOQSO GetOutstanding
                        move.l d0,d7
                        move.l rt_Channel(A6),d0
                        GOQSO GetPacLen
                        move.l d0,d6
                        move.l d6,d4
                        mulu d7,d6
                        move.l rt_ThisQSO(a6),a4
                        move.l qso_TransferBytes(a4),d0
                        sub.l d6,d0
                        tst.l d0
                        bge .NoNegReal
                        moveq #0,d0
.NoNegReal              move.l d0,qso_TransferRBytes(a4)
                        move.l rt_Channel(a6),d0
                        GOQSO GetMaxFrame
                        asl.l #1,d0
                        move.l d0,d5
                        sub.l d7,d5
                        tst.l d5
                        ble .Exit_Ref
                        move.l qso_TransferBytes(a4),d0
                        cmp.l qso_TransferTotBytes(a4),d0
                        bge .No_More_Sendout
                        mulu d4,d5
                        move.l qso_TransferTotBytes(a4),d0
                        sub.l qso_TransferBytes(a4),d0
                        cmp.l d0,d5
                        ble .Sending_Loop
                        move.l d0,d5
.Sending_Loop           tst.l d5
                        beq .Exit_Ref_S
                        move.l rt_BufferPointer(a6),d0
                        move.l #4096,d1
                        sub.l d0,d1
                        tst.l d1
                        beq .Reload_Buffer
                        cmp.l d5,d1
                        ble .No_Once_Transmit
                        move.l d5,d1
.No_Once_Transmit       add.l d1,rt_BufferPointer(a6)
                        add.l d1,qso_TransferBytes(a4)
                        sub.l d1,d5
                        lea rt_FileBuffer(a6),a0
                        add.l d0,a0
                        move.l d1,d0
                        move.l rt_Channel(a6),d1
                        movem.l d0-d1/a0,-(sp)
                        GOQSO TransmitData
                        movem.l (sp)+,d0-d1/a0
                        moveq #2,d2
                        GOQSO WriteTerminalUni
                        bra .Sending_Loop
.Exit_Ref_S             ;move.l rt_Channel(a6),d0
                        ;GOQSO ForceTransmit
                        bra .Exit_Ref
                        

.Reload_Buffer          move.l qso_TransferTotBytes(A4),d0
                        sub.l qso_TransferBytes(a4),d0
                        cmp.l #4096,d0
                        ble .Reload_NotFull
                        move.l #4096,d0
.Reload_NotFull         move.l d0,d3
                        move.l qso_FileID(a4),d1
                        lea rt_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVORead(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        clr.l rt_BufferPointer(a6)
                        cmp.l #6,rt_WantMode(a6)
                        beq .Sending_Loop               ;No CR conversion 
                        move.l d3,d0
                        lea rt_FileBuffer(a6),a0
.Convert_CRs            tst.l d0
                        beq .CRs_Converted
                        subq.l #1,d0
                        move.b (a0)+,d1
                        cmp.b #$a,d1
                        bne .Convert_CRs
                        move.b #$d,-1(a0)
                        bra .Convert_CRs
.CRs_Converted          cmp.l #8,rt_WantMode(A6)
                        bne .Sending_Loop               ;No Charset conversion
                        move.l d3,d0
                        lea rt_FileBuffer(a6),a0
                        GOQSO ConvertToPCLen
                        bra .Sending_Loop
.Packet_Error           move.l d2,-(sp)
                        moveq #5,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        bra .Terminate_Server   

.No_More_Sendout        tst.l d7
                        bne .Exit_Ref

.Terminate_Server       move.l rt_ThisQSO(a6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        bsr FILETR_DisplayInfo
                        move.l rt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l rt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l rt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l rt_OldServer(a6),-(sp)
                        bsr RT_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
                        bra .Exit
.Exit_Ref               move.l rt_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l rt_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
                        





                        rsreset
rt_ThisQSO              rs.l 1
rt_Channel              rs.l 1
rt_OldServer            rs.l 1
rt_QSOBase              rs.l 1
rt_Parameter            rs.l 1
rt_BufferPointer        rs.l 1
rt_WantMode             rs.l 1
rt_SysopFlag            rs.l 1
rt_FileBuffer           rs.b 4096
rt_PacketBuffer         rs.b 256
rt_LineBuffer           rs.b 256
rt_Size                 rs.b 0





WT_FunctionsBegin       
            
            AJUMP GEN_AskAudioPass              ;-54          
            AJUMP WT_AbortServer_Out            ;-48
                        AJUMP WT_GetServerType          ;-42
                        AJUMP WT_TerminalInput          ;-36
                        AJUMP WT_ReceivePacket          ;-30
                        AJUMP WT_DoPoll                 ;-24
                        AJUMP WT_Nop                    ;-18
                        AJUMP WT_Cleanup                        ;-12
                        AJUMP WT_Init                   ;-6
WT_Functions            

WT_Nop                  rts

WT_GetServerType        moveq #1,d0
                        rts
WT_TerminalInput
                        move.l wt_Channel(A6),d1

                        movem.l d0/d1/a0,-(sp)
                        GOQSO TransmitData
                        movem.l (sp)+,d0/d1/a0
                        moveq #2,d2
                        GOQSO WriteTerminalUni

                        rts     

WT_Init_AutoBin         moveq #1,d1
                        bra WT_GeneralInit
WT_Init_7Plus           moveq #3,d1
                        bra WT_GeneralInit
WT_Init_Amiga           moveq #7,d1
                        bra WT_GeneralInit
WT_Init_Bin             moveq #5,d1
                        bra WT_GeneralInit
WT_Init                 moveq #9,d1
WT_GeneralInit          movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l d1,d5
                        move.l a3,a6
                        move.l #WT_Functions-WT_FunctionsBegin,d0
                        move.l #wt_Size,d1
                        lea WT_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,wt_QSOBase(a6)
                        move.l d7,wt_OldServer(A6)
                        move.l d6,wt_Channel(a6)
                        move.l a4,wt_ThisQSO(a6)
                        move.l a2,wt_Parameter(A6)
                        move.l d5,wt_WantMode(a6)
                        move.l a6,qso_Server(a4)
                        clr.l wt_SysopFlag(a6)
                        cmpa.l #0,a2
                        beq .No_SysopCall
                        cmp.b #$d,(a2)
                        bne .No_SysopCall
                        move.l #1,wt_SysopFlag(a6)
                        move.l wt_Parameter(a6),a0
                        addq.l #1,a0
                        move.l a0,wt_Parameter(a6)
                        bra .No_Conversion_Sys
.No_SysopCall           move.l wt_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .No_Conversion_Sys
                        GOQSO ConvertToAmiga
.No_Conversion_Sys      move.l wt_Parameter(a6),a0
                        GOQSO ParseComLine
                        move.l d0,d1
                        moveq #2,d0
                        tst.l d1
                        beq .Error_Serv_Txt_Xtra
                        moveq #15,d0
                        cmp.l #1,d1
                        bne .Error_Serv_Txt             
                        move.l wt_ThisQSO(a6),a0
                        tst.l qso_TransferMode(a0)
                        bne .Other_Transmit
                        moveq #2,d0
                        cmp.l #0,a2
                        beq .Error_Serv_Txt
                        move.l wt_Parameter(A6),a0
                        bsr WT_ParseLine
                        tst.l d0
                        bne .Error_Serv_Txt
                        
                        
                        move.l wt_Parameter(a6),a0
                        clr.b (a0)
                        
                        bsr WT_LaunchTransmit
                        Tst.l d0
                        bne .Error_Serv_Txt
                        move.l wt_ThisQSO(a6),a0
                        cmp.l #1,qso_TransferMode(a0)
                        beq .Leave_Server
                        cmp.l #3,qso_TransferMode(a0)
                        beq .Leave_Server
                        
                        
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts
.Error_Serv_Txt_Xtra    move.l wt_ThisQSO(A6),a0
                        move.l wt_WantMode(A6),d1
                        cmp.l qso_TransferMode(a0),d1
                        bne .Error_Serv_Txt
                        tst.l qso_OnlyPrepared(a0)
                        beq .Error_Serv_Txt
                        clr.l qso_OnlyPrepared(a0)
                        moveq #11,d0
                        bra .Error_Serv_Txt
                                                
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.Other_Transmit         moveq #0,d0
                        bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv_Txt         bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        tst.l wt_SysopFlag(a6)
                        beq .No_SysopError
                        move.l a4,a0
                        GOQSO DisplayMsgWin
                        bra .Error_Serv_3
                        
.No_SysopError          move.l d2,-(sp)
                        move.l a4,a0
                        move.l wt_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           move.l wt_ThisQSO(a6),a0
                        tst.l qso_OnlyPrepared(a0)
                        bne .Leave_Server
.Kill_ThisTrans         move.l wt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l wt_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
.Leave_Server           move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l abr_OldServer(a6),-(sp)
                        bsr WT_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts


WT_Cleanup              move.l wt_OldServer(a6),d0
                        move.l wt_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #WT_Functions-WT_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts


WT_LaunchTransmit       movem.l d2-d7/a2-a6,-(sp)
                        
                        
                        move.l #1,qso_WriteMode(a4)
                        
                        
                        
                        
                        
                        move.l wt_WantMode(a6),qso_TransferMode(A4)
                        lea qso_TransferStart(a4),a0
                        move.l a0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateStamp(A6)
                        move.l (sp)+,a6
                        clr.l qso_TransferRBytes(a4)
                        clr.l qso_TransferBytes(a4)
                        clr.l qso_OnlyPrepared(a4)
                        clr.l qso_TransferTotBytes(a4)
                        move.l qso_TransferMode(a4),d0
                        cmp.l #9,d0
                        bne .No_PCFont_File
                        lea qso_FileName(a4),a0
                        GOQSO Test7PlusName
                        tst.l d0
                        beq .No_PCFont_File
                        move.l #3,qso_TransferMode(a4)
                        move.l #3,wt_WantMode(a6)
.No_PCFont_File         
                        cmp.l #3,qso_TransferMode(a4)
                        beq .Prepare_7Plus
                        cmp.l #1,qso_TransferMode(a4)
                        beq .Prepare_AutoBin
                        
                        
                        lea qso_FileName(a4),a0
                        move.l a0,d1
                        move.l #1004,d2
                        move.l a6,-(Sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .NotFound
                        move.l d0,qso_FileID(a4)
                        tst.l wt_AlreadyExists(a6)
                        beq .No_Append
                        move.l d0,d1
                        moveq #0,d2
                        moveq #1,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOSeek(a6)
                        move.l (sp)+,a6
                        cmp.l #-1,d0
                        beq .Seek_Error
.No_Append
                        tst.l wt_SysopFlag(a6)
                        bne .No_WriteHeader
                        moveq #14,d0
                        bsr Get_Text
                        move.l d2,-(sp)
                        move.l d0,a0
                        move.l wt_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.No_WriteHeader 
                        clr.l wt_BufferPointer(a6)
                        bsr WT_ReceivePacket
                        bsr WT_DoPoll
                        moveq #0,d0
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
.Seek_Error             moveq #13,d0
                        bra .Exit

.LSSub                  move.l a3,a0
                        GOQSO LongToString
                        lea wt_FileBuffer(a6),a3
.LSSubLoop              tst.b (a3)+
                        bne .LSSubLoop
                        subq.l #1,a3
                        rts
.NotFound               moveq #4,d0
                        bra .Exit
.ReadError              moveq #5,d0
                        bra .Exit
                                                
.Prepare_7Plus          tst.l wt_SysopFlag(a6)
                        bne .No_WriteHeader_7P
                        moveq #16,d0
                        bsr Get_Text
                        move.l d2,-(sp)
                        move.l d0,a0
                        move.l wt_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.No_WriteHeader_7P      bra .Prepare_BothOfThem

.Prepare_AutoBin        tst.l wt_SysopFlag(a6)
                        bne .No_WriteHeader_AB
                        moveq #17,d0
                        bsr Get_Text
                        move.l d2,-(sp)
                        move.l d0,a0
                        move.l wt_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.No_WriteHeader_AB      bra .Prepare_BothOfThem
        
.Prepare_BothOfThem     move.l #1,qso_OnlyPrepared(a4)
                        move.l wt_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l wt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        moveq #0,d0
                        bra .Exit
                        

WT_ParseLine            movem.l d2-d7/a2-a6,-(sp)
                        move.l a0,a4
                        tst.l wt_SysopFlag(a6)
                        bne .Filename_Easy
                        move.l wt_ThisQSO(a6),a3
                        tst.b (A4)
                        beq .No_Filename
                        lea qso_CurrentDir(a3),a0
                        sub.l #256,a7
                        move.l a7,a1
.Copy_HardName          move.b (a0)+,(a1)+
                        tst.b -1(a0)
                        bne .Copy_HardName
                        move.l a7,a0
                        move.l a4,a1
                        move.l #256,d0
                        GOQSO ProcessPathName
                        tst.l d0
                        bne .Exit_2
                        move.l wt_ThisQSO(a6),a0
                        GOQSO GetRemoteDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Copy_HardRemote        move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Copy_HardRemote
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l a7,d2
                        move.l #256,d3
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        add.l #256,a7
                        cmp.l #-1,d0
                        bne .Filename_Long
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        bne .Already_Exists
.NoMatter_Exist         clr.l wt_AlreadyExists(a6)
                        
                        
                        moveq #0,d0
                        bra .Exit
.Already_Exists         cmp.l #1,wt_WantMode(a6)
                        bne .Already_Exists_Text
                        move.l d0,d1
                        move.l d1,-(sp)
                        lea wt_FileBuffer(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        move.l a0,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOExamine(a6)
                        move.l (sp)+,a6
                        move.l (sp)+,d1
                        move.l d0,-(sp)
                        
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (Sp)+,a6
                        move.l (sp)+,d0
                        tst.l d0
                        beq .Already_Exists_Real
                        lea wt_FileBuffer(a6),a0
                        move.l a0,d0
                        addq.l #3,d0
                        and.l #$fffffffc,d0
                        move.l d0,a0
                        lea fib_Comment(a0),a0
.Parse_For_BadFile      tst.b (a0)
                        beq .Already_Exists_Real
                        cmp.b #" ",(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"B",1(a0)
                        beq .Parse_For_BADCRC
                        cmp.b #"I",1(a0)
                        beq .Parse_For_INCOMP
                        bra .Parse_For_BadFile_N
.Parse_For_BADCRC       cmp.b #"A",2(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"D",3(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",4(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"R",5(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",6(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"!",7(a0)
                        bne .Parse_For_BadFile_N
                        bra .BadFile_Idented
.Parse_For_INCOMP       cmp.b #"N",2(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"C",3(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"O",4(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"M",5(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"P",6(a0)
                        bne .Parse_For_BadFile_N
                        cmp.b #"!",7(a0)
                        bne .Parse_For_BadFile_N
                        bra .BadFile_Idented
.Parse_For_BadFile_N    addq.l #1,a0
                        bra .Parse_For_BadFile
.BadFile_Idented        bra .NoMatter_Exist
                        
.Already_Exists_Text    move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6
.Already_Exists_Real    moveq #12,d0
                        bra .Exit
                        
.Exit_2                 add.l #256,a7
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts                     
.Filename_Easy          move.l a4,a0
                        move.l wt_ThisQSO(a6),a3
                        lea qso_FileName(a3),a1
                        move.l a1,-(sp)
.Filename_Easy_Cop      move.b (a0)+,(A1)+
                        tst.b -1(a0)
                        bne .Filename_Easy_Cop
                        move.l (sp)+,a1
                        tst.b (A1)
                        beq .No_Filename
                        
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        bne .Sys_Already_Exists
                        clr.l wt_AlreadyExists(a6)
                        
                        
                        moveq #0,d0
                        bra .Exit
.Sys_Already_Exists     move.l #1,wt_AlreadyExists(a6)
                        move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6
                        moveq #0,d0
                        bra .Exit
.No_Filename            moveq #2,d0
                        bra .Exit
.Filename_Long          clr.b qso_FileName(a3)
                        moveq #3,d0
                        bra .Exit

WT_ReceivePacket        movem.l d2-d7/a2-a6,-(sp)
.Loop                   move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d2
                        move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBufferLin
                        tst.l d0
                        bne .No_Gagapac
                        move.l d2,d0
.No_Gagapac             cmp.l #256,d0
                        ble .Goodpac
                        move.l #256,d0
.Goodpac                move.l wt_ThisQSO(a6),a1                
                        lea wt_PacketBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d6
                        lea wt_PacketBuffer(a6),a3
                        moveq #0,d4
.Main_Loop              move.l #256,d0
                        move.l d6,d1
                        moveq #0,d2
                        lea wt_LineBuffer(a6),a0
                        move.l a3,a1
                        GOQSO LineParse
                        cmp.l #-1,d0
                        beq .Main_LoopEndL
                        move.l a3,a2
                        moveq #0,d3
                        add.l d6,d3
                        sub.l d0,d3
                        add.l d6,a3
                        sub.l d0,a3
                        move.l d0,d6
                        
                        
                        lea wt_LineBuffer(a6),a0
                        moveq #-1,d0
.Count_Loop             addq.l #1,d0
                        tst.b (a0)+
                        bne .Count_Loop
                        move.l d0,d1
                        cmp.b #$d,-2(a0)
                        bne .No_Termination
                        lea wt_LineBuffer(a6),a0
                        cmp.b #"/",(a0)
                        bne .No_Abortion
                        move.b 1(a0),d0
                        and.b #$df,d0
                        cmp.b #"C",d0
                        bne .No_Abortion
                        move.b 2(a0),d0
                        and.b #$df,d0
                        cmp.b #"U",d0
                        bne .No_Abortion
                        move.b 3(a0),d0
                        and.b #$df,d0
                        cmp.b #"T",d0
                        bne .No_Abortion
                        move.b 4(a0),d0
                        cmp.b #$d,d0
                        bne .No_Abortion                                                
.Abortion               moveq #1,d4
                        bra .No_Termination
                        
.No_Abortion            lea wt_LineBuffer(A6),a0
                        cmp.b #$1a,(a0)
                        bne .No_Termination_Z
                        cmp.b #$d,1(a0)
                        beq .Termination
.No_Termination_Z       lea wt_LineBuffer(a6),a0
                        cmp.b #"/",(a0)
                        bne .No_Termination
                        move.b 1(a0),d0
                        and.b #$df,d0
                        cmp.b #"E",d0
                        bne .No_Termination
                        move.b 2(a0),d0
                        and.b #$df,d0
                        cmp.b #"X",d0
                        bne .No_Termination
                        move.b 3(a0),d0
                        cmp.b #$d,d0
                        bne .No_Termination
.Termination            moveq #2,d4
.No_Termination         move.l d1,d0
                        lea wt_LineBuffer(a6),a0
                        move.l wt_Channel(A6),d1
                        GOQSO WriteTerminal
                        clr.b wt_LineBuffer(a6)
                        
                        tst.l d4
                        bne .Main_LoopEnd
.WriteToDisk            cmp.l #5,wt_WantMode(a6)
                        beq .No_ConvertChrs
                        move.l d3,d0
                        move.l a2,a0
.Convert_CRs            Tst.l d0
                        beq .CRs_Converted
                        subq.l #1,d0
                        move.b (a0)+,d1
                        cmp.b #$d,d1
                        bne .Convert_CRs
                        move.b #$a,-1(a0)
                        bra .Convert_CRs
.CRs_Converted          cmp.l #9,wt_WantMode(a6)
                        beq .No_ConvertChrs
                        move.l d3,d0
                        move.l a2,a0
                        GOQSO ConvertToAmigaLen
.No_ConvertChrs         move.l d3,d5
                        move.l wt_ThisQSO(a6),a4
                        bra .Sending_Loop

.Main_LoopEndL          move.l d6,d3
                        move.l a3,a2
                        moveq #0,d4
                        moveq #0,d6
                        bra .WriteToDisk
                        
.Main_LoopThru          tst.l d6
                        bne .Main_Loop
.Main_LoopEnd           tst.l d4
                        beq .Loop
                        cmp.l #2,d4
                        beq .Terminate_Transfer
                        bsr WT_AbortServer
                        bra .Exit

.Terminate_Transfer     move.l wt_ThisQSO(a6),a4
                        move.l wt_BufferPointer(a6),d3
                        move.l qso_FileID(a4),d1
                        lea wt_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOWrite(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        move.l qso_FileID(a4),d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        clr.l qso_FileID(a4)
                        move.l wt_ThisQSO(a6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        GOQSO SetFileInfos
                        bra .Terminate_Server
                        

                        ;A4 QSO
                        ;D5 Bytes to Write
                        ;A2 ByteBuffer
                        ;D2,D3 Destroyed
                        
.Sending_Loop           tst.l d5
                        beq .Exit_Ref_S
                        move.l wt_BufferPointer(a6),d0
                        move.l #4096,d1
                        sub.l d0,d1
                        tst.l d1
                        beq .Reload_Buffer
                        cmp.l d5,d1
                        ble .No_Once_Transmit
                        move.l d5,d1
.No_Once_Transmit       add.l d1,wt_BufferPointer(a6)
                        add.l d1,qso_TransferBytes(a4)
                        add.l d1,qso_TransferRBytes(A4)
                        sub.l d1,d5
                        lea wt_FileBuffer(a6),a0
                        add.l d0,a0
                        move.l d1,d0
.Copy_Loop              tst.l d0
                        beq .Sending_Loop
                        move.b (a2)+,(a0)+
                        subq.l #1,d0
                        bra .Copy_Loop

.Exit_Ref_S             bra .Main_LoopThru
                        

.Reload_Buffer          move.l #4096,d3
                        move.l qso_FileID(a4),d1
                        lea wt_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOWrite(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        clr.l wt_BufferPointer(a6)
                        bra .Sending_Loop
.Packet_Error           move.l d2,-(sp)
                        moveq #13,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        bra .Terminate_Server   

.No_More_Sendout        bra .Main_Loop

.Terminate_Server       move.l wt_ThisQSO(A6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        bsr FILETR_DisplayInfo
                        move.l wt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l wt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l wt_OldServer(a6),-(sp)
                        bsr WT_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit_ASA
                        jsr _SVOReceivePacket(A6)
.Exit_ASA               move.l a6,a0
                        bra .Exit_ABS

.Exit                   move.l wt_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l wt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        cmp.l #5,wt_WantMode(a6)
                        bne .Exit_ABS
                        lea wt_LineBuffer(a6),a0
                        moveq #-1,d0
.Count_QuitLB           addq.l #1,d0
                        tst.b (a0)+
                        bne .Count_QuitLB
                        tst.l d0
                        beq .Exit_ABS
                        lea wt_LineBuffer(a6),a0
                        move.l wt_Channel(A6),d1
                        GOQSO WriteTerminal
                        clr.b wt_LineBuffer(a6)
.Exit_ABS               movem.l (sp)+,d2-d7/a2-a6
                        rts
WT_AbortServer_Out      movem.l d2-d7/a2-a6,-(sp)
                        move.l wt_ThisQSO(a6),a4
                        move.l wt_BufferPointer(a6),d3
                        move.l qso_FileID(a4),d1
                        lea wt_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOWrite(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        move.l qso_FileID(a4),d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        clr.l qso_FileID(a4)
                        move.l wt_ThisQSO(a6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        GOQSO SetFileInfos
                        bra .Terminate_Server
.Packet_Error           move.l d2,-(sp)
                        moveq #13,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        ;bra .Terminate_Server  
.Terminate_Server       move.l wt_ThisQSO(A6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        bsr FILETR_DisplayInfo
                        move.l wt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l wt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l wt_OldServer(a6),-(sp)
                        bsr WT_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit_ASA
                        jsr _SVOReceivePacket(A6)
.Exit_ASA               move.l a6,a0
                        movem.l (sp)+,d2-d7/a2-a6
                        rts


WT_AbortServer          move.l wt_ThisQSO(A6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        bsr FILETR_DisplayInfo
                        move.l wt_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l wt_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l d2,-(sp)
                        moveq #11,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l wt_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l wt_OldServer(a6),-(sp)
                        bsr WT_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
.Exit                   move.l a6,a0
                        rts


WT_DoPoll               movem.l d2-d7/a2-a6,-(sp)
.Exit_Ref               move.l wt_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l wt_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts



                        rsreset
wt_ThisQSO              rs.l 1
wt_Channel              rs.l 1
wt_OldServer            rs.l 1
wt_QSOBase              rs.l 1
wt_Parameter            rs.l 1
wt_BufferPointer        rs.l 1
wt_WantMode             rs.l 1
wt_SysopFlag            rs.l 1
wt_AlreadyExists        rs.l 1
wt_FileBuffer           rs.b 4096
wt_PacketBuffer         rs.b 256
wt_LineBuffer           rs.b 256
wt_Size                 rs.b 0

A7P_Init                movem.l a6/a4/d5-d7,-(sp)
                        move.l a0,a4
                        move.l a1,d7
                        move.l d0,d6
                        move.l a3,a6
                        move.l #A7P_Functions-A7P_FunctionsBegin,d0
                        move.l #a7p_Size,d1
                        lea A7P_Functions,a0
                        move.l ppb_Global(a6),a5
                        jsr _QVOCreateServerBase(A6)
                        tst.l d0
                        beq .Cannot_Serve
                        move.l d0,a6
                        move.l a3,a5
                        move.l a3,a7p_QSOBase(a6)
                        move.l d7,a7p_OldServer(A6)
                        move.l d6,a7p_Channel(a6)
                        move.l a4,a7p_ThisQSO(a6)
                        move.l a2,a7p_Parameter(A6)
                        move.l a6,qso_Server(a4)
                        move.l a7p_Parameter(a6),a0
                        cmpa.l #0,a0
                        beq .Error_Serv
                        cmp.b #" ",(a0)
                        bne .Error_Serv
                        cmp.b #"g",1(a0)
                        bne .Error_Serv
                        cmp.b #"o",2(a0)
                        bne .Error_Serv
                        cmp.b #"_",3(a0)
                        bne .Error_Serv
                        
                        move.l a7p_ThisQSO(a6),a0
                        moveq #0,d0
                        tst.l qso_TransferMode(a0)
                        beq .No_Other_Transmit
                        tst.l qso_OnlyPrepared(a0)
                        beq .DisErr_Serv
                        cmp.l #3,qso_TransferMode(a0)
                        bne .DisErr_Serv
.No_Other_Transmit      move.l a2,a0
                        bsr A7P_ParseLine
                        cmp.l #-1,d0
                        beq .Error_Serv
                        tst.l d0
                        bne .DisErr_Serv
                        
                        
                        move.l a7p_Parameter(a6),a0
                        clr.b (a0)
                        bsr A7P_ReceivePacket
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts
                        
.Cannot_Serve           movem.l (sp)+,a4/d5-d7
                        moveq #-1,d0
                        rts
.DisErr_Serv            bsr Get_Text
                        move.l d0,a4
                        bra .Error_Serv_2
.Error_Serv             sub.l a4,a4
.Error_Serv_2           cmpa.l #0,a2
                        beq .Error_Serv_2b
                        clr.b (a2)
.Error_Serv_2b          cmpa.l #0,a4
                        beq .Error_Serv_3
                        move.l d2,-(sp)
                        move.l a4,a0
                        move.l a7p_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
.Error_Serv_3           
                        move.l a7p_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l a7p_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        move.l a7p_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l a7p_OldServer(a6),-(sp)
                        bsr A7P_Cleanup
                        move.l (sp)+,a6
                        move.l (sp)+,d0
                        jsr _SVOReceivePacket(a6)
                        movem.l (sp)+,a6/a4/d5-d7
                        moveq #0,d0
                        rts


A7P_Cleanup             move.l a7p_OldServer(a6),d0
                        move.l a7p_ThisQSO(a6),a0
                        move.l d0,qso_Server(a0)
                        move.l a6,a1
                        move.l ppb_ExecBase(a5),a6
                        sub.l #A7P_Functions-A7P_FunctionsBegin,a1
                        jsr _LVOFreeVec(A6)
                        moveq #0,d0
                        rts

A7P_ConnectProced       rts

A7P_ParseLine           movem.l d2-d7/a2-a6,-(sp)
                        move.l a0,a1
                        moveq #0,d0
                        lea a7p_FileBuffer(a6),a2
.Copy_HeadLine          addq.l #1,d0
                        move.b (a1)+,(a2)+
                        tst.b -1(a1)
                        bne .Copy_HeadLine
                        move.l d0,a7p_BufferPointer(a6)
                        subq.l #1,a2
                        move.b #$A,(a2)
                        
                        move.l a7p_ThisQSO(a6),a3
                        move.l a0,a4
                        move.l a0,a2
                        lea 4(a4),a4
                        cmp.b #"7",(a4)
                        beq .Posib_7Plus
                        cmp.b #"t",(a4)
                        beq .Posib_Text
                        cmp.b #"i",(a4)
                        beq .Posib_Info
                        bra .Error
.Posib_7Plus            cmp.b #"+",1(a4)
                        bne .Error
                        cmp.b #".",2(a4)
                        bne .Error
                        cmp.b #" ",3(a4)
                        bne .Error
                        lea 4(a4),a4
                        bra .Parse_7Plus
.Posib_Text             cmp.b #"e",1(a4)
                        bne .Error
                        cmp.b #"x",2(A4)
                        bne .Error
                        cmp.b #"t",3(a4)
                        bne .Error
                        cmp.b #".",4(A4)
                        bne .Error
                        cmp.b #" ",5(a4)
                        bne .Error
                        lea 6(a4),a4
                        bra .Parse_Text
.Posib_Info             cmp.b #"n",1(a4)
                        bne .Error
                        cmp.b #"f",2(A4)
                        bne .Error
                        cmp.b #"o",3(a4)
                        bne .Error
                        cmp.b #".",4(a4)
                        bne .Error
                        cmp.b #" ",5(A4)
                        bne .Error
                        lea 6(a4),a4
                        bra .Parse_Text_2
.Parse_7Plus            clr.l a7p_StopMode(a6)
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        move.l d0,d7
                        mulu #10,d7
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        add.l d0,d7
                        mulu #10,d7
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        add.l d0,d7                     ;Part Number
                        cmp.b #" ",(A4)+
                        bne .Error
                        cmp.b #"o",(a4)+
                        bne .Error
                        cmp.b #"f",(A4)+
                        bne .Error
                        cmp.b #" ",(A4)+
                        bne .Error
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        move.l d0,d6
                        mulu #10,d6
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        add.l d0,d6
                        mulu #10,d6
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        add.l d0,d6                     ;Max Part Number
                        cmp.b #" ",(a4)+
                        bne .Error
                        move.l a4,d5                    ;Filename Pointer
                        lea 12(a4),a4
                        cmp.b #" ",(A4)+
                        bne .Error
                        moveq #6,d2
                        moveq #0,d3
.Get_WholeSize_L        move.l d3,d0
                        moveq #10,d1
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(a5),a6
                        jsr _LVOUMult32(a6)
                        movem.l (sp)+,a6
                        move.l d0,d3
                        bsr .P7P_GetNum
                        cmp.l #-1,d0
                        beq .Error
                        add.l d0,d3
                        dbf d2,.Get_WholeSize_L
                        cmp.b #" ",(A4)+
                        bne .Error
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        
                        cmp.b #" ",(A4)+
                        bne .Error
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        move.l d0,d4
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        asl.l #4,d4
                        or.l d0,d4
                        bsr .P7P_GetHexa
                        cmp.l #-1,d0
                        beq .Error
                        asl.l #4,d4
                        or.l d0,d4                      ;Number of Lines total
                        cmp.b #" ",(A4)+
                        bne .Error
                        addq.l #2,d4
                        cmp.l d6,d7
                        bne .No_LastPartCalc
                        
                        move.l d4,d1
                        subq.l #2,d1
                        tst.l d1
                        beq .No_LastPartCalc
                        moveq #62,d0
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(a5),a6
                        jsr _LVOUMult32(a6)
                        movem.l (sp)+,a6
                        move.l d7,d1
                        subq.l #1,d1
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(a5),a6
                        jsr _LVOUMult32(a6)
                        movem.l (sp)+,a6
                        sub.l d3,d0
                        neg.l d0
                        tst.l d0
                        ble .No_LastPartCalc
                        moveq #62,d1
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(a5),a6
                        jsr _LVOUDivMod32(a6)
                        movem.l (sp)+,a6
                        tst.l d1
                        beq .LastCalc_NoMod
                        addq.l #1,d0
.LastCalc_NoMod         addq.l #2,d0
                        move.l d0,d4
.No_LastPartCalc        moveq #11,d0
.Overjump_PrgInfo_L1    tst.b (a4)+
                        beq .Error
                        dbf d0,.Overjump_PrgInfo_L1
                        cmp.b #" ",(A4)+
                        bne .Error
                        tst.b (a4)
                        beq .Error
                        tst.b 1(a4)
                        beq .Error
                        tst.b 2(a4)
                        beq .Error
                        Tst.b 3(a4)
                        beq .Error
                        cmp.b #"*",3(a4)
                        bne .P7P_DoneLine
                        cmp.l #1,d7
                        bne .P7P_DoneLine
                        addq.l #1,d4
.P7P_DoneLine           move.l a2,a4
                        moveq #0,d0
.P7P_CountLine          addq.l #1,d0
                        tst.b (a4)+
                        bne .P7P_CountLine
                        move.l d4,d1
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(A5),a6
                        jsr _LVOUMult32(a6)
                        move.l (Sp)+,a6
                        move.l d0,d4                    ;Number of Bytes of File
                        move.l d0,qso_TransferTotBytes(a3)
                        tst.b qso_FileName(A3)
                        bne .Line_Parsed
                        move.l d5,a4
                        cmp.l d6,d7
                        bgt .Error
                        tst.l d6
                        ble .Error
                        tst.l d7
                        ble .Error
                        sub.l #32,a7
                        move.l a7,a0
.P7P_CopyFileName       cmp.b #$20,(A4)
                        beq .P7P_CopyFileNameEnd
                        cmp.b #".",(a4)
                        beq .P7P_CopyFileNameEnd
                        move.b (a4)+,(a0)+
                        bra .P7P_CopyFileName
.P7P_CopyFileNameEnd    move.b #".",(a0)+
                        cmp.l #1,d6
                        beq .P7P_CopyFileNameOnFi
                        move.l d7,d0
                        move.l d0,d1
                        and.l #$f,d0
                        lsr.l #4,d1
                        and.l #$f,d1
                        move.b #"P",(a0)+
                        move.l d0,-(sp)
                        move.l d1,d0
                        bsr .P7P_PutHexa
                        move.b d0,(a0)+
                        move.l (Sp)+,d0
                        bsr .P7P_PutHexa
                        move.b d0,(a0)+
                        clr.b (a0)+
                        bra .P7P_FileNameJoin
                        
                        
.P7P_CopyFileNameOnFi   move.b #"7",(a0)+
                        move.b #"P",(a0)+
                        move.b #"L",(a0)+
                        clr.b (a0)+
.P7P_FileNameJoin       move.l a7p_ThisQSO(a6),a0 
                                        GOQSO GetSaveDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.P7P_FileJoin_L1        move.b (a0)+,(a1)+
                        tst.b -1(A0)
                        bne .P7P_FileJoin_L1
                        lea qso_FileName(a3),a1
                        move.l a1,d1
                        move.l #256,d3
                        move.l a7,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        add.l #32,a7
                        cmp.l #-1,d0
                        bne .Error
                        bra .Try_FileName
                        
                        
                        

.P7P_GetNum             move.b (A4)+,d0
                        cmp.b #$30,d0
                        blt .P7P_GetNumErr
                        cmp.b #$39,d0
                        bgt .P7P_GetNumErr
                        and.l #$f,d0
                        rts
.P7P_GetNumErr          moveq #-1,d0
                        rts
.P7P_GetHexa            move.b (A4)+,d0
.P7P_GetHexa2           cmp.b #$30,d0
                        blt .P7P_GetHexaErr
                        cmp.b #$46,d0
                        bgt .P7P_GetHexaErr
                        cmp.b #$39,d0
                        bgt .P7P_GetHexaHexa
                        and.l #$f,d0
                        rts
.P7P_GetHexaHexa        cmp.b #$41,d0
                        blt .P7P_GetHexaErr
                        and.l #$ff,d0
                        sub.b #$41-$a,d0
                        rts
.P7P_GetHexaErr         moveq #-1,d0
                        rts
.P7P_PutHexa            cmp.b #10,d0
                        bge .P7P_PutHexaLarg
                        or.b #$30,d0
                        rts
.P7P_PutHexaLarg        add.b #$41-$a,d0
                        rts
                        
                        
.Parse_Text_2           move.l #2,a7p_StopMode(a6)
                        bra .Parse_Text_3
.Parse_Text             move.l #1,a7p_StopMode(a6)
.Parse_Text_3           tst.b qso_FileName(a3)
                        bne .Line_Parsed
                        move.l a7p_ThisQSO(a6),a0
                        GOQSO GetSaveDir
                        move.l d0,a0
                        lea qso_FileName(a3),a1
.Parse_Text_L1          move.b (a0)+,(a1)+
                        tst.b -1(A0)
                        bne .Parse_Text_L1
                        lea qso_FileName(a3),a1
                        move.l a1,d1
                        move.l #256,d3
                        move.l a4,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOAddPart(a6)
                        move.l (sp)+,a6
                        cmp.l #-1,d0
                        bne .Error
                        bra .Try_FileName
                        
                        
.Try_FileName           lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (Sp)+,a6
                        tst.l d0
                        beq .Line_Parsed
                        move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (Sp)+,a6
                        lea qso_FileName(A3),a0
                        moveq #-1,d0
.Inc_SearchEnd          addq.l #1,d0
                        tst.b (a0)+
                        bne .Inc_SearchEnd
                        subq.l #1,a0
.Inc_SearchDivision     tst.l d0
                        beq .Inc_AddDivision
                        move.b -(a0),d1
                        cmp.b #"_",d1
                        beq .Inc_IncDivision
                        cmp.b #".",d1
                        beq .Inc_TestExtension
                        cmp.b #":",d1
                        beq .Inc_AddDivision
                        cmp.b #"/",d1
                        beq .Inc_AddDivision
                        subq.l #1,d0
                        bra .Inc_SearchDivision
.Inc_TestExtension      addq.l #1,a0
                        cmp.b #"E",(a0)
                        beq .Inc_IncExtensE
                        cmp.b #"C",(a0)
                        beq .Inc_IncExtensC
                        bra .Inc_AddDivision
.Inc_IncExtensE         cmp.b #"R",1(a0)
                        bne .Inc_IncExtensNum
                        cmp.b #"R",2(a0)
                        bne .Inc_IncExtensNum
                        tst.b 3(a0)
                        bne .Inc_AddDivision
                        move.b #"0",1(a0)
                        move.b #"1",2(a0)
                        bra .Inc_Done
.Inc_IncExtensC         cmp.b #"O",1(a0)
                        bne .Inc_IncExtensNum
                        cmp.b #"R",2(A0)
                        bne .Inc_IncExtensNum
                        tst.b 3(a0)
                        bne .Inc_AddDivision
                        move.b #"0",1(a0)
                        move.b #"1",2(a0)
                        bra .Inc_Done
.Inc_IncExtensNum       move.b 1(A0),d0
                        bsr .P7P_GetHexa2
                        cmp.l #-1,d0
                        beq .Inc_AddDivision
                        moveq #0,d2
                        move.b d0,d2
                        asl.l #4,d2
                        move.b 2(a0),d0
                        bsr .P7P_GetHexa2
                        cmp.l #-1,d0
                        beq .Inc_AddDivision
                        tst.b 3(a0)
                        bne .Inc_AddDivision
                        or.b d0,d2
                        addq.l #1,d2
                        cmp.l #256,d2
                        bge .Inc_AddDivision
                        move.l d2,d0
                        lsr.l #4,d0
                        bsr .P7P_PutHexa
                        move.b d0,1(a0)
                        move.l d2,d0
                        and.l #$f,d0
                        bsr .P7P_PutHexa
                        move.b d0,2(a0)
                        bra .Inc_Done
.Inc_AddDivision        tst.b (A0)+
                        bne .Inc_AddDivision
                        subq.l #1,a0
                        move.b #"_",(a0)
                        move.b #"0",1(A0)
                        move.b #"1",2(a0)
                        clr.b 3(a0)
                        bra .Inc_Done
.Inc_IncDivision        addq.l #1,a0
                        moveq #0,d0
                        move.b (a0),d0
                        cmp.b #$30,d0
                        blt .Inc_AddDivision
                        cmp.b #$39,d0
                        bgt .Inc_AddDivision
                        sub.b #$30,d0
                        move.l d0,d2
                        mulu #10,d2
                        move.b 1(a0),d0
                        cmp.b #$30,d0
                        blt .Inc_AddDivision
                        cmp.b #$39,d0
                        bgt .Inc_AddDivision
                        sub.b #$30,d0
                        add.l d0,d2
                        tst.b 2(a0)
                        bne .Inc_AddDivision
                        addq.l #1,d2
                        cmp.l #100,d2
                        bge .Error
                        divu #10,d2
                        or.l #$00300030,d2
                        move.b d2,(a0)
                        swap d2
                        move.b d2,1(a0)
.Inc_Done               bra .Try_FileName

                        
.Line_Parsed            tst.b qso_FileName(a3)
                        beq .Error
                        move.l #3,qso_TransferMode(a3)
                        lea qso_TransferStart(a3),a0
                        move.l a0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVODateStamp(A6)
                        move.l (sp)+,a6

                        move.l a7p_BufferPointer(a6),qso_TransferRBytes(a3)
                        move.l a7p_BufferPointer(a6),qso_TransferBytes(a3)
                        clr.l qso_OnlyPrepared(A3)
                        move.l #1,qso_WriteMode(a3)
                        lea qso_FileName(a3),a0
                        move.l a0,d1
                        moveq #-2,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOLock(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .Good_NonExist
                        move.l d0,d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOUnLock(a6)
                        move.l (sp)+,a6
                        bra .Error
.Good_NonExist          lea qso_FileName(a3),a0
                        move.l a0,d1
                        move.l #1006,d2
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOOpen(a6)
                        move.l (sp)+,a6
                        tst.l d0
                        beq .Error
                        move.l d0,qso_FileID(a3)
                        move.l a7p_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l a7p_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        moveq #0,d0
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts
.Error                  moveq #-1,d0
                        bra .Exit

A7P_ReceivePacket       movem.l d2-d7/a2-a6,-(sp)
.Loop                   move.l a7p_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d2
                        move.l a7p_ThisQSO(a6),a0
                        GOQSO TestServBufferLin
                        tst.l d0
                        bne .No_Gagapac
                        move.l d2,d0
.No_Gagapac             cmp.l #256,d0
                        ble .Goodpac
                        move.l #256,d0
.Goodpac                move.l a7p_ThisQSO(a6),a1               
                        lea a7p_PacketBuffer(a6),a0
                        GOQSO ReadServBuffer
                        tst.l d0
                        beq .Exit
                        move.l d0,d6
                        lea a7p_PacketBuffer(a6),a3
                        moveq #0,d4
.Main_Loop              move.l #256,d0
                        move.l d6,d1
                        moveq #0,d2
                        lea a7p_LineBuffer(a6),a0
                        move.l a3,a1
                        GOQSO LineParse
                        cmp.l #-1,d0
                        beq .Main_LoopEndL
                        move.l a3,a2
                        moveq #0,d3
                        add.l d6,d3
                        sub.l d0,d3
                        add.l d6,a3
                        sub.l d0,a3
                        move.l d0,d6
                        
                        
                        lea a7p_LineBuffer(a6),a0
                        moveq #-1,d0
.Count_Loop             addq.l #1,d0
                        tst.b (a0)+
                        bne .Count_Loop
                        move.l d0,d1
                        cmp.b #$d,-2(a0)
                        bne .No_Termination
                        lea a7p_LineBuffer(a6),a0
                        cmp.b #" ",(a0)
                        bne .No_Termination
                        cmp.b #"s",1(a0)
                        bne .No_Termination
                        cmp.b #"t",2(a0)
                        bne .No_Termination
                        cmp.b #"o",3(a0)
                        bne .No_Termination
                        cmp.b #"p",4(a0)
                        bne .No_Termination
                        cmp.b #"_",5(a0)
                        bne .No_Termination
                        tst.l a7p_StopMode(a6)
                        bne .Stop_Not7P
                        cmp.b #"7",6(a0)
                        bne .No_Termination
                        cmp.b #"+",7(a0)
                        bne .No_Termination
                        cmp.b #".",8(a0)
                        bne .No_Termination                     
                        bra .Termination
.Stop_Not7P             cmp.l #1,a7p_StopMode(a6)
                        bne .Stop_ByInfo
                        cmp.b #"t",6(a0)
                        bne .No_Termination
                        cmp.b #"e",7(a0)
                        bne .No_Termination
                        cmp.b #"x",8(a0)
                        bne .No_Termination                     
                        cmp.b #"t",9(a0)
                        bne .No_Termination
                        cmp.b #".",10(a0)
                        bne .No_Termination
                        bra .Termination
.Stop_ByInfo            cmp.b #"i",6(a0)
                        bne .No_Termination
                        cmp.b #"n",7(a0)
                        bne .No_Termination
                        cmp.b #"f",8(a0)
                        bne .No_Termination                     
                        cmp.b #"o",9(a0)
                        bne .No_Termination
                        cmp.b #".",10(a0)
                        bne .No_Termination
                        bra .Termination

                        
.Termination            moveq #2,d4
.No_Termination         move.l d1,d0
                        lea a7p_LineBuffer(a6),a0
                        move.l a7p_Channel(A6),d1
                        GOQSO WriteTerminal
                        clr.b a7p_LineBuffer(a6)
                        
.WriteToDisk            move.l d3,d0
                        move.l a2,a0
.Convert_CRs            Tst.l d0
                        beq .CRs_Converted
                        subq.l #1,d0
                        move.b (a0)+,d1
                        cmp.b #$d,d1
                        bne .Convert_CRs
                        move.b #$a,-1(a0)
                        bra .Convert_CRs
.CRs_Converted          move.l d3,d5
                        move.l a7p_ThisQSO(a6),a4
                        bra .Sending_Loop

.Main_LoopEndL          move.l d6,d3
                        move.l a3,a2
                        moveq #0,d4
                        moveq #0,d6
                        bra .WriteToDisk
                        
.Main_LoopThru          tst.l d6
                        bne .Main_Loop
.Main_LoopEnd           tst.l d4
                        beq .Loop
.Terminate_Transfer     move.l qso_TransferRBytes(a4),qso_TransferTotBytes(a4)
                        move.l a7p_ThisQSO(a6),a4
                        move.l a7p_BufferPointer(a6),d3
                        move.l qso_FileID(a4),d1
                        lea a7p_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOWrite(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        move.l qso_FileID(a4),d1
                        move.l a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOClose(a6)
                        move.l (sp)+,a6
                        clr.l qso_FileID(a4)
                        move.l a7p_ThisQSO(a6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        GOQSO SetFileInfos
                        bra .Terminate_Server
                        

                        ;A4 QSO
                        ;D5 Bytes to Write
                        ;A2 ByteBuffer
                        ;D2,D3 Destroyed
                        
.Sending_Loop           tst.l d5
                        beq .Exit_Ref_S
                        move.l a7p_BufferPointer(a6),d0
                        move.l #4096,d1
                        sub.l d0,d1
                        tst.l d1
                        beq .Reload_Buffer
                        cmp.l d5,d1
                        ble .No_Once_Transmit
                        move.l d5,d1
.No_Once_Transmit       add.l d1,a7p_BufferPointer(a6)
                        add.l d1,qso_TransferBytes(a4)
                        add.l d1,qso_TransferRBytes(A4)
                        sub.l d1,d5
                        lea a7p_FileBuffer(a6),a0
                        add.l d0,a0
                        move.l d1,d0
.Copy_Loop              tst.l d0
                        beq .Sending_Loop
                        move.b (a2)+,(a0)+
                        subq.l #1,d0
                        bra .Copy_Loop

.Exit_Ref_S             bra .Main_LoopThru
                        

.Reload_Buffer          move.l #4096,d3
                        move.l qso_FileID(a4),d1
                        lea a7p_FileBuffer(a6),a0
                        move.l a0,d2
                        movem.l d3/a6,-(sp)
                        move.l ppb_DosBase(a5),a6
                        jsr _LVOWrite(a6)
                        movem.l (sp)+,d3/a6
                        cmp.l d3,d0
                        bne .Packet_Error
                        clr.l a7p_BufferPointer(a6)
                        bra .Sending_Loop
.Packet_Error           move.l d2,-(sp)
                        moveq #13,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        bra .Terminate_Server   

.No_More_Sendout        bra .Main_Loop

.Terminate_Server       move.l a7p_ThisQSO(A6),a0
                        move.l qso_TransferBytes(a0),qso_TransferTotBytes(a0)
                        bsr FILETR_DisplayInfo
                        move.l a7p_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l a7p_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l a7p_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l a7p_OldServer(a6),-(sp)
                        bsr A7P_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit_ASA
                        jsr _SVOReceivePacket(A6)
.Exit_ASA               move.l a6,a0
                        bra .Exit_ABS

.Exit                   move.l a7p_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l a7p_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
.Exit_ABS               movem.l (sp)+,d2-d7/a2-a6
                        rts

A7P_AbortServer         move.l a7p_ThisQSO(A6),a0
                        bsr FILETR_DisplayInfo
                        move.l a7p_Channel(a6),d0
                        GOQSO ResetFileTransfer
                        move.l a7p_Channel(a6),d0
                        GOQSO RedisplayFileTransfer
                        move.l d2,-(sp)
                        moveq #11,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        GOQSO TransmitText
                        move.l (sp)+,d2
                        move.l a7p_ThisQSO(a6),a0
                        GOQSO TestServBuffer
                        move.l d0,-(sp)
                        move.l a7p_OldServer(a6),-(sp)
                        bsr A7P_Cleanup
                        move.l (sp)+,a6
                        move.l (Sp)+,d0
                        cmpa.l #0,a6
                        beq .Exit
                        jsr _SVOReceivePacket(A6)
.Exit                   move.l a6,a0
                        rts


A7P_DoPoll              move.l a7p_Channel(A6),d0
                        GOQSO RecalcFileTransfer
                        move.l a7p_Channel(A6),d0
                        GOQSO RedisplayFileTransfer
                        rts

A7P_TerminalInput
                        move.l a7p_Channel(A6),d1

                        movem.l d0/d1/a0,-(sp)
                        GOQSO TransmitData
                        movem.l (sp)+,d0/d1/a0
                        moveq #2,d2
                        GOQSO WriteTerminalUni

                        rts     

A7P_GetServerType       moveq #1,d0
                        rts

                        



A7P_Nop                 rts

                        
A7P_FunctionsBegin      
            AJUMP GEN_AskAudioPass
            AJUMP A7P_AbortServer               ;-48
                        AJUMP A7P_GetServerType         ;-42
                        AJUMP A7P_TerminalInput         ;-36
                        AJUMP A7P_ReceivePacket         ;-30
                        AJUMP A7P_DoPoll                        ;-24
                        AJUMP A7P_ConnectProced         ;-18
                        AJUMP A7P_Cleanup                       ;-12
                        AJUMP A7P_Init                  ;-6
A7P_Functions           





                        rsreset
a7p_ThisQSO             rs.l 1
a7p_Channel             rs.l 1
a7p_OldServer           rs.l 1
a7p_QSOBase             rs.l 1
a7p_Parameter           rs.l 1
a7p_StopMode            rs.l 1
a7p_BufferPointer       rs.l 1
a7p_FileBuffer          rs.b 4096
a7p_PacketBuffer        rs.b 256
a7p_LineBuffer          rs.b 256
a7p_Size                rs.b 0



FILETR_DisplayInfo      movem.l d2-d7/a2-a6,-(sp)
                        move.l abr_ThisQSO(a6),a0
                        move.l qso_User(a0),a0
                        cmpa.l #0,a0
                        beq .Yes_DisplayUser
                        move.w user_Type(a0),d0
                        cmp.w #4,d0
                        bge .Exit
                        tst.w d0
                        blt .Exit
.Yes_DisplayUser        move.l abr_Channel(a6),d0
                        GOQSO RecalcFileTransfer
                        move.l abr_ThisQSO(a6),a4               ;QSO
                        move.l qso_TransferMode(A4),d7          ;TransferMode
                        cmp.l #5,d7
                        bgt .Exit
                        cmp.l #4,d7
                        beq .Exit
                        moveq #-1,d6                            ;CRC Ist
                        moveq #-1,d5                            ;CRC Soll
                        move.l qso_TransferCRC(a4),d0
                        cmp.l #-1,d0
                        beq .No_CRCAttached
                        moveq #0,d5
                        move.w d0,d5
                        swap d0
                        tst.w d0
                        beq .No_CRCAttached
                        move.l d5,d6
                        moveq #0,d5
                        move.w d0,d5
.No_CRCAttached         moveq #0,d4                             ;Incomplete
                        move.l qso_TransferTotBytes(a4),d0
                        tst.l d0
                        beq .No_Incomplete
                        cmp.l qso_TransferBytes(a4),d0
                        ble .No_Incomplete
                        moveq #1,d4
.No_Incomplete          sub.l #384,a7
                        move.l a7,a3
                        cmp.l #3,d7
                        bge .Easy_Line
                        cmp.l #1,d7
                        beq .Receive_Autobin
                        cmp.l #2,d7
                        beq .Transmit_Autobin
                        bra .Exit_2
.Receive_Autobin        tst.l d4
                        bne .Receive_InComp
                        cmp.l #-1,d6
                        beq .Receive_NoCRC
                        cmp.l #-1,d5
                        beq .Receive_NoCRC
                        cmp.l d5,d6
                        bne .Receive_WrongCRC
                        move.l d6,d1
                        moveq #23,d0
                        bra .Put_Argument               
.Receive_InComp         move.l qso_TransferBytes(a4),d1
                        move.l qso_TransferTotBytes(a4),d2
                        moveq #26,d0
                        bra .Put_Argument
.Receive_NoCRC          move.l d6,d1
                        moveq #28,d0
                        bra .Put_Argument
.Receive_WrongCRC       move.l d6,d1
                        move.l d5,d2
                        moveq #25,d0
                        bra .Put_Argument
.Transmit_Autobin       tst.l d4
                        bne .Transmit_InComp
                        move.l d5,d1
                        moveq #24,d0
                        bra .Put_Argument               
.Transmit_InComp        move.l qso_TransferBytes(a4),d1
                        move.l qso_TransferTotBytes(a4),d2
                        moveq #27,d0
                        bra .Put_Argument
.Easy_Line              moveq #18,d0
                        cmp.l #5,d7
                        bne .Easy_Line_2
                        moveq #19,d0
.Easy_Line_2            tst.l d4
                        beq .No_Incomplete_T
                        addq.l #3,d0
.No_Incomplete_T        bsr Get_Text
                        move.l d0,a0
.Copy_EasyLine          tst.b (a0)
                        beq .Copy_EasyLineEnd
                        move.b (a0)+,(a3)+
                        bra .Copy_EasyLine
.Copy_EasyLineEnd       bra .HeadLine_Finished
.Put_Argument           movem.l d1-d2,-(sp)
                        bsr Get_Text
                        movem.l (sp)+,d1-d2
                        move.l d2,-(Sp)
                        move.l d1,-(Sp)
                        move.l d0,a0
                        move.l a7,a1
                        lea .PutCode(pc),a2
                        move.l a6,-(sp)
                        move.l ppb_ExecBase(A5),a6
                        jsr _LVORawDoFmt(a6)
                        move.l (sp)+,a6
                        addq.l #2*4,a7
                        move.l a7,a3
.Put_Argument_L1        tst.b (a3)+
                        bne .Put_Argument_L1
                        subq.l #1,a3
.HeadLine_Finished      move.l qso_TransferBaud(a4),-(sp)
                        move.l qso_TransferElapsed(a4),d0
                        move.l a6,-(sp)
                        move.l ppb_UtilityBase(a5),a6
                        moveq #60,d1
                        jsr _LVOUDivMod32(a6)
                        move.l d1,d2
                        moveq #60,d1
                        jsr _LVOUDivMod32(a6)
                        move.l (sp)+,a6
                        move.l d2,-(sp)
                        move.l d1,-(Sp)
                        move.l d0,-(sp)
                        move.l qso_TransferTotBytes(a4),-(sp)
                        move.l qso_TransferBytes(a4),-(sp)
                        moveq #20,d0
                        bsr Get_Text
                        move.l d0,a0
                        move.l a7,a1
                        lea .PutCode(pc),a2
                        move.l a6,-(sp)
                        move.l ppb_ExecBase(A5),a6
                        jsr _LVORawDoFmt(a6)
                        move.l (sp)+,a6
                        add.l #6*4,a7
                        bra .All_Finished
.PutCode                move.b d0,(a3)+
                        clr.b (a3)
                        rts



.All_Finished           move.l abr_Channel(a6),d0
                        moveq #1,d1
                        moveq #0,d2
                        move.l a7,a0
                        GOQSO TransmitText                                              
.Exit_2                 add.l #384,a7
.Exit                   movem.l (sp)+,d2-d7/a2-a6
                        rts



GEN_AskAudioPass move.l a6,-(sp)
                        move.l abr_OldServer(a6),a6
                        cmpa.l #0,a6
                        beq .NoServer
                        jsr _SVOAskAudio(a6)
.NoServer       move.l (sp)+,a6
                        rts

Get_Text                lea _FileAccessCatalog(pc),a0
                        move.l abr_ThisQSO(a6),a1
                        move.l a2,-(sp)
                        lea _FileAccessCatalogName(pc),a2
                        GOQSO GetText
                        move.l (sp)+,a2
                        rts


ABR_RejectString        dc.b "#NO#",13,0
ABR_OkString            dc.b "#OK#",13,0
ABR_AbortString         dc.b "#ABORT#",13,0
ABR_GiveUpString        dc.b "#CONT#0",13,0
DIR_LongFormat          dc.b "%9ld",0
                        even

                        include "/Catalogs/Sources/FileAccess.s"


