; ; non-disk i/o equates ; ; version equ 13 ;5/22/83 add version support strip parity ;vercn: db 12 ;5/14/83 remove unneeded stuff for cpmldr ;vercn: db 11 ;4/3/83 epson paper out signal (not done) ;vercn: db 10 ;4/1/83 pmmi interface ;vercn: set 09 ;3/28/83 remove bugs from compupro drivers ;vercn: set 08 ;3/27/83 full support ;vercn: set 07 ;3/26/83 add viox clear substitution maclib cpm3cnfg ;configuration switches public ve$rcn ver$cn db 'con ', version / 10 + '0', version mod 10 + '0', 0 public ?cinit,?ci,?co,?cist,?cost if not loader public @ctbl, @mbaud endif extrn ?min, ?minst, ?mout, ?moutst, ?minit ;in PMMI.ASM maclib Z80 ; define Z80 op codes maclib modebaud ; define mode bits and baud equates ; ; compupro io3/io4 equates ; ; This is used for any combination of compupro ; interfacer III and interfacer IV boards up ; to 32 users. ; numb$user: equ 4 ;number of compupro users compu$base: equ 10h ;compupro standard is 10h compu$data: equ compu$base compu$status: equ compu$base + 1 compu$mode: equ compu$base + 2 compu$command: equ compu$base + 3 compu$user: equ compu$base + 7 compu$xmit$rdy: equ 1 compu$rcv$rdy: equ 2 ; ; System Support One uart equates ; This is just a plain old 2651 uart ; ss1$base: equ 50h ss1$data: equ ss1$base + 12 ss1$status: equ ss1$base + 13 ss1$mode: equ ss1$base + 14 ss1$command: equ ss1$base + 15 ss1$xmit$rdy: equ 1 ss1$rcv$rdy: equ 2 ; ; viox equates ; viox$data: equ 2 viox$status: equ 3 viox$xmit$rdy: equ 1 viox$rcv$rdy: equ 2 if not loader @ctbl: db 'VIOX ' ; device 0 db mb$in$out db baud$none db 'SS1 ' ; device 1 db mb$in$out+mb$serial+mb$softbaud ss1$baud: db baud$300 db 'PMMI ' db mb$in$out + mb$serial + mb$softbaud @mbaud: db baud$300 db 'FX80 ' ; device 2 (compupro 0) db mb$output db baud$none db 'USER1 ' ; device 3 (compupro 1) db mb$in$out+mb$serial+mb$softbaud db baud$9600 db 'USER2 ' ; device 4 (compupro 2) db mb$in$out+mb$serial+mb$softbaud db baud$9600 db 'USER3 ' ; device 5 (compupro 3) db mb$in$out+mb$serial+mb$softbaud db baud$9600 db 0 ; table terminator endif ; ; 2651 default programming ; ; These are the default values for all of the 2651s ; unless changed in the configuration uart$configration ; table. ; ; mode 1: ; ; 7 6 5 4 3 2 1 0 ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; | # stop bits | PO=0 |Poff=0 | 00=5 10=7 |00=syn 10= 16x| ; | 01=1 11=2 | PE=1 |Pon=1 | 01=6 11=8 |01= 1x 11= 64x| ; +-------+-------+-------+-------+-------+-------+-------+-------+ mode$1: equ 11$0$0$11$10b ss1$mode$1: equ 01$0$0$11$10b ; mode 2: ; 7 6 5 4 3 2 1 0 ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; | -- not used - |t clk | r clk | ======== baud rate ========= | ; | |1=intrl|1=intrl| | ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; baud rates: ; ; 0000 = 50 0110 = 600 1100 = 4800 ; 0001 = 75 0111 = 1200 1101 = 7200 ; 0010 = 110 1000 = 1800 1110 = 9600 ; 0011 = 134.5 1001 = 2000 1111 =19200 ; 0100 = 150 1010 = 2400 ; 0101 = 300 1011 = 3600 mode$2: equ 00$1$1$0000b ;baud rate will come from chrtbl ;cp/m3 data structure ; command: ; ; 7 6 5 4 3 2 1 0 ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; |00=nrml |RTS |Rst Err|Frc brk| RxEN |DTR | TxEN | ; | |1=low |0=nrml |0=nrml |1=enbl |1=low |1=enbl | ; +-------+-------+-------+-------+-------+-------+-------+-------+ command: equ 00$1$0$0$1$1$1b ; status: ; ; 7 6 5 4 3 2 1 0 ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; | DSR | DCD | FE | OVR | PE | TxEMT | RxRDY | TxRDY | ; | | | | | | | | | ; +-------+-------+-------+-------+-------+-------+-------+-------+ ; table contains values to be used when ; initializing 2651 uarts ; if not loader user$config$table: ; ; ; user 0 ; db 0,0,0,0 ;currently a centronics port & doesn't require ;initialization ; ; user 1 ; db mode$1 db mode$2 db command db 0 ; ; user 2 ; db mode$1 db mode$2 db command db 0 ; ; user 3 ; db mode$1 db mode$2 db command db 0 ; ; configuration table for ss1 uart ; ss1$config: db ss1$mode$1 db mode$2 db command endif ;**************************************** ; * ; character input * ; entry b=device number * ; * ; exit a=character * ; * ;**************************************** ?ci: if not loader mov a,b ora a jrz viox$in ;device 0 dcr a ;see if a one jrz ss1$in ;device 1 dcr a ; jz ?min ;modem device 2 ; ; must be compupro io3 or io4 user ; dcr a ;change device number to compupro user number cpi numb$user ;see if device is allowed jnc nul$input ;nope, send EOF (1Ah) ; ; compupro user type input ; out compu$user ;set user number comp$in$loop: in compu$status ani compu$rcv$rdy jrz comp$in$loop in compu$data ani 07fh ret ; ; vio-x input ; viox$in: in viox$status ani viox$rcv$rdy jrz viox$in in viox$data ani 07fh ret ; ; ss1 serial port input ; ss1$in: in ss1$status ani ss1$rcv$rdy jrz ss1$in in ss1$data ani 07fh ret ; ; nul input ; nul$input: mvi a,1ah endif ;not loader ret ;**************************************** ; * ; character output * ; entry b=device number * ; c=character * ; exit nothing * ; * ;**************************************** ?co: if not loader ani 0fh mov a,b ora a jrz viox$out ;device 0 dcr a ;see if a one jrz ss1$out ;device 1 dcr a jz ?mout ;pmmi ; ; must be compupro io3 or io4 user ; dcr a ;change device number to compupro user number cpi numb$user ;see if device is allowed rnc ;nope, finished ; ; compupro user type output ; out compu$user ;set user number comp$out$loop: in compu$status ani compu$xmit$rdy jrz comp$out$loop mov a,c out compu$data ret endif ;loader -- allowing viox to be console out ; ; vio-x output ; viox$out: mov a,c cpi 1ah ;test for clear screen character cz viox$escape in viox$status ani viox$xmit$rdy jrz viox$out mov a,c out viox$data ret viox$escape: mvi c, 1bh ;send an escape call viox$out mvi c, '+' ;return with + to send (clear the viox) ret if not loader ; ; ss1 serial port input ; ss1$out: in ss1$status ani ss1$xmit$rdy jrz ss1$out mov a,c out ss1$data ret endif ;loader ;**************************************** ; * ; character output status * ; entry b=device number * ; * ; exit a=0 not ready * ; A=FF ready * ; * ;**************************************** ?cost: if not loader mov a,b ora a jrz viox$out$stat ;device 0 dcr a ;see if a one jrz ss1$out$stat ;device 1 dcr a jz ?moutst ;pmmi ; ; must be compupro io3 or io4 user ; dcr a ;change device number to compupro user number cpi numb$user ;see if device is allowed jnc not$rdy ;nope, will never be ready ; ; compupro user type output status ; out compu$user ;set user number in compu$status ani compu$xmit$rdy rz ori 0ffh ret ; ; vio-x output status ; viox$out$stat: in viox$status ani viox$xmit$rdy rz ori 0ffh ret ; ; ss1 serial port input status ; ss1$out$stat: in ss1$status ani ss1$xmit$rdy rz ori 0ffh ret ; ; never ready ; not$rdy: xra a endif ;loader ret ;**************************************** ; * ; character input status * ; entry b=device number * ; * ; exit a=0 not ready * ; A=FF ready * ; * ;**************************************** ?cist: if not loader mov a,b ora a jrz viox$in$stat ;device 0 dcr a ;see if a one jrz ss1$in$stat ;device 1 dcr a jz ?minst ;pmmi ; ; must be compupro io3 or io4 user ; dcr a ;change device number to compupro user number cpi numb$user ;see if device is allowed jnc not$rdy ;nope, will never be ready ; ; compupro user type input status ; out compu$user ;set user number in compu$status ani compu$rcv$rdy rz ori 0ffh ret ; ; vio-x input status ; viox$in$stat: in viox$status ani viox$rcv$rdy rz ori 0ffh ret ; ; ss1 serial port input status ; ss1$in$stat: in ss1$status ani ss1$rcv$rdy rz ori 0ffh endif ;loader ret ;**************************************** ; * ; device initialization * ; entry b=device number * ; * ; exit nothing * ; * ;**************************************** ?cinit: if not loader mov a,c ora a rz ;none needed for viox dcr a ;see if a one jrz ss1$init ; dcr a jz ?minit ;pmmi ; ; must be compupro type uart ; dcr a ;convert to compupro user number push psw lxix user$config$table add a add a ;times four (table is 4 wide) mvi d,0 mov e,a dadx d ;index into table ; ; ix points to usart configuration table entry ; lxi h,@ctbl mov a,c ;get cp/m3 device number add a add a add a ;times 8 ;each entry in character table ;is 8 wide mov e,a mvi d,0 dad d lxi d,7 ;offset to baud rate dad d ; ; hl points to baud rate number in chartable ; ; ; actually initialize uart with data from tables ; pop psw out compu$user in compu$command ;make sure we're set for 1st mode word ldx a,0 ;get mode 1 ora a rz ;don't bother if mode$1 is zero out compu$mode mov a,m ;get baud from chartable call convert mov b,a ldx a,1 ;get mode2 ani 0f0h ;kill any baud rate info ora b out compu$mode ldx a,2 ;get command out compu$command ret ss1$init: lxi h, ss1$baud ;chartable entry lxix ss1$config ;point to uart config data in ss1$command ldx a,0 ;get mode 1 out ss1$mode mov a,m call convert mov b,a ldx a,1 ani 0f0h ;kill any baud rate info ora b out ss1$mode ldx a,2 out ss1$command ret ; ; convert cpm3 baud rate number (BRN) to 2651 BRN ; entry a=cpm3 BRN ; ; exit a=2651 BRN ; ; NOTE that 2000 baud is not supported by cpm3 BRN convert: cpi 10 ;first rate thats the same rnc ;ok if 2400 or more dcr a ;otherwise subtract one endif ;loader ret end