-/*******************************************************************
-*
-* qdgetc()... get a character from the LK201
-*
-*******************************************************************
-*
-* calling convention:
-*
-* qdgetc();
-*
-* returns: the character read.
-*
-****************/
-
-qdgetc()
-{
- register short key;
- register char chr;
- register struct duart *duart;
-
- u_int status;
-
- duart = (struct duart *) qdmap[0].duart;
-
- /*
- * Get a character from the keyboard. */
-
-LOOP:
- while (!((status = duart->statusA) & RCV_RDY))
- ;
-
- key = duart->dataA;
- key &= 0xFF;
-
- /*
- * Check for various keyboard errors */
-
- if (key == LK_POWER_ERROR || key == LK_KDOWN_ERROR ||
- key == LK_INPUT_ERROR || key == LK_OUTPUT_ERROR) {
- printf("Keyboard error, code = %x\n", key);
- return(0);
- }
-
- if (key < LK_LOWEST)
- return(0);
-
- /*
- * See if its a state change key */
-
- switch (key) {
-
- case LOCK:
- q_keyboard.lock ^= 0xffff; /* toggle */
- if (q_keyboard.lock)
- led_control(LK_LED_ENABLE, LK_LED_LOCK);
- else
- led_control(LK_LED_DISABLE, LK_LED_LOCK);
- goto LOOP;
-
- case SHIFT:
- q_keyboard.shift ^= 0xFFFF;
- goto LOOP;
-
- case CNTRL:
- q_keyboard.cntrl ^= 0xFFFF;
- goto LOOP;
-
- case ALLUP:
- q_keyboard.cntrl = 0;
- q_keyboard.shift = 0;
- goto LOOP;
-
- case REPEAT:
- chr = q_keyboard.last;
- break;
-
- /*
- * Test for cntrl characters. If set, see if the character
- * is elligible to become a control character. */
-
- default:
-
- if (q_keyboard.cntrl) {
- chr = q_key[key];
- if (chr >= ' ' && chr <= '~')
- chr &= 0x1F;
- }
- else if ( q_keyboard.lock || q_keyboard.shift )
- chr = q_shift_key[key];
- else
- chr = q_key[key];
- break;
- }
-
- if (chr < ' ' && chr > '~') /* if input is non-displayable */
- return(0); /* ..then pitch it! */
-
- q_keyboard.last = chr;
-
- /*
- * Check for special function keys */
-
- if (chr & 0x80) /* pitch the function keys */
- return(0);
- else
- return(chr);
-
-} /* qdgetc */
-
-/**********************************************************************
-*
-* ldcursor()... load the mouse cursor's template RAM bitmap
-*
-*********************************************************************
-*
-* calling convention:
-*
-* ldcursor(unit, bitmap);
-* u_int unit;
-* short *bitmap;
-*
-****************/
-