home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
os968ka.tar.gz
/
os968ka.tar
/
k6oiof.asm
< prev
next >
Wrap
Assembly Source File
|
1987-07-01
|
44KB
|
833 lines
nam Kermit68K
ttl IO subroutines module
* Kermit68K: source file K68IOF
*
* Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet),
* Bologna University, Physics Department, July 1987.
*
* All rights reserved to Bologna University, Italy.
*
* Permission is granted to any individual or institution
* to use, copy, or redistribute this software so long as
* it is not sold for profit, provided this copyright
* notice is retained.
*
* Modification History:
*
* Version Date Who Comments
*
* 1.0.00 870701 Roberto Bagnara First official release
use DefsFile
Edition equ 0
psect K68IOFunctions,0,0,Edition,0,0
********************************* ConInp ******************************ok
* *
* Expect a character from the terminal line. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B character received *
* D1.B AllOk completion code *
* *
***********************************************************************
ConInp: MOVEQ #Terminal,D1 Terminal line I/O channel
BSR InpChar Try to read a character
TST.B D1 All ok ?
BNE.S ConInp No, assume not ready for input, wait
RTS Yes, return
********************************* ConOut ******************************ok
* *
* Send a character to the terminal line. *
* *
* Entry conditions : D0.B character to send *
* *
* Exit conditions : D0.B character just sent *
* D1.B completion code *
* *
***********************************************************************
ConOut: MOVEQ #Terminal,D1 Terminal line I/O channel
BSR OutChar Try to send the character
RTS Return completion code from OutChar
********************************* HostOut *****************************ok
* *
* Send a character to the host line adding a parity bit. *
* *
* Entry conditions : D0.B character to send *
* *
* Exit conditions : D0.B character just sent *
* D1.B completion code *
* *
***********************************************************************
HostOut: BSR DoPrity Add an appropriate parity bit
MOVEQ #HostLine,D1 Terminal line I/O channel
BSR OutChar Try to send the character
RTS Return completion code from OutChar
********************************* FileOut *****************************ok
* *
* Write a character to the current I/O file. If an error occurs *
* during output then set an interruption flag to stop the file *
* transfer. *
* *
* Entry conditions : D0.B character to send *
* *
* Exit conditions : D0.B character just sent *
* D1.B completion code *
* *
***********************************************************************
FileOut: MOVEQ #IOFile,D1 Current file I/O channel
BSR OutChar Output the character to it
TST.B D1 Some error ?
BEQ.S FileOut1 No, return
ST CtlZSeen(A6) Yes, interrupt the file transfer
FileOut1 RTS
******************************* ConWrite ******************************ok
* *
* Write a null terminated string on the terminal line. *
* *
* Entry conditions : A0.L pointer to string buffer *
* *
* Exit conditions : D1.L destroyed *
* *
***********************************************************************
ConWrite: MOVEQ #Terminal,D1 Terminal line I/O channel
BSR.S Write Write now
RTS
******************************* TypeUNum ******************************ok
* *
* Write a decimal unsigned number to the terminal line. *
* *
* Entry conditions : D0.L number to be typed *
* *
* Exit conditions : none *
* *
***********************************************************************
TypeUNum: MOVEM.L D1-D3,-(A7) Save working registers
SF D1 Unsigned conversion wanted
MOVEQ #0,D2 Null field
MOVEQ #10,D3 Base 10
LEA DataBuf+34(A6),A0 Point to the end of a temporary buffer
BSR IntToAs Convert the number into a string
BSR ConWrite Write the obtained string
MOVEM.L (A7)+,D1-D3 Restore working registers
RTS
********************************* Write *******************************ok
* *
* Write a null terminated string on a logical channel. *
* *
* Entry conditions : D1.B channel number *
* A0.L pointer to string buffer *
* *
* Exit conditions : D1.B channel number *
* *
***********************************************************************
Write: MOVE.W D2,-(A7) Save working register
MOVE.B D1,D2 Save channel number
Write1 MOVE.B (A0)+,D0 Get a character
BEQ.S Write2 Leave if end of string reached
BSR OutChar Send the character, assume no errors
MOVE.B D2,D1 Restore channel number
BRA.S Write1 Repeat until end of string
Write2 MOVE.W (A7)+,D2 Restore working register
RTS
********************************* NewLine *****************************ok
* *
* Send a newline sequence (CR+LF) to the terminal line. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.L destroyed *
* *
***********************************************************************
NewLine: MOVE.L D1,-(A7) Save this register, destroyed by ConOut
MOVEQ #Asc_CR,D0 Send a CR
BSR ConOut
MOVEQ #Asc_LF,D0 And then a LF
BSR ConOut
MOVE.L (A7)+,D1 Restore working register
RTS
********************************* CCmdIn ******************************ok
* *
* Input a command line from the terminal line, store it to CmdBuf. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B completion code, false on EOF *
* *
***********************************************************************
CCmdIn: MOVEM.L A0-A1/D1-D3,-(A7) Save working registers
LEA CmdBuf(A6),A0 Start address
MOVEA.L A0,A1 Save start address
CCmdIn1 BSR ConInp Get a character
CMPI.B #Asc_Sub,D0 EOF character ?
BEQ.S CCmdIn10 Yes
CMPI.B #Asc_CR,D0 CR ?
BEQ.S CCmdIn8 Yes
CMPI.B #Asc_LF,D0 CR ?
BEQ.S CCmdIn8 Yes
CMPI.B #Asc_FF,D0 CR ?
BEQ.S CCmdIn8 Yes
CMPI.B #Asc_Del,D0 Delete ?
BEQ.S CCmdIn2 Yes
CMPI.B #Asc_BS,D0 Backspace ?
BNE.S CCmdIn3 No
CCmdIn2 CMPA.L A1,A0 At line begin ?
BEQ.S CCmdIn1 Yes, no action
BSR.S CCmdIn11 No, delete last character
BRA.S CCmdIn1 Another character please !
CCmdIn3 CMPI.B #Asc_Can,D0 Ctrl X ?
BNE.S CCmdIn5 No
CCmdIn4 CMPA.L A1,A0 At line begin ?
BEQ.S CCmdIn1 Yes, exit
BSR.S CCmdIn11 No, delete last character
BRA.S CCmdIn4 Repeat until the whole line is deleted
CCmdIn5 MOVE.B D0,(A0)+ Store the character
CMPI.B #' ',D0 Printable character ?
BGE.S CCmdIn6 Yes, print it out
CMPI.B #Asc_HT,D0 Horizontal tab ?
BEQ.S CCmdIn6 Yes, print it out
ADDI.B #64,D0 Make it printable
MOVEQ #'^',D2 Prefix character for control
EXG D0,D2 Exchange
BSR ConOut Output prefix
EXG D0,D2 Exchange
CCmdIn6 BSR ConOut Output character
CCmdIn7 MOVE.L A0,D3 Other characters to read ?
SUB.L A1,D3
CMPI.W #CmdBufLn,D3
BLT.S CCmdIn1 Yes, again please !!!
CCmdIn8 ST D0 Return a positive completion code
CCmdIn9 CLR.B (A0)+ Null as terminator
MOVEM.L (A7)+,A0-A1/D1-D3 Restore working registers
RTS
CCmdIn10 SF D0 Return a negative cc, EOF on input
BRA.S CCmdIn9 Join common part
CCmdIn11 MOVE.B -(A0),D0 Back off
CMPI.B #' ',D0 Printable character ?
BGE.S CCmdIn12 Yes, only one character to delete
BSR.S CCmdIn13 No, delete the prefix
CCmdIn12 BSR.S CCmdIn13 Delete character
RTS
CCmdIn13 MOVEQ #Asc_BS,D0 Delete the last character
BSR ConOut
MOVEQ #' ',D0
BSR ConOut
MOVEQ #Asc_BS,D0
BSR ConOut
RTS
********************************* FlCmdIn *****************************ok
* *
* Input a command line from a take file, store it to CmdBuf. *
* *
* Entry conditions : D1.B take file channel number *
* *
* Exit conditions : D0.B completion code *
* D1.B destroyed *
* D2.B destroyed *
* A0.L destroyed *
* *
***********************************************************************
FlCmdIn: LEA CmdBuf(A6),A0 Pointer to target buffer
MOVE.B D1,D2 Save the channel number
FlCmdIn1 BSR InpChar Try to get a character
CMP.B #AllOk,D1 Ok ?
BEQ.S FlCmdIn3 Yes
CMP.B #EndOfFil,D1 End of file ?
BEQ.S FlCmdIn2 Yes, return the proper completion code
LEA FlCmdStr(PC),A0 No, some error during read
BSR ConWrite Give this message
FlCmdIn2 SF D0
RTS
FlCmdIn3 CMPI.B #NewLinCh,D0 End of line ?
BEQ.S FlCmdIn4 Yes, exit loop
MOVE.B D0,(A0)+ No, store the character just read
MOVE.B D2,D1 Reload channel number for the next read
BRA.S FlCmdIn1 Stay in loop
FlCmdIn4 CLR.B (A0) Terminate the command buffer
ST D0 Return a positive completion code
RTS
********************************* McCmdIn *****************************ok
* *
* Input a command line from a macro, store it to CmdBuf. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B completion code *
* A0.L destroyed *
* A1.L destroyed *
* *
***********************************************************************
McCmdIn: LEA CmdBuf(A6),A0 Pointer to target buffer
MOVEA.L MacroPnt(A6),A1 Pointer to source buffer
TST.B (A1) Are we at the end of the macro body ?
BEQ.S McCmdIn4 Yes, end of macro, return false
McCmdIn1 MOVE.B (A1)+,D0 Get a character
BEQ.S McCmdIn2 If null, this is the last line
CMPI.B #Asc_CR,D0 End of line ?
BEQ.S McCmdIn3 Yes, ...
MOVE.B D0,(A0)+ Store the character in target buffer
BRA.S McCmdIn1 Loop until end of line
McCmdIn2 SUBQ.L #1,A1 Still point to the null, next time ...
McCmdIn3 MOVE.L A1,MacroPnt(A6) Save the pointer to next macro line
CLR.B (A0) Terminate the command buffer
ST D0 Return a positive completion code
RTS
McCmdIn4 SF D0 End of macro, return a negative cc
RTS
********************************* SendPad *****************************ok
* *
* Send padding characters to the communication line. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B destroyed *
* *
***********************************************************************
SendPad: MOVEM.L D1-D2,-(A7) Save working registers
CLR.W D2 Clear counter register
MOVE.B OPadNumb(A6),D2 Number of padding char to send
BRA.S SendPad2 Enter loop
SendPad1 MOVE.B OPadChar(A6),D0 Padding character to send
BSR HostOut Send padding character to host line
SendPad2 DBF D2,SendPad1 Repeat
MOVEM.L (A7)+,D1-D2 Restore working registers
RTS
********************************* TxPackt *****************************ok
* *
* Send the packet stored in SendBuf to the host line. *
* *
* Entry conditions : none *
* *
* Exit conditions : none *
* *
***********************************************************************
TxPackt: MOVEM.L D1/A0,-(A7) Save working registers
BSR SendPad Do any requested padding
LEA SendBuf(A6),A0 Packet buffer start
TxPackt1 MOVE.B (A0)+,D0 Get a character
BEQ.S TxPackt2 Leave if end of string reached
BSR HostOut Send the character
ADDQ.L #1,ChrsSent(A6) Increment chars sent this transaction
ADDQ.L #1,TChsSent(A6) Increment total characters sent
BRA.S TxPackt1 Repeat until end of string
TxPackt2 ADDQ.L #1,PcksSent(A6) Increment packets sent this trans
ADDQ.L #1,TPckSent(A6) Increment total packets sent
MOVEM.L (A7)+,D1/A0 Restore working registers
RTS
******************************** InpLine ******************************ok
* *
* Input a line (up to the break char) from the communication line. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.L number of characters received *
* D1.B completion code *
* A0.L destroyed *
* D2.L destroyed *
* D3.W destroyed *
* D4.B destroyed *
* *
***********************************************************************
InpLine: LEA RecBuf(A6),A0 Point to receive buffer
CLR.L D2 Clear the character counter
CLR.W D3 Clear the timeout counter
TST.B TurnFlag(A6) Is the turnaround handshake flag on ?
BEQ.S InpLine0 No, look for Input EOL as terminator
MOVE.B TurnChar(A6),D4 Yes, turnaround character as terminator
BRA.S InpLine1
InpLine0 MOVE.B IEOL(A6),D4 Load the Input End Of Line character
InpLine1 MOVE.B ITimInt(A6),D3 Preset the timeout counter
InpLine2 BSR RdChrTO Get a character
TST.B D1 Timed out ?
BNE.S InpLine3 No, continue
DBF D3,InpLine2 Yes, repeat unless timeout limit reached
SF D1 Provide a negative completion code
RTS
InpLine3 CMP.B D4,D0 End Of Line or turnaround character ?
BEQ.S InpLine4 Yes
MOVE.B D0,(A0)+ No, got a character, save it
ADDQ.L #1,D2 Increment the character counter
CMPI.B #RBufLen,D2 Receive buffer full ?
BNE.S InpLine1 No, again please !
InpLine4 CLR.B (A0) Mark the end of buffer
ADD.L D2,ChrsRecd(A6) Increment chars received this transaction
ADD.L D2,TChsRecd(A6) Increment total characters received
MOVE.L D2,D0 Return number of characters received
ST D1 Return a positive completion code
RTS
******************************** RdChrTO ******************************ok
* *
* Called only by InpLine, read a character from the host line with *
* 1 second software timeout limit. Warning, this routine is *
* absolutely provisory. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B character received *
* D1.B completion code *
* *
***********************************************************************
MaxIter SET 10000 To set the timeout value
*
RdChrTO MOVE.W D2,-(A7) Save the counter register
MOVE.W #MaxIter,D2 Set up the timeout counter
RdChrTO1 MOVEQ #HostLine,D1 Try to read the host line
BSR InpChar
TST.B D1 Check completion code
BEQ.S RdChrTO2 Character received, handle 8th bit
DBF D2,RdChrTO1 Timeout period expired ?
SF D1 Yes, return negative completion code
MOVE.W (A7)+,D2 Restore the counter register
RTS
RdChrTO2 BSR HndlPar Handle the parity bit
ST D1 Return positive completion code
MOVE.W (A7)+,D2 Restore the counter register
RTS
********************************* ChkInpF *****************************ok
* *
* Check if an input file exists and is readable. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B completion code *
* *
* -3 file exists but protected from read *
* -2 file exists but is not readable *
* -1 inexistent or inaccessable file *
* 0 all ok *
* *
* D1.L destroyed *
* D2.B destroyed *
* *
***********************************************************************
ChkInpF: MOVEQ #ReadOp,D0 Try to open for read the input file
MOVEQ #IOFile,D1 Assign it to this channel number
BSR FilOpen Open now
TST.B D0 Some failure ?
BEQ.S ChkInpF1 Yes, return this bad completion code
MOVEQ #IOFile,D1 No, try to read a character
BSR InpChar
MOVE.B D1,D2 Save the returned completion code
MOVEQ #IOFile,D1 Close the file just opened
BSR FilClose
TST.B D2 The read was successful ?
BEQ.S ChkInpF0 Yes, all ok
CMPI.B #EndOfFil,D2 No, end of file ?
BEQ.S ChkInpF0 Yes, the file is null, but ok
CMPI.B #ResChan,D2 No privilege to read this file ?
BEQ.S ChkInpF2 Yes, return this bad completion code
MOVEQ #-2,D0 No, some other error, unreadable file cc
RTS
ChkInpF0 MOVEQ #0,D0 Return all ok
RTS
ChkInpF1 MOVEQ #-1,D0 Return inexistent file cc
RTS
ChkInpF2 MOVEQ #-3,D0 Return protected file cc
RTS
********************************* ChkOutF *****************************ok
* *
* Check if an output file can be created. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.B completion code *
* *
* -1 permission denied *
* 0 all ok *
* *
***********************************************************************
ChkOutF: MOVEQ #0,D0 Always succeeds for now
RTS
********************************* OpnInpF *****************************ok
* *
* Try to open an existing file for input. *
* *
* Entry conditions : A0.L pointer to the file name *
* *
* Exit conditions : A0.L pointer to the file name *
* D0.B completion code *
* D1.L destroyed *
* *
***********************************************************************
OpnInpF: MOVE.B MStrFlag(A6),D0 Input from memory string ?
BNE.S OpnInpF1 Yes, return a positive cc
MOVEQ #ReadOp,D0 Try to open the input file
MOVEQ #IOFile,D1
BSR FilOpen
TST.B D0 Open succeed ?
BEQ.S OpnInpF1 Yes, return this completion code
BSR CRemTLoc No, convert name to local form
MOVEQ #ReadOp,D0 Try again to open the input file
MOVEQ #IOFile,D1
BSR FilOpen
OpnInpF1 RTS Return cc from FilOpen
********************************* OpnOutF *****************************ok
* *
* Try to open an existing file for output. *
* *
* Entry conditions : A0.L pointer to the file name *
* A1.L pointer to the file name *
* target buffer *
* *
* Exit conditions : A0.L pointer to the file name target *
* buffer containing the file name *
* under wich the file was opened *
* D0.B completion code *
* D1.L destroyed *
* *
***********************************************************************
OpnOutF: MOVE.B TermOut(A6),D0 Terminal output wanted ?
BNE.S OpnOutF3 Yes, return a positive cc
MOVE.B CtlXSeen(A6),D0 Some interruption ?
OR.B CtlZSeen(A6),D0
BNE.S OpnOutF3 Yes, don't destroy existing file
EXG A0,A1 Exchange buffers pointers
MOVEQ #FilNamML,D0 Load buffers length
BSR CopyStr Fill target buffer, copy from source
TST.B FNameCnv(A6) File names conversion ?
BEQ.S OpnOutF1 No, proceed
BSR CRemTLoc Yes, convert file name to local form
OpnOutF1 TST.B Warning(A6) File collision avoidance ?
BEQ.S OpnOutF2 No, proceed
BSR ChkInpF Yes, check if file exists
CMPI.B #-1,D0 File exists ?
BEQ.S OpnOutF2 No, proceed
BSR NewName Yes, make a new name
OpnOutF2 MOVEQ #WriteOp,D0 Finally open the file for output
MOVEQ #IOFile,D1
BSR FilOpen
OpnOutF3 RTS Return the completion code
********************************* ClsInpF *****************************ok
* *
* Close the current input file. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.L destroyed *
* D1.L destroyed *
* *
***********************************************************************
ClsInpF: TST.B MStrFlag(A6) Input from memory string ?
BEQ.S ClsInpF1 No, close the input file
SF MStrFlag(A6) Yes, reset flag
BRA.S ClsInpF2
ClsInpF1 MOVEQ #IOFile,D1 Close the output file
BSR FilClose
ClsInpF2 MOVE.B CtlXSeen(A6),D0 File interrupt ...
OR.B CtlZSeen(A6),D0 ... or file group interrupt ?
BNE.S ClsInpF3 Yes, give discard message
MOVEQ #FlTranOk,D0 No, give comforting messages
BSR Screen
BRA.S ClsInpF4
ClsInpF3 MOVEQ #FlDiscrd,D0 Give discard message
BSR Screen
ClsInpF4 SF CtlXSeen(A6) Reset file interrupt flag
CLR.B FilName(A6) Nullify current file name
RTS
********************************* ClsOutF *****************************ok
* *
* Close the current output file. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.L destroyed *
* D1.L destroyed *
* A0.L destroyed *
* *
***********************************************************************
ClsOutF: TST.B TermOut(A6) Output to the terminal line ?
BNE.S ClsOutF3 Yes, just reset flag and return
LEA FilName(A6),A0 No, point to current file name
TST.B (A0) File open ?
BEQ.S ClsOutF1 No
MOVEQ #IOFile,D1 Yes, close the output file
BSR FilClose
MOVE.B CtlXSeen(A6),D0 File interrupt ...
OR.B CtlZSeen(A6),D0 ... or file group interrupt ?
BEQ.S ClsOutF1 No, just keep it
TST.B Keep(A6) Yes, keeping incomplete files ?
BNE.S ClsOutF1 Yes
BSR FilDelet No, discard it
MOVEQ #FlDiscrd,D0 Give discard message
BSR Screen
BRA.S ClsOutF2 Nullify file name and return
ClsOutF1 MOVEQ #FlTranOk,D0 Give comforting messages
BSR Screen
ClsOutF2 CLR.B (A0) Nullify current file name
RTS
ClsOutF3 SF TermOut(A6) Clear the terminal output flag
RTS
********************************* ChekInt *****************************ok
* *
* Terminal interrupts handler. *
* *
* Entry conditions : none *
* *
* Exit conditions : D0.L destroyed *
* D1.L destroyed *
* A1.L destroyed *
* *
***********************************************************************
ChekInt: TST.B Local(A6) Are we running in local mode ?
BEQ.S ChekInt1 No, return
TST.B Quiet(A6) Quiet requested ?
BNE.S ChekInt1 Yes, return
MOVEQ #Terminal,D1 Try to get a character from terminal
BSR InpChar
TST.B D1 Success ?
BNE.S ChekInt1 No, return
CMPI.B #Asc_Sub,D0 Control Z ?
BEQ.S ChekInt2 Yes
CMPI.B #Asc_Can,D0 Control X ?
BEQ.S ChekInt3 Yes, set the file interrupt flag
CMPI.B #Asc_DC2,D0 Control R ?
BEQ.S ChekInt4 Yes, resend the last packet
MOVEQ #Asc_Bel,D0 No, ignore, ring the bell
BSR ConOut
ChekInt1 RTS
ChekInt2 LEA CnBchStr(PC),A1 Cancel batch
MOVEQ #TxtDlBeg,D0 Give message
BSR Screen
ST CtlZSeen(A6) Set the file batch interrupt flag
RTS
ChekInt3 LEA CnFilStr(PC),A1 Cancel file
MOVEQ #TxtDlBeg,D0 Give message
BSR Screen
ST CtlXSeen(A6) Set the file interrupt flag
RTS
ChekInt4 LEA ReSndStr(PC),A1 Resend packet
MOVEQ #TxtDlBeg,D0 Give message
BSR Screen
BSR Resend Resend the last packet
RTS
********************************** Screen *****************************ok
* *
* Screen diplay routine. *
* *
* Entry conditions : D0.B request code *
* D1.B packet type or pseudotype *
* D2.B packet number *
* D3.B packet length *
* A1.L pointer to a string to write *
* *
* Exit conditions : none *
* *
***********************************************************************
ScrnMxLL EQU 78 Maximum line length
Screen: TST.B Display(A6) The display flag is off ?
BEQ.S Screen1 Yes, no update
TST.B Quiet(A6) Are we requested to be quiet ?
BEQ.S Screen2 No, update the screen
Screen1 RTS
Screen2 MOVEM.L A0-A1/D1-D7,-(A7) Save some registers
MOVE.B LinLngth(A6),D6 Length of the current screen line
CLR.W D4 Compute the length of the passed string
Screen3 TST.B (A1,D4.W) End of line ?
BEQ.S Screen4 Yes, continue
ADDQ.B #1,D4 No, count
BRA.S Screen3 Repeat until end of line
Screen4 MOVEQ #ScrnMxRq,D5 Maximum request code
CMP.W D5,D0 Request code out of range ?
BHI Screen30 Yes, return
ADD.W D0,D0 No, scale it
MOVE.W Screen5(PC,D0.W),D0 Relative address of the service routine
JMP Screen5(PC,D0.W) Jump to it
Screen5 DC.W Screen6-Screen5 SFilName
DC.W Screen7-Screen5 RFilName
DC.W Screen9-Screen5 FlAsName
DC.W Screen11-Screen5 XPckData
DC.W Screen12-Screen5 FlTranOk
DC.W Screen14-Screen5 FlDiscrd
DC.W Screen16-Screen5 FlIntrrp
DC.W Screen18-Screen5 FlSkippd
DC.W Screen19-Screen5 PackType
DC.W Screen22-Screen5 TranCmpl
DC.W Screen23-Screen5 ErrMessg
DC.W Screen24-Screen5 WarnMess
DC.W Screen25-Screen5 UndelTxt
DC.W Screen27-Screen5 TxtDlBeg
DC.W Screen28-Screen5 TxtDlEnd
Screen6 LEA ScrnStr1(PC),A0 Display outgoing file name
BRA.S Screen8
Screen7 LEA ScrnStr2(PC),A0 Display inbound file name
Screen8 BSR NewLine Display file name
BSR ConWrite
MOVE.B #10,D6
MOVEA.L A1,A0
BSR ConWrite
MOVEQ #' ',D0
BSR ConOut
ADD.B D4,D6
ADDQ.B #1,D6
BRA Screen30
Screen9 MOVE.B D4,D5 Display file as-name
ADD.B D6,D5
CMPI.B #ScrnMxLL-3,D5
BLS.S Screen10
BSR NewLine
CLR.B D6
Screen10 LEA ScrnStr3(PC),A0
BSR ConWrite
MOVEA.L A1,A0
BSR ConWrite
MOVEQ #' ',D0
BSR ConOut
ADD.B D4,D6
ADDQ.B #3+1,D6
CMPI.B #ScrnMxLL,D6
BLS Screen30
BSR NewLine
CLR.B D6
BRA Screen30
Screen11 BSR NewLine Display X-packet data
MOVEA.L A1,A0
BSR ConWrite
BSR NewLine
CLR.B D6
BRA Screen30
Screen12 CMPI.B #ScrnMxLL-5,D6 Successful file transfer message
BLS.S Screen13
BSR NewLine
CLR.B D6
Screen13 LEA ScrnStr4(PC),A0
BSR ConWrite
ADDQ.B #5,D6
BRA Screen30
Screen14 CMPI.B #ScrnMxLL-12,D6 File discarded message
BLS.S Screen15
BSR NewLine
CLR.B D6
Screen15 LEA ScrnStr5(PC),A0
BSR ConWrite
ADDI.B #12,D6
BRA Screen30
Screen16 CMPI.B #ScrnMxLL-14,D6 File transfer interrupted message
BLS.S Screen17
BSR NewLine
CLR.B D6
Screen17 LEA ScrnStr6(PC),A0
BSR ConWrite
ADDI.B #14,D6
BRA Screen30
Screen18 BSR NewLine File skipped message
LEA ScrnStr7(PC),A0
BSR ConWrite
MOVEA.L A1,A0
BSR ConWrite
BSR NewLine
CLR.B D6
BRA Screen30
* Display packet type or pseudo-type
Screen19 CMPI.B #'Y',D1 ACK packet ?
BEQ Screen30 Yes, return
CMPI.B #'D',D1 Data packet ?
BNE.S Screen20 No
ANDI.B #3,D2 Yes, only display every 4 packets
BNE Screen30 Return
MOVEQ #'.',D0
BRA.S Screen21
Screen20 MOVE.B D1,D0 Display the packet type
Screen21 BSR ConOut
ADDQ.B #1,D6 Increment current line length
CMPI.B #ScrnMxLL,D6 Near the right margin ?
BLS.S Screen30 No, return
BSR NewLine Yes, start a new line
CLR.B D6 Reset the counter
BRA.S Screen30
Screen22 MOVEQ #Asc_Bel,D0 Transaction complete message (bell)
BSR ConOut
BSR NewLine Start a new line
BRA.S Screen30
Screen23 BSR NewLine Error message
MOVEQ #'?',D0
BSR ConOut
MOVEA.L A1,A0
BSR ConWrite
BSR NewLine
CLR.B D6
BRA.S Screen30
Screen24 BSR NewLine Warning message
MOVEA.L A1,A0
BSR ConWrite
BSR NewLine
CLR.B D6
BRA.S Screen30
Screen25 ADD.B D4,D6 Undelimited text
CMPI.B #ScrnMxLL,D6
BLS.S Screen26
BSR NewLine
MOVE.B D4,D6
Screen26 MOVEA.L A1,A0
BSR ConWrite
BRA.S Screen30
Screen27 BSR NewLine Text delimited at beginning
MOVEA.L A1,A0
BSR ConWrite
MOVE.B D4,D6
BRA.S Screen30
Screen28 ADD.B D4,D6 Text delimited at end
CMPI.B #ScrnMxLL,D6
BLS.S Screen29
BSR NewLine
MOVE.B D4,D6
Screen29 MOVEA.L A1,A0
BSR ConWrite
BSR NewLine
* BRA.S Screen30
Screen30 MOVE.B D6,LinLngth(A6)
MOVEM.L (A7)+,A0-A1/D1-D7
RTS
ends
END