0 ; Control program for Morrow Terminal ; ; ; Written by David Block and Jim Kearney ; ; September 1983 ; ; Initialization section SETUP65 ; 6545 REGISTER VALUES DB 101,80,81,$CF,24,1,24,24 DB %00110000,11,$40,8,0,0,0,0 SETUP68 ; 6845 REGISTER VALUES DB 101,80,81,$0F,24,1,24,24 DB %01010000,11,$60,8,0,0,0,0 CURTYPE DB $60,11 ; block, slow blinking - DEFAULT DB $40,11 ; block, fast blinking DB 0,11 ; block, no blink DB $6B,11 ; underline, slow blinking DB $4B,11 ; underline, fast blinking DB 11,11 ; underline, no blink DB $20,0 ; no cursor ; device initialization GETSW LDA DIPSW11 ; READ DIP SWITCH ASL A STA DIP1 LDA DIPSW12 ; GET 8TH SWITCH AND #01 ; MASK OFF BAD BITS ORA DIP1 ; ASSEMBLE THE 8 DATA BITS STA DIP1 ; save the dipsw settings RTS ; self-test routine..... ; not very comprehensive- mainly sees if RAM addressable ; and if a keyboard is connected ; SLFTST ; JSR KTEST ; test memory JSR MTEST ; test kbrd RTS MTEST LDY #0 ST1 TYA STA CRAM,Y STA CRAM+1021,Y STA ARAM,Y STA ARAM+509,Y INY BNE ST1 ST2 TYA CMP CRAM,Y BNE SERROR CMP CRAM+1021,Y BNE SERROR CMP ARAM+509,Y BNE SERROR CMP ARAM,Y BNE SERROR INY BNE ST2 RTS SERROR LDA #BEEP ; beep the bell JSR KBRDOUT LDA MMESG ; point to memory fail message STA MESG LDA MMESG+1 STA MESG+1 JSR PRNTMSG ; print message JMP SELF ; and loop forever KTEST LDX BAUD ; see if kbrd trying to send BPL CHKKBRD ; if ( kbrd trying to send) then JSR GETKEY ; get key from keyboard JMP KTEST ; wait for settle CHKKBRD LDA #$1 ; assert attention to KBRD ORA BDREG STA BAUD LDX #200 ; sample for 4 ms ( 200 * 20 Micro secs ) KWAIT TXA PHA LDX 2 ; wait 20 micro seconds JSR KDLY LDX BAUD ; see if ACK RCV'D from keyboard BMI KBRDOK ; if bit set, then keyboard is ok PLA ; else, decrement time out count TAX DEX ; BNE KWAIT ; if time not up, then keep looking LDA KMESG ; point to memory fail message STA MESG LDA KMESG+1 STA MESG+1 JSR PRNTMSG ; print message PLA PLA ; preserve stack JMP SLFTST ; wait for the keyboard to be connected KBRDOK PLA ; fix stack LDA #BEEP ; now, we have to give this ack a character SEI ; and set up the needed parameters PHA LDY #8 JMP ACK1 ; go send it a key, and return to Selftest MMESG DW MSG1 MSG1 DB ' System Memory Error',0 KMESG DW MSG2 MSG2 DB ' Keyboard Not Connected',0 RVMESG DW MSG3 MSG3 DB 'ROM REV. 3.2 -- Copyright (c) 1983 by Morrow Designs, Inc. ',0 PRNTMSG LDA #' ' ; set to clear screen to spaces STA CLRCHAR JSR CLRSCR ; clear screen LDY #0 PUTCHAR LDA (MESG),Y ; get a character CMP #0 ; see if end of message BEQ MSGOVER ; if end, then self STA (LB),Y ; if (not end of message) then put it on screen INY ; point to next char JMP PUTCHAR ; and put it on the screen MSGOVER RTS SELF JMP SELF ; endless loop INITBUF LDA #$FF ; value to initialize to LDX #0 CLRIN STA INBUF,X ; fill input buffer with FF DEX BNE CLRIN ; loop until done CLRBUF2 STA INBUF2,X ; fill 2nd input buffer with FF DEX BNE CLRBUF2 ; loop until done LDX #$00 CLROUT STA SNDBUF,X ; fill send buffer with FF INX BPL CLROUT RTS ; setxlt - set up pointers for doing tranlation of foreighn character sets ; SETXLT LDA DIP1 ; get dip switch settings LSR A LSR A LSR A LSR A AND #%00000111 ; get the foreign mode select bits STA FOREIGN ; save their value ASL A ; each char mode has two bytes of numxlt TAY LDA XLTCNT,Y ; get # of chars that need XLATION STA NUMXLTI ; ......for data from host INY LDA XLTCNT,Y STA NUMXLTO ; for data from KBRD DEY ; set back to former value TYA ASL A ; Now, get a pointer to XLT table vectors ASL A TAY LDX #0 ; set to count for 8 vectors MOVPTR LDA XLTVCT,Y ; move a vector STA XLT1,X INY INX CPX #8 ; see if 8 vectors moved yet BNE MOVPTR ; if not, move another RTS ; XLTCNT - table containing the number of ASCII codes that need to be ; translated for each character set. Each foreign character ; set needs two bytes one giving the number of bytes that need ; to be xlated into different codes for display (i.e. input ; from host), and the other byte giving the number of keys that ; need to be xlated from the keyboard. ; XLTCNT DB 0 ; US input from host DB 0 ; US input from KBRD DB 1 ; UK input from host DB 0 ; UK input from KBRD DB 9 ; FRENCH input from host DB 52 ; FRENCH input from KBRD DB 11 ; GERMAN input from host DB 32 ; GERMAN input from KBRD DB 7 ; SPANISH input from host DB 17 ; SPANISH input from KBRD DB 6 ; DANISH/NORWEGIAN input from host DB 16 ; DANISH/NORWEGIAN input from KBRD DB 10 ; FINISH/SWEDISH input from host DB 16 ; FINISH/SWEDISH input from KBRD DB 12 ; ITALIAN input from host DB 48 ; ITALIAN input from KBRD END