;***************************************************************** ;* * ;* disassembly of XTALK version 3.0 bios * ;* * ;***************************************************************** base equ 48h ; base i/o address rbr equ base ; ACE receiver buffer register thr equ base ; ACE transmitter holding register dll equ base ; ACE baud rate divisor latch (lsb) dlm equ base+1 ; ACE baud rate divisor latch (msb) ier equ base+1 ; ACE interrupt enable register clk equ base+2 ; WB14 printer select port lcr equ base+3 ; line control register mcr equ base+4 ;modem control register (JCS ENHANCEMENT) lsr equ base+5 ; line status register msr equ base+6 ; modem status register grpsel equ base+7 ; group select bit dtron equ 1 ;pin 20 high Data Terminal Ready (JCS ENHANCEMENT) dlab equ 80h ; divisor latch access bit thre equ 20h ; transmitter holding reg. empty mask dsr equ 20h ; data set ready mask rrf equ 01h ; receive register full mask dcd equ 80h ; data carrier detect mask SB EQU 40H ; SET BREAK wl5 equ 00h ; 5 bit word length wl6 equ 01h ; 6 bit word length wl7 equ 02h ; 7 bit word length wl8 equ 03h ; 8 bit word length wl equ wl8 ;******* set to proper word length ******* st1 equ 00h ; 1 stop bit st2 equ 04h ; 2 stop bits st equ st1 ;******* set to proper stop bits ********* parn equ 00h ; no parity pare equ 18h ; even parity paro equ 08h ; odd parity par equ parn ;******* set to necessary parity ********* lb300 equ 80h ; 300 baud low divisor hb300 equ 01h ; high divisor lb600 equ 0c0h ; 600 baud low divisor hb600 equ 00h ; high divisor lb1200 equ 60h ; 1200 baud low divisor hb1200 equ 00h ; high divisor lb2400 equ 30h ; 2400 baud low divisor hb2400 equ 00h ; high divisor lb4800 equ 18h ; 4800 baud low divisor hb4800 equ 00h ; high divisor baudl equ lb1200 ;******* set to proper baud divisor ***** baudh equ hb1200 ;******* set to proper baud divisor ***** group equ 2 ;******* set to proper ACE imask equ 0 ; disable all interrupts on this ACE .Z80 ;L0100H: JP 0400H L0103H: db 03h ;^C L0104H: db 08h ;^H back space character L0105H: db 01h ;^A L0106H: db 00h ;^@ L0107H: db 01h ;SET BIT 0 TO MAKE *DTR OUTPUT LOW L0108H: db 00h ;^@ JP L0136H ;get a character from the modem JP L0142H ;send a character to the modem JP L0152H ;see if modem is ready ? JP L0167H ;send a break character to the modem ? JP L0176H JP L0176H JP L01CCH ;null routine- just a return JP L0176H JP L01CDH ;store a 1 in 107h, the jump to 176h JP L01DCH ;return with carry cleared JP L0142H ;send a character out serial port JP L01DFH ;0 the A register JP L01D5H ;store a 0 in 107h, then jump to 176h JP L01DFH ;0 the A register NOP NOP RET setgrp: LD A,GROUP ;mvi a,group ; select the ACE out (grpsel),A ; and send it LD A,WL+ST+PAR ;mvi a,wl+st+par ; no dlab. out (lcr),A ret ; and back to where we came from ;************************************************************************* ;* * ;* GET A CHARACTER FROM THE MODEM * ;* * ;************************************************************************* ;stat: L0136H: CALL L0152H RET C call setgrp ; go set ACE to access in A,(lsr) ; read line status register AND RRF ;ani rrf ; mask for receive register full ret Z ; org 120h ;sin: call stat ; set group and get status ; jz sin ; and loop until character is ready in A,(rbr) ; get character from receive buffer ret ;L0136H CALL L0152H ; RET C ; IN A,(0FFH) ;get status of the modem port ; AND 002H ; RET Z ; IN A,(0FEH) ;get a character from the modem port ; RET ;************************************************************************* ;* * ;* SEND A CHARACTER TO THE MODEM * ;* * ;************************************************************************* sout: L0142H: CALL L0152H RET C push AF;psw ; save character on stack call setgrp ; go set to proper ACE sout1: in A,(lsr) ; read line status register AND THRE ;ani thre ; mask for trans. holding reg. empty JP Z,SOUT1; jz sout1 ; loop until it is ready pop AF;psw ; restore character out (thr),A ; and send to trans. holding register ret ;L0142H CALL L0152H ;check DSR & ? & return with carry clear or set ; RET C ; PUSH AF ; ;L0147H IN A,(0FFH) ;get status of the modem port ; AND 001H ;see if transmitter buffer empty ; JP Z,L0147H ;loop until tx buffer empty ; ; POP AF ; OUT (0FEH),A ;send a character out the serial port ; RET ;************************************************************************* ;* * ;* SEE IF MODEM IS READY (VIA DSR LINE) * ;* * ;************************************************************************* L0152H: PUSH BC LD B,A ;PRESERVE A CALL SETGRP LD A,(L0108H) OR A JP NZ,L015FH IN A,(MSR) ;MODEM STATUS REGISTER AND DSR L015FH: SCF JP Z,L0164H CCF L0164H: LD A,B ;RESTORE A POP BC RET ;L0152H PUSH BC ;preserve BC ; LD B,A ;preserve A ; LD A,(L0108H) ;load a character (default is 00h (Null)) ; OR A ; JP NZ,L015FH ; IN A,(0FFH) ;get status of the modem port ; AND 080H ;check DSR line ;L015FH SCF ; JP Z,L0164H ; CCF ;L0164H LD A,B ;restore A ; POP BC ;restore BC ; RET ;************************************************************************* ;* * ;* MAKE THE ACE SEND A BREAK CHARACTER * ;* * ;************************************************************************* L0167H: CALL SETGRP LD A,wl+st+par+SB ;SET BREAK CHARACTER OUT (LCR),A ;TO ACE LINE CONTROL REGISTER PUSH BC LD BC,00C8H CALL 0403H POP BC JP L0176H ;L0167H LD A,00FH ;send a break character ? ; OUT (0FFH),A ;command to modem's 8251 ; PUSH BC ; LD BC,L00C8H ; CALL L0403H ; POP BC ; JP L0176H ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L0176H: PUSH HL PUSH BC L0178H: LD HL,L020EH LD A,(L0103H) CALL L01E1H JP NC,L018CH LD A,001H LD (L0103H),A JP L0178H L018CH: LD C,A LD HL,L01FDH ;data at end of bios program code LD A,(L0104H) CALL L01E1H ADD A,C LD C,A LD HL,L0202H LD A,(L0105H) CALL L01E1H ADD A,C LD C,A LD HL,L0207H LD A,(L0106H) CALL L01E1H ADD A,C LD C,A ; LD A,003H ;ASSUME THIS IS A MODE INSTRUCTION ; CALL L01FAH ;send to the 8251-SET 8251 TO ASYNCHRONOUS ; CALL L01FAH ;send to the 8251- MODE & 64 TIMES BAUD RATE ; LD A,040H ;RESET THE 8251 ; CALL L01FAH ;send to the 8251 ; LD A,C ;MODE INSTRUCTION ; CALL L01FAH ;send to the 8251 ; LD A,(L0107H) ; RLA ; OR 015H ;COMMAND INSTRUCTION ; CALL L01FAH ;send to the 8251 call setgrp ; point at correct ACE LD A,DTRON; mvi a,dtron ;PIN 20 = DATA TERMINAL READY (JCS ENHANCEMENT) out (mcr),A ;bring pin 20 high to turn on modem (JCS ENHANCEMENT) ; mvi LD a,wl+st+par+dlab ; set dlab + options out (lcr),A ; and send to line control reg. ; mvi LD a,baudl ; get low byte of baud rate divisor out (dll),A ; and send it ; mvi LD a,baudh ; now get high byte out (dlm),A ; and send it too ; mvi LD a,wl+st+par ; set word length, stop bits, and parity out (lcr),A ; and reset line control register (no dlab) XOR A;xra a ; clear accumulator out (lsr),A ; clear data available flag ; mvi LD a,imask ; get int. mask out (ier),A POP BC POP HL OR A RET ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L01CCH: RET ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L01CDH: LD A,001H LD (L0107H),A JP L0176H ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L01D5H: XOR A LD (L0107H),A JP L0176H ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L01DCH: SCF CCF RET ;return with carry cleared ;************************************************************************* ;* * ;* * ;* * ;************************************************************************* L01DFH: XOR A RET L01E1H: PUSH BC LD B,A L01E3H: LD A,(HL) INC HL CP B JP Z,L01F2H ;return with carry clear CP 0FFH JP Z,L01F7H ;return with carry set INC HL JP L01E3H L01F2H: LD A,(HL) SCF CCF POP BC RET ;return with carry clear L01F7H: SCF POP BC RET ;return with carry set L01FAH: PUSH AF CALL SETGRP ;L01FAH OUT (0FFH),A ;COMMAND TO modem'S 8251 ; RET L01FDH: db 07h db 08h db 08h db 0Ch db 0FFh L0202H: db 01h db 40h db 02h db 0C0h db 0FFh L0207H: db 01h db 30h db 02h db 10h db 00h db 00h L020CH: db 0FFh db 01h L020EH: db 02h ;L00C8H: EQU 000C8H END