.MCall .Module .Module KEDSC2 RELEASE=V02 VERSION=09 COMMENT=,IDENT=NO,AUDIT=NO,GLOBAL=.KEDS2 ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .Enable LC .Enable GBL ; ;MODULE: KEDSC2 ; ;ABSTRACT: ; ; This module contains the file scroller setup routines. ; .MCall AbtOn AbtOff IsAbt .MCall JouOn JouOff IsJou .MCall SavReg PSect Push Pop .Br .MCall $ReadW $WritW ...... .SbTtl Define error macro $KED$ = 1 ;Defined here but not in error module ; ;The following code is included as an error section so that it will be ;pulled out and assembled in the error module also. In this module, the ;error macro is defined to print the error message. In the error module, ;the macro is defined to assemble the message text. ;+ ;ERROR ; .IIf NDF,$KED$, .Page .IIf NDF,$KED$, .SbTtl Errors from KEDSC2 module ; ;Define the error macro for this module ; .MCall ErrDef ErrDef S2,ERR ;Invoke macro to define error macro ;- .SbTtl .SbTtl PSECT DEFINITIONS ; ; PSect definitions ; PSect KEDSCL ;CODE PSect PSect IMPURE ;DATA PSect PSect KEDSCL .SbTtl .SbTtl ERR - ERROR ROUTINE FOR THIS MODULE ;++ ;ERR ; ;FUNCTIONAL DESCRIPTION: ; ; Module wide error routine ; ;This routine always goes to FATAL to save some words here ;This is the only code in this module which is not pure code ; ;Note that the error routine overlays this code with the error messages ;but this code is back in before return here. Note also that the ;contents of 10$ is thereby blown but this does not matter since it ;is not used after the call. ; ;INPUT: ; Jsr R4,ERR ; .Word ERRMSG ;Address of error message ; ;OUTPUT: NONE ;-- .Enable LSB Err: ;~x~ Bic #T.SEr!T.Exe,TtInp ;Always allow printing Mov (R4)+,ErrorX ;Impure store the error address Jsr R4,ErrorV ;~x~Call routine in command module Pop ;Restore R4 .Br Fatal .SbTtl FATAL - FATAL ERROR ENTRY ;++ ;FATAL ; ;FUNCTIONAL DESCRIPTION: ; ; Fatal error entry point ; Entry taken on all non recoverable errors ; ;INPUT: NONE ; ;OUTPUT: NONE ;-- Fatal: Jmp $Fatal ;~x~Entry to command module .............. .Dsabl LSB .SbTtl SETUP - INITIALIZE ALL THINGS ;++ ;SETUP ; ;FUNCTIONAL DESCRIPTION: ; ; Initialize impure data for scroller operation ; ;INPUT: ; R0 = start of playground ; R1 = end of playground ; R2 = blocking factor (N*SCBMIN) ; ;OUTPUT: ; All registers preserved ; No errors ;-- .Enable LSB Setup:: SavReg ;~x~ Mov R0,PlyGnd Dec R0 ;Char before Mov R0,BCP ;Backward pointer Mov R1,FCP ;End of play area pointer Mov R1,PlyEnd ;And rememberance of it ClrB @BCP ;Safe char at start of playgnd Mov R2,ScByts ;Bytes to scroll by Asr R2 ;Words to R/W Mov R2,ScWds Mov #SpcMin,ScnSpc ;Minimum screen space ; ; Make actual number of blocks to R/W ; Our blocks are 256 wds, R2 contains SCWDS ; Bit #377,R2 ;Make sure of words Bne 10$ ;~x~Inconsistant word count SwaB R2 Mov R2,ScBlks ;Save blocks to R/W Mov #Area,R3 ;Make address of area Tst (R3)+ ;Point to actual data area Mov R3,R4 ;Get copy of addr Mov R4,-(R3) ;Save address to it Return ;~x~ ...... 10$: ;~x~ ;+ ;ERROR ERROR ,F ;~x~ ;Allocation routine $ALLOC returned blocking factor which was not an ;integral number of blocks. Logic error. ;- .Dsabl LSB .SbTtl FILSET - SETUP FILE DATA FOR SCROLLING ;++ ;FILSET ; ;FUNCTIONAL DESCRIPTION: ; ; Setup file data for scrolling ; ;INPUT: ; ;OUTPUT: ; Files setup ;-- .Enable LSB FilSet:: ;~x~ SavReg ;Save registers Clr InFlg ;Input file in use Mov #In$Chn,FwdChn ;Input file fwd channel Mov #Ou$Chn,BkwChn ;Assume back channel is output file Tst Inspct ;Writing to output or temp file? Beq 10$ ;~x~Br if so Mov #In$Chn,BkwChn ;Else back channel is input file 10$: Mov MxIBlk,BlkMax ;~x~Save for all time Clr FwdBlk ;Setup block numbers for use Clr InBlk ;Input block number Mov ScBlks,R0 ;Make first bkw block Neg R0 ;As minus backward block Mov R0,BkwBlk ;No backward blocks to read Mov PlyGnd,BCP ;Initialize char pointers Dec BCP ; Mov PLYEND,FCP ; Call SclStr ;~x~Startup for scrolling ;>>> huh? why here??? Call $SpOn ;~x~Special mode on again Clc ;Return with no error Return ;~x~On error return C set ...... .Dsabl LSB .SbTtl SCLSTR - START FILE SCROLLING ;++ ;SCLSTR ; ;FUNCTIONAL DESCRIPTION: ; ; Memory is loaded from file by four blocks if minimum size ; playground is in use else two reads are done if space ; is available. ; ;INPUT: NONE ; ;OUTPUT: ; File data is available ;-- .Enable LSB SclStr:: ;~x~ .Rept 2 ;Fill as much space as possible Call RdFwd ;~x~Read a block Bcs 10$ ;~x~Signal error .EndR Cmp ScByts,#ScBMin ;Got enough?? Bhi 10$ ;~x~Yes- there is no more space ;in PLYGND Call RdFwd ;~x~Read two more to fill screen space Bcs 10$ ;~x~ Call RdFwd ;~x~With text from file 10$: Return ;~x~ ...... .Dsabl LSB .End