;====================================================================== ; Initialization section (9_Nov_84) ;================================== ; ; Copyright 1984 ; Morrow Designs, Inc. ; San Leandro, Ca. ; Written by David Block and Jim Kearney (September 1983) ; ;---------------------------------------------------------------------- ; Index (9_Nov_84) ;----------------- ; ; SLFTST Self Test Routine ; KTEST Keyboard Test ; MTEST Memory Test ; GETSW Get the value of the Dip Switches ; INITBUF Initialize the Input Buffers ; SETXLT Set up pointers for doing tranlation of foreign character sets ; PRNTMSG Print a Message PAGE ;---------------------------------------------------------------------- ; 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 ;---------------------------------------------------------------------- ; Test the Keyboard ;------------------ ; 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 PAGE ;---------------------------------------------------------------------- ; Test Memory ;------------ ; 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 SELF: JMP SELF ; and loop forever ;---------------------------------------------------------------------- ; Read the Dip Switches ;---------------------- ; 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 PAGE ;---------------------------------------------------------------------- ; Initialize the Input Buffers (9_Nov_84) ;---------------------------------------- ; INITBUF:LDA #$FF ;A:= 0FFh (End of Buffer Character LDX #0 ;Index/Counter:= 0 ITBLP1: STA INBUF,X ;Repeat Input_Buffer:= 0FFh DEX ; Decrement the Index/Counter BNE ITBLP1 ;Until (Counter eq 0) ITBLP2: STA INBUF2,X ;Repeat (Input_Buffer_2:= 0FFh) DEX ; Decrement the Index/Counter BNE ITBLP2 ;Until (Counter eq 0) ITBLP3: STA SNDBUF,X ;Repeat (Send_Buffer:= 0FFh) INX ; Decrement the Index/Counter BPL ITBLP3 ;Until (Counter eq 0) RTS ;Return ;---------------------------------------------------------------------- ; Set up pointers for doing tranlation of foreign 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 PAGE ;---------------------------------------------------------------------- ; Print a Message (9_Nov_84) ;--------------------------- ; PRNTMSG:LDA #' ' STA CLRCHAR ;Clear_Character:= Spaces JSR CLRSCR ;Clear the Screen LDY #0 ;Index:= 0 (Start of String) PMLP1: LDA (MESG),Y ;While (Current Character ne 0) BEQ PMSK1 STA (LB),Y ; Put Character On Screen INY ; Increment the Pointer JMP PMLP1 PMSK1: RTS ;Return ;---------------------------------------------------------------------- ; Message Strings ;---------------- ; 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 PAGE ;---------------------------------------------------------------------- ; Crt Controller Setup Strings ;----------------------------- ; ; 6545 REGISTER VALUES SETUP65:DB 101,80,81,$CF,24,1,24,24 DB %00110000,11,$40,8,0,0,0,0 ; 6845 REGISTER VALUES SETUP68:DB 101,80,81,$0F,24,1,24,24 DB %01010000,11,$60,8,0,0,0,0 ;---------------------------------------------------------------------- ; Cursor Type Lookup Table ;------------------------- ; 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 ;---------------------------------------------------------------------- ; Ascii Translation Code Table ;----------------------------- ; 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 PAGE END