;
;        NAME    B3780C          ;USER CONFIGURATION MODULE
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                               ;
;       (C) 1982 MICRO-INTEGRATION INC. ALL RIGHTS RESERVED,    ;
;       NO PART OF THIS PROGRAM OR PUBLICATION MAY BE           ;
;       REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN         ;
;       A RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE     ;
;       OR COMPUTER LANGUAGE, IN ANY FORM OR BY ANY MEANS,      ;
;       ELECTRONIC, MECHANICAL, MAGNETIC, OPTICAL, CHEMICAL,    ;
;       MANUAL OR OTHERWISE, WITHOUT THE PRIOR WRITTEN          ;
;       PERMISSION OF:                                          ;
;                     MICRO-INTEGRATION INC.                    ;
;                     63 MAPLE STREET                           ;
;                     FRIENDSVILLE, MD. 21531                   ;
;                     USA , EARTH                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                               ;
;	PROGRAM		: BISYNC 80/3780			;
;			  USER CONFIGURATION MODULE		;
;	VERSION		: 4.2   (1982)				;
;                                                               ;
;	COMPUTER	: PHILIPS  P3500         		;
;	TERMINAL	: PHILIPS  P2711/P2712   		;
;								;
;	PREPARED BY	: FRANK VAN DE RIDDER			;
;	  		: PHILIPS DATA SYSTEMS			;
;	  		: POSTBUS 245         			;
;			: 7300 AE  APELDOORN          		;
;								;
;	DATE		: 30.09.82				;
;	UPDATE		: 07.03.83				;
;                                                               ;
;                                                               ;
;       THIS MODULE MUST BE CHANGED IF THE LINK'S INITIAL       ;
;       I/O PORT ADDRESSES OR RUN TIME PARAMETERS ARE TO BE     ;
;       CHANGED.                                                ;
;                                                               ;
;                                                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
TRUE    EQU     1
FALSE   EQU     0
M2770   EQU     4
M3780   EQU     2
M3741	EQU	6
M2780	EQU	0
MCPU    EQU     8
IN8251  EQU     2
Z80SIO  EQU     3
IN8274	EQU	3
CPM	EQU	5
BASEAD  EQU     100H            ;BASE ADDRESS FOR THIS MODULE
        ORG     BASEAD          ;ORG TO MODULE START ADDRESS
        JMP     USDTIN          ;USART DATA INPUT
        JMP     USDTOT          ;USART DATA OUTPUT
        JMP     USSTIN          ;USART STATUS INPUT
        JMP     USSTOT          ;USART STATUS OUTPUT
        JMP     TMCTOT          ;TIMER CONTROL OUTPUT
        JMP     TMDTIN          ;TIMER DATA INPUT
	JMP	TMDTOT		;TIMER DATA OUTPUT
	JMP	RTMODE		;RETURN DEVICE MODE
        JMP     RTCMPR          ;RETURN COMPRESS DEFAULT
        JMP     RTCMTB          ;RETURN COMMAND TABLE ADDRESS
        JMP     RTXLAT          ;RETURN TRANSLATE TABLE ADDRESS
        JMP     RTFLEX          ;RETURN NOTRANSLATE FILE EXTENSIONS
	JMP	RTRTSA		;RETURN REQUEST TO SEND ASSERT MODE
        JMP     RTSCBR          ;RETURN BAUD RATE CLOCK SET VALUE
        JMP     LSTDRV          ;LIST CHAR ROUTINE
	JMP     SETIO		;SET I/O DEVICE BYTE
	JMP	SETCPU		;ADJUST TIMING FOR CPU SPEED
        JMP     RTCNTM          ;RETURN CONSOLE TIMING VALUE
SUPPTR:	DW	STARTUP         ;START UP FILE NAME POINTERS
	JMP	FSTEXT		;
	JMP	EXTEXT		;
	JMP	INEXT		;
	JMP	OUTEXT		;
	JMP	INTEXT		;
	JMP	RTSEXT		;
	JMP	RSTEXT		;
	JMP	XMTEXT		;
	JMP	RCVEXT		;
;
;       THE FOLLOWING EQUATE STATEMENTS MAY BE CHANGED
;       TO RECONFIGURE THE LINK'S FACTORY SUPPLIED PARAMETERS FOR --
;
;               -       2780, 3780, 2770, 3741, OR CPU INITIAL STARTUP MODE
;               -       8251 USART, 8274 MPSC, OR SIO SERIAL PORT USE
;               -       CPU CLOCK SPEED
;               -       CONSOLE TERMINAL BAUD RATE
;               -       LIST DEVICE DRIVER ROUTINE
;               -       RJE COMMAND IDENTIFIER
;               -       TRANSLATE TABLES
;               -       FILENAME EXTENSIONS
;               -       3780 BLANK COMPRESSION
;               -       SELF CLOCKING BAUD RATE
;
DEVICE  EQU     M3780           ;CHANGE THIS STATEMENT TO 'M2780'
;                               ;TO CHANGE THE INITIAL STARTUP
;                               ;DEVICE MODE TO 2780 MODE OR TO
;                               ;'MCPU' TO CHANGE THE INITIAL
;				;STARTUP DEVICE MODE TO CPU
;				;OR M2770 FOR 2770 MODE OR M3741
;				;FOR 3741 STARTUP MODE.
;                               ;                                  
;                               ;LEAVE THIS STATEMENT 'M3780' TO HAVE
;                               ;THE INITIAL STARTUP MODE REMAIN
;                               ;3780 MODE.
;
IODEV   EQU     Z80SIO          ;CHANGE THIS STATEMENT TO 'Z80SIO'
;                               ;FOR USE WITH A Z-80 SIO I/O DEVICE.
;				;CHANGE THIS STATEMENT TO
;				;'IN8274' IF AN INTEL
;				;8274 MPSC DEVICE IS USED
;				;
;				;LEAVE THIS STATEMENT AS-IS IF
;				;THE LINK IS RUNNING ON AN INTEL
;				;8251 I/O DEVICE.
;
USDATA  EQU     00H             ;CHANGE THIS STATEMENT TO REFLECT
;                               ;THE I/O DEVICE DATA PORT ADDRESS
;				;ON THE Z-80 SIO, 8274 MPSC, OR
;				;8251 USARTBASED I/O BOARD
;                               ;BEING USED.
;                               ;SUPPLIED ADDRESS OF 80H.
;					
USSTAT  EQU     02H             ;CHANGE THIS STATEMENT TO REFLECT
;                               ;THE I/O DEVICE STATUS PORT ADDRESS
;                               ;ON THE Z-80 SIO, 8274 MPSC, OR
;				;8251 USART BASED I/O BOARD
;                               ;BEING USED.
;                               ;SUPPLIED ADDRESS OF 81H.
;
CPUSPD  EQU     02H		;CHANGE THIS STATEMENT TO REFLECT
;                               ;THE CPU CLOCK SPEED IN MEGA-HERTZ
;
CONSPD  EQU     4800            ;CHANGE THIS STATEMENT TO REFLECT
;                               ;THE MICROCOMPUTER CONSOLE TERMINAL
;                               ;BAUD RATE.
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	THE FOLLOWING IS THE ROUTINE USED TO WRITE DATA TO THE LIST   
;	DEVICE (PRINTER).  IF THE CP/M BIOS ROUTINE IS MODIFIED TO NOT 
;	WAIT ON THE PRINTER, THEN THIS ROUTINE MAY BE LEFT AS A CP/M  
;       CALL. IF THE CP/M BIOS ROUTINE IS NOT MODIFIED THEN CHANGE THIS
;       ROUTINE TO WRITE DATA TO THE PRINTER WITHOUT WAITING ON PRINTER
;       READY, PER THE USER MANUAL. SEE APPENDIX E FOR MORE DETAIL.    
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
LSTDRV	EQU	$		;                            
	CALL	CPM		; CPM LIST DRIVER ROUTINE
	RET			;BACK TO CALLER
;
;
;       THE FOLLOWING TABLE DEFINES THE HASP AND POWER CONSOLE
;       COMMAND IDENTIFIERS AND THE STRINGS TO BE SUBSTITUTED
;       FOR THE IDENTIFIER WHEN TRANSMITTING A CONSOLE COMMAND.
;       THE IDENTIFIERS AND/OR THE STRINGS MAY BE MODIFIED TO CAUSE
;       TRANSMISSION OF ANY STRING FOR ANY IDENTIFIER.
;
;       TABLE FORMAT :
;               1 BYTE IDENTIFIER LENGTH
;               N BYTES OF IDENTIFIER
;               2 BYTE ADDRESS OF SUBSTITUTE STRING
;
;               END OF TABLE DELIMITED BY A LENGTH BYTE
;               WITH A VALUE OF ZERO.
;
;       SUBSTITUTE STRING FORMAT:
;               1 BYTE STRING LENGTH
;               N BYTES OF STRING
;
;
;
;
CMDTAB  EQU     $
	DB	1		;IDENTIFIER LENGTH (MAX 255)
	DB	'$'		;IDENTIFIER
        DW      HASPCM          ;ADDRESS OF STRING TO SUBSTITUTE
;				;FOR IDENTIFIER
	DB	1		;IDENTIFIER LENGTH
        DB      '*'             ;IDENTIFIER
        DW      POWRCM          ;ADDRESS OF STRING TO SUBSTITUTE
;                               ;FOR IDENTIFIER
;
        DB      0               ;END OF TABLE - DO NOT REMOVE THIS
;                               ;STATEMENT
;
HASPCM: DB      2               ;SUBSTITUTE STRING LINGTH
        DB      '/*'            ;SUBSTITUTE STRING
;
POWRCM: DB      5               ;SUBSTITUTE STRING LENGTH
        DB      '* .. '         ;SUBSTITUTE STRING
;
;				;CHANGE FOLLOWING TWO STATEMENTS
;				;TO REFLECT THE LENGTH OF
;				;STRING (DO NOT INCLUDE THE LENGTH
;				;BYTE ITSELF) DEFINING THE
;				;START UP FILE NAME, IF
;				;NONE IS WANTED USE ZERO
;				FOR STRING LENGTH.
;
STARTUP:DB	0		;STRING LENGTH INCLUDING TERMINATORS
	DB	'FILNAM.EXT'	;FILE NAME STRING
	DB	0DH,0AH		;SCAN TERMINATOR (DO NOT REMOVE)
;
;
;
;       THE FOLLOWING TWO TABLES ARE THE ASCII TO EBCDIC
;       AND EBCDIC TO ASCII TRANSLATE TABLES USED BY THE
;       LINK IN CODE CONVERSION.  THESE TABLES MAY BE
;       MODIFIED TO ALLOW TRANSLATION OF ANY CHARACTER TO
;       ANY OTHER CHARACTER, SO LONG AS LINE CONTROL
;       CHARACTERS ARE NOT TRANSMITTED IN NON-TRANSPARENT
;       MODE.
;
;
ASCEBC  EQU     $               ;ASCII TO EBCDIC TRANSLATE TABLE
;
        DB      000H,001H,002H,003H,037H,02DH,02EH,02FH	 ;00H-07H
        DB      016H,005H,025H,00BH,00CH,00DH,00EH,00FH  ;08H-0FH
        DB      010H,011H,012H,013H,03CH,03DH,032H,026H  ;10H-17H
        DB      018H,019H,03FH,027H,01CH,01DH,01EH,01FH  ;18H-1FH
        DB      040H,04FH,07FH,07BH,05BH,06CH,050H,07DH  ;20H-27H
        DB      04DH,05DH,05CH,04EH,06BH,060H,04BH,061H  ;28H-2FH
        DB      0F0H,0F1H,0F2H,0F3H,0F4H,0F5H,0F6H,0F7H  ;30H-37H
        DB      0F8H,0F9H,07AH,05EH,04CH,07EH,06EH,06FH  ;38H-3FH
        DB      07CH,0C1H,0C2H,0C3H,0C4H,0C5H,0C6H,0C7H  ;40H-47H
        DB      0C8H,0C9H,0D1H,0D2H,0D3H,0D4H,0D5H,0D6H  ;48H-4FH
        DB      0D7H,0D8H,0D9H,0E2H,0E3H,0E4H,0E5H,0E6H  ;50H-57H
        DB      0E7H,0E8H,0E9H,04AH,0E0H,05AH,05FH,06DH  ;58H-5FH
        DB      079H,081H,082H,083H,084H,085H,086H,087H  ;60H-67H
        DB      088H,089H,091H,092H,093H,094H,095H,096H  ;68H-6FH
        DB      097H,098H,099H,0A2H,0A3H,0A4H,0A5H,0A6H  ;70H-77H
        DB      0A7H,0A8H,0A9H,0C0H,06AH,0D0H,0A1H,007H  ;78H-7FH
        DB      020H,021H,022H,023H,024H,015H,006H,017H  ;80H-87H
        DB      028H,029H,02AH,02BH,02CH,009H,00AH,01BH  ;88H-8FH
        DB      030H,031H,01AH,033H,034H,035H,036H,008H  ;90H-97H
        DB      038H,039H,03AH,03BH,004H,014H,03EH,0E1H  ;98H-9FH
        DB      041H,042H,043H,044H,045H,046H,047H,048H  ;A0H-A7H
        DB      049H,051H,052H,053H,054H,055H,056H,057H  ;A8H-AFH
        DB      058H,059H,062H,063H,064H,065H,066H,067H  ;B0H-B7H
        DB      068H,069H,070H,071H,072H,073H,074H,075H  ;B8H-BFH
        DB      076H,077H,078H,080H,08AH,08BH,08CH,08DH  ;C0H-C7H
        DB      08EH,08FH,090H,09AH,09BH,09CH,09DH,09EH  ;C8-CFH
        DB      09FH,0A0H,0AAH,0ABH,0ACH,0ADH,0AEH,0AFH  ;D0H-D7H
        DB      0B0H,0B1H,0B2H,0B3H,0B4H,0B5H,0B6H,0B7H  ;D8H-DFH
        DB      0B8H,0B9H,0BAH,0BBH,0BCH,0BDH,0BEH,0BFH  ;E0H-E7H
        DB      0CAH,0CBH,0CCH,0CDH,0CEH,0CFH,0DAH,0DBH  ;E8H-EFH
        DB      0DCH,0DDH,0DEH,0DFH,0EAH,0EBH,0ECH,0EDH  ;F0H-F7H
        DB      0EEH,0EFH,0FAH,0FBH,0FCH,0FDH,0FEH,0FFH  ;F8H-FFH
;
EBCASC  EQU     $               ;EBCDIC TO ASCII TRANSLATE TABLE
;
        DB      000H,001H,002H,003H,09CH,009H,086H,07FH  ;00H-07H
        DB      097H,08DH,08EH,00BH,00CH,00DH,00EH,00FH  ;08H-0FH
        DB      010H,011H,012H,013H,09DH,085H,008H,087H  ;10H-17H
        DB      018H,019H,092H,08FH,01CH,01DH,01EH,01FH  ;18H-1FH
        DB      080H,081H,082H,083H,084H,00AH,017H,01BH  ;20H-27H
        DB      088H,089H,08AH,08BH,08CH,005H,006H,007H  ;28H-2FH
        DB      090H,091H,016H,093H,094H,095H,096H,004H  ;30H-37H
        DB      098H,099H,09AH,09BH,014H,015H,09EH,01AH  ;38H-3FH
        DB      020H,0A0H,0A1H,0A2H,0A3H,0A4H,0A5H,0A6H  ;40H-47H
        DB      0A7H,0A8H,05BH,02EH,03CH,028H,02BH,021H  ;48H-4FH
        DB      026H,0A9H,0AAH,0ABH,0ACH,0ADH,0AEH,0AFH  ;50H-57H
        DB      0B0H,0B1H,05DH,024H,02AH,029H,03BH,05EH  ;58H-5FH
        DB      02DH,02FH,0B2H,0B3H,0B4H,0B5H,0B6H,0B7H  ;60H-67H
        DB      0B8H,0B9H,07CH,02CH,025H,05FH,03EH,03FH  ;68H-6FH
        DB      0BAH,0BBH,0BCH,0BDH,0BEH,0BFH,0C0H,0C1H  ;70H-77H
        DB      0C2H,060H,03AH,023H,040H,027H,03DH,022H  ;78H-7FH
        DB      0C3H,061H,062H,063H,064H,065H,066H,067H  ;80H-87H
        DB      068H,069H,0C4H,0C5H,0C6H,0C7H,0C8H,0C9H  ;88H-8FH
        DB      0CAH,06AH,06BH,06CH,06DH,06EH,06FH,070H  ;90H-97H
        DB      071H,072H,0CBH,0CCH,0CDH,0CEH,0CFH,0D0H  ;98H-9FH
        DB      0D1H,07EH,073H,074H,075H,076H,077H,078H  ;A0H-A7H
        DB      079H,07AH,0D2H,0D3H,0D4H,0D5H,0D6H,0D7H  ;A8H-AFH
        DB      0D8H,0D9H,0DAH,0DBH,0DCH,0DDH,0DEH,0DFH  ;B0H-B7H
        DB      0E0H,0E1H,0E2H,0E3H,0E4H,0E5H,0E6H,0E7H  ;B8H-BFH
        DB      07BH,041H,042H,043H,044H,045H,046H,047H  ;C0H-C7H
        DB      048H,049H,0E8H,0E9H,0EAH,0EBH,0ECH,0EDH  ;C8H-CFH
        DB      07DH,04AH,04BH,04CH,04DH,04EH,04FH,050H  ;D0H-D7H
        DB      051H,052H,0EEH,0EFH,0F0H,0F1H,0F2H,0F3H  ;D8H-DFH
        DB      05CH,09FH,053H,054H,055H,056H,057H,058H  ;E0H-E7H
        DB      059H,05AH,0F4H,0F5H,0F6H,0F7H,0F8H,0F9H  ;E8H-EFH
        DB      030H,031H,032H,033H,034H,035H,036H,037H  ;F0H-F7H
        DB      038H,039H,0FAH,0FBH,0FCH,0FDH,0FEH,0FFH  ;F8H-FFH
;
;
;       THE FOLLOWING TABLE DEFINES THE FILENAME EXTENSIONS FOR
;       FILES THAT ARE NOT TO BE TRANSLATED TO AND FROM EBCDIC.
;       THE TABLE HAS THE SAME FORMAT AS THE RJE CONSOLE IDENTIFIER
;       TABLE SHOWN ABOVE.  THE TABLE MUST HAVE AT LEAST ONE ENTRY.
;
;
FILXTB: DB      4               ;ENTRY LENGTH
	DB	'.COM'		;.COM FILES ARE NOT TRANSLATED
	DW	0		;REQUIRED
	DB	4		;ENTRY LENGTH
        DB      '.REL'          ;.REL FILES ARE NOT TRANSLATED
        DW      0               ;REQUIRED TABLE ENTRY
        DB      4               ;ENTRY LENGTH
	DB	'.HEX'	        ;.HEX FILES ARE NOT TRANSLATED
	DW	0		;REQUIRED
        DB      4               ;ENTRY LENGTH
        DB      '.COB'          ;.COB FILES ARE NOT TRANSLATED
        DW      0               ;REQUIRED
        DB      4               ;ENTRY LENGTH
        DB      '.CBL'          ;.CBL FILES ARE NOT TRANSLATED
        DW      0               ;REQUIRED
        DB      4               ;ENTRY LENGTH
        DB      'NULL'          ;NULL EXTENSION FILES ARE NOT
;                               ;TRANSLATED.  NOTE THAT THE STRING
;                               ;'NULL' MEANS NO EXTENSION.
        DW      0               ;REQUIRED
;
        DB      0               ;END OF TABLE - REQUIRED
;
COMPRS  EQU     TRUE            ;CHANGE THIS STATEMENT TO 'FALSE'
;                               ;TO DISABLE BLANK COMPRESSION IN
;                               ;3780 MODE.
;

BAUDRT  EQU     9600            ;CHANGE THIS STATEMENT TO REFLECT THE
;                               ;BAUD RATE DESIRED WHEN RUNNING THE
;                               ;LINK IN SELF-CLOCKING (DIRECT CONNECTED)
;                               ;CONFIGURATIONS.  POSSIBLE VALUES ARE
;                               ;1200, 2400, 4800, AND 9600,
;                               ;CORRESPONDING TO 1200, 2400, 4800, AND
;                               ;9600 BAUD RESPECTIVELY.  THIS PARAMETER
;                               ;NEED NOT BE CHANGED IF THE LINK IS
;                               ;RUNNING WITH A MODEM OR MODEM
;                               ;ELIMINATOR.
;
;
;
;
;       THE FOLLOWING ROUTINES MUST NOT BE USER MODIFIED.
;
;
USDTIN: IN      USDATA          ;GET USART BYTE
        RET                     ;BACK TO CALLER
USDTOT: OUT     USDATA          ;WRITE USART BYTE
        RET                     ;BACK TO CALLER
USSTIN: IN      USSTAT          ;GET USART STATUS
        RET                     ;BACK TO CALLER
USSTOT: OUT     USSTAT          ;WRITE USART COMMAND
        RET                     ;BACK TO CALLER
TMCTOT  EQU     $
        RET                     ;BACK TO CALLER
TMDTIN  EQU     $
        RET                     ;BACK TO CALLER
TMDTOT  EQU     $
        RET                     ;BACK TO CALLER
RTMODE: MVI     A,DEVICE        ;GET DEVICE MODE
        RET                     ;BACK TO CALLER
RTCMPR: MVI     A,COMPRS        ;GET COMPRESS MODE
        RET                     ;BACK TO CALLER
RTCMTB: LXI     H,CMDTAB        ;GET CONSOLE COMMAND TABLE ADDRESS
        RET                     ;BACK TO CALLER
RTXLAT: LXI     H,ASCEBC        ;GET TRANSLATE TABLE ADDRESS
        RET                     ;BACK TO CALLER
RTFLEX: LXI     H,FILXTB        ;GET NOTRANSLATE FILE EXTENSION TABLE
	RET			;BACK TO CALLER
RTRTSA:	MVI	A,FALSE		;GET RTS ASSERT MODE BYTE
        RET                     ;BACK TO CALLER
RTSCBR: LXI     H,BAUDRT        ;GET BAUD RATE TIMER VALUE
        RET                     ;BACK TO CALLER
;
DATA    EQU     USDATA
STAT    EQU     USSTAT
;
RTCNTM  EQU     $
        LDA     CONVAL          ;GET CONSOLE VALUE
        CPI     0               ;ZERO?
        RNZ                     ;NO - OK RETURN
        MVI     A,1             ;YES - CHANGE TO ONE
        RET                     ;RETURN
;
;
CONVAL: DB      4800/CONSPD
;
;
SETIO   EQU     $
	MVI     A,IODEV         ;GET IODEV VALUE
;
        RET                     ;BACK TO CALLER
;
SETCPU  EQU     $
        MVI     A,CPUSPD        ;GET CPU SPEED
        LHLD    TIMVAL          ;GET TIME CONSTANT
        MOV     B,H             ;PUT INTO
        MOV     C,L             ;REG B,C
        LXI     H,0             ;CLEAR H,L
SETVAL  EQU     $
        DAD     B               ;GET NEW TIME CONSTANT
        DCR     A               ;FINISHED?
        JNZ     SETVAL          ;NO - ADD AGAIN
        RET                     ;YES - RETURN
;
;
TIMVAL: DW      00B7H           ;TIME CONSTANT
FSTEXT:	RET
EXTEXT:	RET
INEXT:	RET
OUTEXT:	RET
INTEXT:	RET
RTSEXT:	RET
RSTEXT:	RET
XMTEXT:	RET
RCVEXT:	RET
;
        END
