From: mknewman@blkbox (Marc Kraker Newman)
Subject: Re: Kaypro II Video Problem
Organization: The Black Box, PO Box 591822 Houston, TX 77259-1822 
Date: Sun, 20 Dec 1992 22:02:34 GMT

sage@LL.MIT.EDU (Jay Sage) writes:

>Several attempts to reply directly to "reynaert@arizona.edu" have failed with
>a "user unknown" message from the host, so I will post my response here.

>>> I have benn having problems with my communications when I use an external
>>> modem at 2400 BPS, Some characters are lost while the comunication is
>>> going on. This only happens when there is output to my adm3a screen.
>>> Curiously, this doesn't happen at 1200 BPS or less. Also I have down
>>> loaded files at 2400 BPS and no data has been lost...

>   This is a very well known problem with Kaypro computers.  It is the
>result of a poor design of the video display.  When a new line must be
>created at the bottom of the screen and the existing lines have to be
>scrolled up, the system takes so long that incoming characters are lost.  I
>don't use a Kaypro myself, but many friends do.  There is a file that
>implements a correction to this (I can't remember exactly what it does or
>how it does it).  A common work around is to clear the screen every time it
>fills up and to start again from the top.  If you don't get more specific
>advice from others who reply to you, get back to me and I will try to dig up
>that file for you.  It is posted on my BBS system, which is sponsored by the
>former Kaypro User Group of the Boston Computer Society (now broadened to
>include all CP/M and MS-DOS computers).  In case you are a BBSer, its phone
>number is 617-965-7046.  This reaches first a v.32bis modem and, if that one
>is busy, a USR Courier HST on line 2 (alternatively reachable directly at
>617-965-7785).

>-- Jay Sage

Jay, this is not totally correct.  I ran a USRobotics HST/V32/V42bis on my 
Kaypro 10 for several years, at 19200 baud, without problem.  I DID have to
rewrite the overlay for BYE and Ybbat to do this though, as they were incorrectly handling the Z80-SIO fifo.  The SIO has a 4 character incomming FIFO, and it
will allow you to do 19,200 (or maybe even 38400) without a hitch if you 
implement a queue, and every time you go to get a character off the SIO, insteadget the chars off the SIO, and put them in the queue, and then return the top
char off the queue.  I am going to include ybh-kay1.asm which implements this 
at the end of this message.

Please note, most modem overlays such as bye, mex and others did not implement
this.  Hope you can use it and hope it helps.  BTW, the queue I used is 256
chars, if you need a bigger one (long interrupts blocking the sio for example
during a disk read) then you will need to enlarge it.

Marc



------------------------------------------------------------------------------

       ORG 0103H

       JMP TURD
       JMP MODOUT
       JMP MDOUTST
       JMP MODINP
       JMP MODSTAT
       JMP PURGE
       JMP CARCK
       JMP DTRON
       JMP DTROFF
       JMP SET300
       JMP SET1200
       JMP SET2400
       JMP SET9600
       JMP SET19200
MHZ    EQU 06H               ; 4 MEGAHERTZ
PORT   EQU 04H               ; Data port
MDCTL1 EQU PORT+2            ; Modem control port
BRPORT EQU 0                 ; Baud rate port
MDRCV  EQU 1                 ; Modem receive ready bit
MDSND  EQU 4                 ; Modem CTS and Transmitter empty bits
MDDCD  EQU 8                 ; Carrier detect

BD300  EQU 5                 ; 300 BAUD
BD1200 EQU 7                 ; 1200 BAUD
BD2400 EQU 10                ; 2400 BAUD
BD9600 EQU 14                ; 9600 BAUD
BD192K EQU 15                ; 19,200 BAUD
;
;       ORG 0150H              ; FOR MY KSMAIL
       ORG  0A000H            ; FOR MY RECVMAIL
TURD:
;       call 5f82H           ;FOR KSMAIL
       CALL 51CCH            ;FOR RECVMAIL
       nop
       nop
       lxi h,junk
       push h
;       call 617fH
       CALL  53CBH          ;FOR RECVMAIL
       pop d
;
       MVI A,0               ; Set up to write register 0
       OUT MDCTL1
       MVI A,18H             ; Reset channel
       OUT MDCTL1
;
       MVI A,4               ; Set up to write register 4
       OUT MDCTL1
       MVI A,044H              ; Set 16x, 1 stop bit, no parity
       OUT MDCTL1
;
       MVI A,3               ; Set up to write register 3
       OUT MDCTL1
       MVI A,0C1H            ; 8 bits, Rx enable
       OUT MDCTL1
;
       MVI A,5               ; Set up to write register 5
       OUT MDCTL1
       MVI A,0EAH            ; Turn DTR, RTS back on
       OUT MDCTL1
;
       LXI H,MHZ
       RET
;
JUNK:  DB 'Kaypro 1-2-4-10 I/O, USRobotics HST compatable (souped up!).'
       DB  0dH,0aH,0aH,0
;
MODOUT:
       CALL MDOUTST
       JZ   MODOUT
       LXI  H,2
       DAD  SP
       MOV  A,M
       OUT  PORT
       MVI  A,5
       OUT  MDCTL1
       MVI  A,0EAH
       OUT  MDCTL1
       RET
;
MDOUTST:
       CALL CARCK           ; Turn RTS off while sending ONLINE only
       JZ   MDOUTST1
       MVI  A,0E8H
       JMP  MDOUTST2
MDOUTST1:
       MVI  A,0EAH
MDOUTST2:
       PUSH PSW
       MVI  A,5
       OUT  MDCTL1
       POP  PSW
       OUT  MDCTL1
;
       IN   MDCTL1           ; Get status
       ANI  MDSND            ; TX ready must be high
;
       MOV  L,A
       MVI  H,0
       RET
;
MODINP:
       CALL MODSTAT
       JZ   MODINP
       LXI  H,QUEUE
       LDA  OUTPUT
       INR  A
       STA  OUTPUT
       MOV  C,A
       MVI  B,0
       DAD  B
       MOV  A,M
       MOV  L,A
       MVI  H,0
       RET
;
MODSTAT:
       IN   MDCTL1              ; GET STATUS
       ANI  MDRCV
       JZ   MODSTAT1           ; NO CHARACTER, RETURN
       LXI  H,QUEUE
       LDA  INPUT
       INR  A
       STA  INPUT
       MOV  C,A
       MVI  B,0
       DAD  B
       IN   PORT
       MOV  M,A                 ; STORE THE BYTE IN THE QUEUE
       JMP  MODSTAT             ; SEE IF WE GOT ANOTHER WAITING
MODSTAT1:
       LDA  INPUT
       LXI  H,OUTPUT
       SUB  M
       MOV  L,A
       MVI  H,0
       RET
;
PURGE:
       MVI  A,0
       STA  INPUT
       STA  OUTPUT
       CALL MODSTAT
       JNZ  PURGE
       RET

DTRON: MVI  A,5
       OUT  MDCTL1
       MVI  A,0EAH
       OUT  MDCTL1
       RET
;
DTROFF:MVI  A,5
       OUT  MDCTL1
       MVI  A,068H
       OUT  MDCTL1
       RET
;
CARCK:
       MVI  A,10H
       OUT  MDCTL1
       IN   MDCTL1           ; Get status
       ANI  MDDCD
       MOV  L,A
       MVI  h,0
       ret
;
set300:mvi  a,bd300
       jmp  setbaud
;
set1200: mvi a,bd1200
       jmp  setbaud
;
set2400: mvi a,bd2400
       jmp  setbaud
;
set9600:mvi  a,bd9600
        jmp  setbaud
;
set19200:MVI  a,bd192k
;
Setbaud:out BRPORT
        LXI   H,0FFFFH
        RET
;
QUEUE:  DS    256
INPUT:  DB    0
OUTPUT: DB    0
;
        END
-- 
Marc K. Newman (N5SLG)			Is UNIX pronounced 
mknewman@blkbox.com 			"UNIQUES" or
PO BOX 591822				"EUNICHS"?
Houston, Texas 77259-1822