************************************************** * LINK90 SUBROUTINES * ************************************************** ; ; setup for first serial port on morrow mult-io board ; ; morrow mult-io equates ; group2 equ 2 group3 equ 3 base equ 48h ; base of mult-io ports grpct1 equ base+7 ; group control port dll equ base ; baud rate divisor (lsb) rbr equ base ; recieve buffer register thr equ base ; transmit holding register dlm equ base+1 ; baud rate divisor (msb) ier equ base+1 ; interrupt enable register lcr equ base+3 ; line control register lsr equ base+5 ; line status register dlab equ 80h ; divisor latch access bit thre equ 20h ; transmit holding register empty dr equ 1 ; data ready wls0 equ 1 ; word length select bit 0 wls1 equ 2 ; word length select bit 1 stb equ 0 ; 1 stop bit ; ; cp/m and ascii equates ; bdos equ 5 lf equ 10 cr equ 13 ; **************************************************************** * LINK90 standard tables * **************************************************************** ; org 2400h ; location of link90 subroutines ; ; Jump table ; jmp init ; Initialize hardware jmp clrcom ; Clear communications channel jmp cmchk ; Check communications channel jmp cmin ; Input byte jmp cmout ; Output byte jmp clear ; Clear screen jmp cursxy ; move cursor to x,y ; ; absolute locations ; speed: db 4 ; CPU speed maxdrive:db 'B' ; Maximum drive letter aflg: db 0 ; Auto line-feed toggle (0 = off, 0ffh = on) plxflg: db 0 ; Duplex toggle (0 = full dux, 0ffh = half dux) delay: db 3 ; Time to delay following cr in ascii file dump rows: db 24 ; Number of crt rows (0 if not crt) columns:db 80 ; Number of crt columns (0 if not crt) buf: dw buffer ; Pointer to start of available memory (buffer) ; **************************************************************** * User provided initialization routine (Baud rate, etc.) * **************************************************************** ; init: lxi d,baudmsg mvi c,9 call bdos ; print baud message ; init0: lxi d,askmsg mvi c,9 call bdos ; ask for baud rate ; mvi c,1 call bdos ; get character ; cpi 'a' jc init1 ; < 'a', not lower case cpi 'l'+1 jnc init0 ; re-ask if > 'l' sui 20h ; convert to upper case ; init1: cpi 'A' jc init0 ; re-ask if < 'A' cpi 'L'+1 jnc init0 ; re-ask if > 'L' ; sui 'A' ; a = 0..25 mov e,a mvi d,0 ; de = 0..25 lxi h,baudtable dad d dad d ; set hl -> table entry mov e,m inx h mov d,m push d ; ; get which port he wants ; lxi d,pmsg mvi c,9 call bdos ; ask which port mvi c,1 call bdos ; get character ani 3 ; strip to 0..3 sta group ; store ; out grpct1 mvi a,dlab+wls0+wls1+stb out lcr pop d mov a,e out dll mov a,d out dlm mvi a,wls0+wls1+stb out lcr xra a out lsr out ier ret ; **************************************************************** * Clear communications channel * **************************************************************** ; clrcom: lda group out grpct1 mvi a,wls0+wls1+stb out lcr in rbr ret ; **************************************************************** * Check communications channel for anything. Return with * * accumulator = 0 if nothing ready, non-zero if a byte is * * waiting * **************************************************************** ; cmchk: lda group out grpct1 mvi a,wls0+wls1+stb out lcr in lsr ani dr ret ; **************************************************************** * Input byte from remote terminal * **************************************************************** ; cmin: call cmchk jz cmin in rbr ret ; **************************************************************** * Output byte to remote computer * **************************************************************** ; cmout: push psw lda group mvi a,wls0+wls1+stb out lcr otwt: in lsr ani thre jz otwt pop psw out thr ret ; **************************************************************** * clear crt screen * **************************************************************** ; clear: mvi e,26 ; form feed mvi c,2 call bdos ret ; **************************************************************** * Move cursor to x,y (in hl) * **************************************************************** ; cursxy: push h ; save co-ordinates ; mvi e,1bh mvi c,2 call bdos ; escape ; mvi e,'=' mvi c,2 call bdos ; = ; pop h push h ; recover co-ordinates mov a,h adi ' ' ; add row offset mov e,a mvi c,2 call bdos ; row ; pop h mov a,l adi ' ' ; add column offset mov e,a mvi c,2 call bdos ; column ret ; **************************************************************** * Miscellaneous * **************************************************************** ; ; baud rate message ; baudmsg:db cr,lf,cr,lf db 'Select baud rate:',cr,lf,cr,lf db 'A - 75 E - 600 I - 9600',cr,lf db 'B - 110 F - 1200 J - 19200',cr,lf db 'C - 150 G - 2400 K - 38400',cr,lf db 'D - 300 H - 4800 L - 56000',cr,lf,'$' ; askmsg: db cr,lf,'Select baud by typing one letter: $' pmsg: db cr,lf,'Which port (2/3)? $' ; ; link90 subroutine variables ; group: db 0 ; contains which mult-io port is selected ; ; baud rate table ; baudtable: dw 600h ; 75 dw 417h ; 110 dw 300h ; 150 dw 180h ; 300 dw 0c0h ; 600 dw 060h ; 1200 dw 030h ; 2400 dw 018h ; 4800 dw 00ch ; 9600 dw 006h ; 19200 dw 003h ; 38400 dw 002h ; 56000 ; buffer equ ($ and 0ff00h) + 100h ; end