From 9cd78c3228fe7dfe7dd0cbc632b297fb9555e773 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Mon, 15 Feb 2021 17:43:06 -0800 Subject: [PATCH] Remove source and include files that are only used for DOS ... and remove references to them from CMakeList.txt and makefile-tail --- CMakeLists.txt | 10 - bin/makefile-tail | 16 +- inc/inlndos.h | 703 ---------------------------------------------- inc/kbdif.h | 26 -- inc/lispver1.h | 47 ---- src/doscomm.c | 14 - src/doskbd.c | 314 --------------------- src/dosmouse.c | 624 ---------------------------------------- src/kbdif.c | 25 -- src/mouseif.c | 27 -- src/vesainit.c | 452 ----------------------------- src/vgainit.c | 147 ---------- 12 files changed, 3 insertions(+), 2402 deletions(-) delete mode 100755 inc/inlndos.h delete mode 100644 inc/kbdif.h delete mode 100644 inc/lispver1.h delete mode 100644 src/doscomm.c delete mode 100644 src/doskbd.c delete mode 100644 src/dosmouse.c delete mode 100644 src/kbdif.c delete mode 100644 src/mouseif.c delete mode 100644 src/vesainit.c delete mode 100644 src/vgainit.c diff --git a/CMakeLists.txt b/CMakeLists.txt index b879331..215664c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,13 +79,9 @@ SET(BAD_SRCS src/chatter.c src/codeconv.c src/codetbl.c - src/doscomm.c - src/doskbd.c - src/dosmouse.c src/ejlisp.c src/imagefile2.c src/imagefile.c - src/kbdif.c src/lpdual.c src/lpkit.c src/lplexyy.c @@ -102,8 +98,6 @@ SET(BAD_SRCS src/rawrs232c.c src/rs232c.c src/truecolor.c - src/vesainit.c - src/vgainit.c ) SET(MAIKO_SRCS @@ -175,7 +169,6 @@ SET(MAIKO_SRCS src/miscn.c src/mkatom.c src/mkcell.c - src/mouseif.c src/mvs.c src/osmsg.c src/perrno.c @@ -280,12 +273,10 @@ SET(MAIKO_HDRS inc/initsoutdefs.h inc/inlineC.h inc/inln68k.h - inc/inlndos.h inc/inlnPS2.h inc/inlnSPARC.h inc/intcalldefs.h inc/iopage.h - inc/kbdif.h inc/kbdsubrsdefs.h inc/keyboard.h inc/keyeventdefs.h @@ -297,7 +288,6 @@ SET(MAIKO_HDRS inc/lisp2cdefs.h inc/lispemul.h inc/lispmap.h - inc/lispver1.h inc/lispver2.h inc/llcolordefs.h inc/lldsp.h diff --git a/bin/makefile-tail b/bin/makefile-tail index dcff93b..f7fa42c 100644 --- a/bin/makefile-tail +++ b/bin/makefile-tail @@ -485,19 +485,9 @@ $(OBJECTDIR)dspif.o: $(SRCDIR)dspif.c $(REQUIRED-INCS) \ $(INCDIR)devif.h $(INCDIR)dspifdefs.h $(INCDIR)xinitdefs.h $(CC) $(RFLAGS) $(SRCDIR)dspif.c -o $(OBJECTDIR)dspif.o -$(OBJECTDIR)kbdif.o: $(SRCDIR)kbdif.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ - $(INCDIR)dbprint.h $(INCDIR)devif.h - $(CC) $(RFLAGS) $(SRCDIR)kbdif.c -o $(OBJECTDIR)kbdif.o - -$(OBJECTDIR)mouseif.o: $(SRCDIR)mouseif.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ - $(INCDIR)dbprint.h $(INCDIR)devif.h - $(CC) $(RFLAGS) $(SRCDIR)mouseif.c -o $(OBJECTDIR)mouseif.o - -$(OBJECTDIR)ether.o: $(SRCDIR)ether.c $(REQUIRED-INCS) \ - $(INCDIR)commondefs.h $(INCDIR)lispemul.h \ - $(INCDIR)lispmap.h $(INCDIR)emlglob.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \ - $(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)adr68k.h \ - $(INCDIR)ether.h $(INCDIR)dbprint.h $(INCDIR)etherdefs.h +$(OBJECTDIR)ether.o : $(SRCDIR)ether.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ + $(INCDIR)lspglob.h $(INCDIR)adr68k.h \ + $(INCDIR)ether.h $(CC) $(RFLAGS) $(SRCDIR)ether.c -o $(OBJECTDIR)ether.o $(OBJECTDIR)findkey.o: $(SRCDIR)findkey.c $(REQUIRED-INCS) \ diff --git a/inc/inlndos.h b/inc/inlndos.h deleted file mode 100755 index 78d1c4d..0000000 --- a/inc/inlndos.h +++ /dev/null @@ -1,703 +0,0 @@ -/* $Id: inlndos.h,v 1.2 1999/01/03 02:06:05 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */ - - -/************************************************************************/ -/* */ -/* (C) Copyright 1991, 1992 Venue. All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -/************************************************************************/ -/* */ -/* I N L I N E P S 2 . H */ -/* */ -/* INLINE definitions for 386 machines, compiled with gcc. */ -/* */ -/* This file consists of 3 sections: */ -/* */ -/* inline static functions for use anywhere in Medley */ -/* (e.g., the byte-swapping functions) */ -/* */ -/* #defines and static inline functions for the dispatch */ -/* loop (e.g., IDIFFERENCE), relying on the register */ -/* conventions that hold in that part of the code */ -/* */ -/* #defines and static inline functions for other */ -/* specific files (e.g., the arithmetic functions, */ -/* free-variable lookup, etc.), relying on the register */ -/* conventions in the respective files. */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* */ -/* R E G I S T E R C O N V E N T I O N S */ -/* */ -/* The following register conventions hold in the dispatch loop, */ -/* and are set up by register ... asm("...") decls in xc.c: */ -/* */ -/* esi pccache - the current PC */ -/* edi cspcache - the current lisp stack ptr. */ -/* ebx tscache - the top-of-stack item. */ -/* */ -/* */ -/* Register conventions within arithmetic functions in the files */ -/* arith2.c - arith4.c, etc.: */ -/* */ -/* esi first argument to the function */ -/* edi second argument to the function */ -/* */ -/************************************************************************/ - - -/************************************************************************/ -/* */ -/* G E N E R A L - P U R P O S E I N L I N E F U N C T I O N S */ -/* */ -/* These functions don't rely on register conventions. */ -/* */ -/************************************************************************/ - - -/************************************************************************/ -/* */ -/* */ -/* */ -/* */ -/* */ -/************************************************************************/ - - /* undefine these macros so we use the 386i inline code */ - -#undef Get_BYTE_PCMAC0 -#undef Get_BYTE_PCMAC1 -#undef Get_BYTE_PCMAC2 -#undef Get_BYTE_PCMAC3 - -#define Get_BYTE_PCMAC0 Get_BYTE_PCMAC0fn(pccache) -#define Get_BYTE_PCMAC1 Get_BYTE_PCMAC1fn(pccache) -#define Get_BYTE_PCMAC2 Get_BYTE_PCMAC2fn(pccache) -#define Get_BYTE_PCMAC3 Get_BYTE_PCMAC3fn(pccache) - -extern inline unsigned int Get_BYTE_PCMAC0fn (pccache) -unsigned int pccache; - { - register unsigned int word; - asm("lea %0,-1[%1] \n\ - xor %0,3 \n\ - movzx %0,BYTE PTR [%0] \n\ - " : "=r" (word) : "r" (pccache) ); - return(word); - } - -extern inline unsigned int Get_BYTE_PCMAC1fn (pccache) -unsigned int pccache; - { - register unsigned int word; - asm("lea %0,[%1] \n\ - xor %0,3 \n\ - movzx %0,BYTE PTR [%0] \n\ - " : "=r" (word) : "r" (pccache) ); - return(word); - } - -extern inline unsigned int Get_BYTE_PCMAC2fn (pccache) -unsigned int pccache; - { - register unsigned int word; - asm("lea %0,1[%1] \n\ - xor %0,3 \n\ - movzx %0,BYTE PTR [%0] \n\ - " : "=r" (word) : "r" (pccache) ); - return(word); - } - -extern inline unsigned int Get_BYTE_PCMAC3fn (pccache) -unsigned int pccache; - { - register unsigned int word; - asm("lea %0,2[%1] \n\ - xor %0,3 \n\ - movzx %0,BYTE PTR [%0] \n\ - " : "=r" (word) : "r" (pccache) ); - return(word); - } - - -#undef Get_DLword_PCMAC0 -#undef Get_DLword_PCMAC1 -#undef Get_DLword_PCMAC2 -#undef Get_DLword_PCMAC3 - - -#define Get_DLword_PCMAC0 Get_DLword_PCMAC0fn(pccache) -#define Get_DLword_PCMAC1 Get_DLword_PCMAC1fn(pccache) -#define Get_DLword_PCMAC2 Get_DLword_PCMAC2fn(pccache) -#define Get_DLword_PCMAC3 Get_DLword_PCMAC3fn(pccache) - -extern inline unsigned int Get_DLword_PCMAC0fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("mov edx,%1 \n\ - xor dl,3 \n\ - movzx eax, byte ptr [edx] \n\ - lea edx,-1[%1] \n\ - xor dl,3 \n\ - mov ah, byte ptr [edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - -extern inline unsigned int Get_DLword_PCMAC1fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,1[%1] \n\ - xor dl,3 \n\ - movzx eax, byte ptr [edx] \n\ - lea edx,[%1] \n\ - xor dl,3 \n\ - mov ah, byte ptr [edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - - -extern inline unsigned int Get_DLword_PCMAC2fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,2[%1] \n\ - xor dl,3 \n\ - movzx eax, byte ptr [edx] \n\ - lea edx,1[%1] \n\ - xor dl,3 \n\ - mov ah, byte ptr [edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - -extern inline unsigned int Get_DLword_PCMAC3fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,3[%1] \n\ - xor dl,3 \n\ - movzx eax, byte ptr [edx] \n\ - lea edx,2[%1] \n\ - xor dl,3 \n\ - mov ah, byte ptr [edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - - -#undef Get_Pointer_PCMAC0 -#undef Get_Pointer_PCMAC1 -#undef Get_Pointer_PCMAC2 - -#define Get_Pointer_PCMAC0 Get_Pointer_PCMAC0fn(pccache) -#define Get_Pointer_PCMAC1 Get_Pointer_PCMAC1fn(pccache) -#define Get_Pointer_PCMAC2 Get_Pointer_PCMAC2fn(pccache) - - -extern inline const unsigned int Get_Pointer_PCMAC0fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,-1[%1] \n\ - xor dl,3 \n\ - movzx eax,byte ptr [edx] \n\ - shl eax,16 \n\ - lea edx,1[%1] \n\ - xor dl,3 \n\ - mov al,[edx] \n\ - lea edx,[%1] \n\ - xor dl,3 \n\ - mov ah,[edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - -extern inline const unsigned int Get_Pointer_PCMAC1fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,[%1] \n\ - xor dl,3 \n\ - movzx eax,byte ptr [edx] \n\ - shl eax,16 \n\ - lea edx,2[%1] \n\ - xor dl,3 \n\ - mov al,[edx] \n\ - lea edx,1[%1] \n\ - xor dl,3 \n\ - mov ah,[edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - - -extern inline const unsigned int Get_Pointer_PCMAC2fn(pccache) -unsigned int pccache; - { - register unsigned int word asm("ax"); - asm("lea edx,1[%1] \n\ - xor dl,3 \n\ - movzx eax,byte ptr [edx] \n\ - shl eax,16 \n\ - lea edx,3[%1] \n\ - xor dl,3 \n\ - mov al,[edx] \n\ - lea edx,2[%1] \n\ - xor dl,3 \n\ - mov ah,[edx] \n\ - " : "=r" (word) : "r" (pccache) : "dx" ); - return(word); - } - - -#undef DIFFERENCE -#undef IDIFFERENCE - -#define DIFFERENCE { \ - fast_op_difference(POP_TOS_1); \ - fast1_dispatcher(); \ -diff_err: \ - asm volatile("diff_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_difference, GET_POPPED); \ - } - -extern inline void fast_op_difference(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne diff_err \n\ - rol eax,17 \n\ - sub al,7 \n\ - jne diff_err \n\ - sub eax,ebx \n\ - jo diff_err \n\ - ror eax,15 \n\ - or eax,917504 \n\ - mov ebx,eax \ - " : : "g" (value) : "ax" ); - - } - -#define IDIFFERENCE { \ - fast_op_idifference(POP_TOS_1); \ - fast1_dispatcher(); \ -idiff_err: \ - asm volatile("idiff_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_idifference, GET_POPPED); \ - } - -extern inline void fast_op_idifference(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne idiff_err \n\ - rol eax,17 \n\ - sub al,7 \n\ - jne idiff_err \n\ - sub eax,ebx \n\ - jo idiff_err \n\ - ror eax,15 \n\ - or eax,917504 \n\ - mov ebx,eax \ - " : : "g" (value) : "ax" ); - - } - - -#undef IDIFFERENCE_N -#define IDIFFERENCE_N(n) { \ - fast_op_idifferencen(n); \ - fast2_dispatcher(); \ -idiffn_err: \ - asm("idiffn_err2:"); \ - asm volatile("add ebx,eax ; undo the sub"); \ - asm("idiffn_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_CALL_1d(N_OP_idifferencen, n); \ - } - -extern inline void fast_op_idifferencen(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol eax,15 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne idiffn_err \n\ - sub ebx,eax \n\ - jo idiffn_err2 \n\ - ror ebx,15 \n\ - or ebx,917504 \n\ - " : : "g" (value) : "ax" ); - - } - -#undef PLUS2 -#undef IPLUS2 - -#define PLUS2 { \ - fast_op_plus(POP_TOS_1); \ - fast1_dispatcher(); \ -plus_err: \ - asm volatile("plus_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_plus2, GET_POPPED); \ - } -extern inline void fast_op_plus(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne plus_err \n\ - rol eax,15 \n\ - sub al,7 \n\ - jne plus_err \n\ - add eax,ebx \n\ - jo plus_err \n\ - ror eax,15 \n\ - or eax,917504 \n\ - mov ebx,eax \n\ - " : : "g" (value) : "ax" ); - - } - - -#define IPLUS2 { \ - fast_op_iplus(POP_TOS_1); \ - fast1_dispatcher(); \ -iplus_err: \ - asm volatile("iplus_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_iplus2, GET_POPPED); \ - } -extern inline void fast_op_iplus(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne iplus_err \n\ - rol eax,15 \n\ - sub al,7 \n\ - jne iplus_err \n\ - add eax,ebx \n\ - jo iplus_err \n\ - ror eax,15 \n\ - or eax,917504 \n\ - mov ebx,eax \n\ - " : : "g" (value) : "ax" ); - - } - - -#undef IPLUS_N -#define IPLUS_N(n) { \ - fast_op_iplusn(n); \ - fast2_dispatcher(); \ -iplusn_err: \ - asm("iplusn_err:"); \ - asm volatile("add bl,7"); \ - asm volatile("ror ebx,15"); \ - N_OP_CALL_1d(N_OP_iplusn, n); \ - } - -extern inline void fast_op_iplusn(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol eax,15 \n\ - rol ebx,15 \n\ - sub bl,7 \n\ - jne iplusn_err \n\ - add eax,ebx \n\ - jo iplusn_err \n\ - ror eax,15 \n\ - or eax,917504 \n\ - mov ebx,eax \n\ - " : : "g" (value) : "ax" ); - - } - - -#undef GREATERP -#define GREATERP { \ - fast_op_greaterp(POP_TOS_1); \ - fast1_dispatcher(); \ -greaterp_err: \ - asm("greaterp_err:"); \ - N_OP_POPPED_CALL_2(N_OP_greaterp, GET_POPPED); \ - } - -extern inline void fast_op_greaterp(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - mov edx,ebx \n\ - rol edx,15 \n\ - sub dl,7 \n\ - jne greaterp_err \n\ - rol eax,15 \n\ - sub al,7 \n\ - jne greaterp_err \n\ - xor ebx,ebx \n\ - cmp eax,edx \n\ - jle greater_no \n\ - mov ebx,76 \n\ -greater_no: " : : "g" (value) ); - - } - - -#undef IGREATERP -#define IGREATERP { \ - fast_op_igreaterp(POP_TOS_1); \ - fast1_dispatcher(); \ -igreaterp_err: \ - asm("igreaterp_err: "); \ - N_OP_POPPED_CALL_2(N_OP_igreaterp, GET_POPPED); \ - } - -extern inline void fast_op_igreaterp(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - mov edx,ebx \n\ - rol edx,15 \n\ - sub dl,7 \n\ - jne igreaterp_err \n\ - rol eax,15 \n\ - sub al,7 \n\ - jne igreaterp_err \n\ - xor ebx,ebx \n\ - cmp eax,edx \n\ - jle igreater_no \n\ - mov ebx,76 \n\ -igreater_no: " : : "g" (value) ); - - } - - -#undef LRSH8 -#define LRSH8 { \ - asm volatile("\ - mov eax,ebx \n\ - rol eax,16 \n\ - cmp ax,0eh \n\ - jne lrsh8_err \n\ - shr bx,8 \n\ - " : : : "ax" ); \ - fast1_dispatcher(); \ -lrsh8_err: \ - asm("lrsh8_err: "); \ - N_OP_CALL_1(N_OP_lrsh8); \ - } - -#undef LRSH1 -#define LRSH1 { \ - asm volatile("\ - mov eax,ebx \n\ - rol eax,16 \n\ - cmp ax,0eh \n\ - jne lrsh1_err \n\ - shr bx,1 \n\ - " : : : "ax" ); \ - fast1_dispatcher(); \ -lrsh1_err: \ - asm("lrsh1_err: "); \ - N_OP_CALL_1(N_OP_lrsh1); \ - } - -#undef LLSH8 -#define LLSH8 { \ - asm volatile("\ - mov eax,ebx \n\ - rol eax,16 \n\ - cmp ax,0eh \n\ - jne llsh8_err \n\ - or bh,bh \n\ - jne llsh8_err \n\ - shl bx,8 \n\ - " : : : "ax" ); \ - fast1_dispatcher(); \ -llsh8_err: \ - asm("llsh8_err: "); \ - N_OP_CALL_1(N_OP_llsh8); \ - } - -#undef LLSH1 -#define LLSH1 { \ - asm volatile("\ - mov eax,ebx \n\ - rol eax,16 \n\ - cmp ax,0eh \n\ - jne llsh1_err \n\ - test bh,80h \n\ - jne llsh1_err \n\ - shl bx,1 \n\ - " : : : "ax" ); \ - fast1_dispatcher(); \ -llsh1_err: \ - asm("llsh1_err: "); \ - N_OP_CALL_1(N_OP_llsh1); \ - } - - -#undef LOGOR -#define LOGOR { \ - fast_op_logor(POP_TOS_1); \ - fast1_dispatcher(); \ -logor_err: \ - asm("logor_err:"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_logor, GET_POPPED); \ - } - -extern inline void fast_op_logor(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - cmp bl,7 \n\ - jne logor_err \n\ - rol eax,15 \n\ - cmp al,7 \n\ - jne logor_err \n\ - or ebx,eax \n\ - ror ebx,15 \n\ - " : : "g" (value) : "ax" ); - - } - - -#undef LOGAND -#define LOGAND { \ - fast_op_logand(POP_TOS_1); \ - fast1_dispatcher(); \ -logand_err: \ - asm("logand_err: "); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_logand, GET_POPPED); \ - } - -extern inline void fast_op_logand(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - cmp bl,7 \n\ - jne logand_err \n\ - rol eax,15 \n\ - cmp al,7 \n\ - jne logand_err \n\ - and ebx,eax \n\ - ror ebx,15 \n\ - " : : "g" (value) : "ax" ); - - } - - -#undef LOGXOR -#define LOGXOR { \ - fast_op_logxor(POP_TOS_1); \ - fast1_dispatcher(); \ -logxor_err: \ - asm("logxor_err:"); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_logxor, GET_POPPED); \ - } - -extern inline void fast_op_logxor(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - cmp bl,7 \n\ - jne logxor_err \n\ - rol eax,15 \n\ - sub al,7 \n\ - jne logxor_err \n\ - xor ebx,eax \n\ - ror ebx,15 \n\ - " : : "g" (value) : "ax" ); - - } - - - -#undef N_OP_ADDBASE -#define N_OP_ADDBASE { \ - fast_op_addbase(POP_TOS_1); \ - fast1_dispatcher(); \ -addbase_err: \ - asm("addbase_err: "); \ - asm volatile("ror ebx,15"); \ - N_OP_POPPED_CALL_2(N_OP_addbase, GET_POPPED); \ - } -extern inline void fast_op_addbase(LispPTR value) - { - asm volatile("\ - mov eax,%0 \n\ - rol ebx,15 \n\ - cmp bl,7 \n\ - jne addbase_err \n\ - sar ebx,15 \n\ - and eax,0ffffffh \n\ - add ebx,eax \n\ - " : : "g" (value) : "ax" ); - - } - - - - -#undef N_OP_LOLOC -#define N_OP_LOLOC { \ - asm volatile(" \ - and %0,0ffffh \n\ - or %0,0e0000h" : "=r" (tscache) : "0" (tscache)); \ - nextop1; } - -#undef N_OP_HILOC -#define N_OP_HILOC { \ - asm volatile(" \ - shr %0,16 \n\ - and %0,0ffffh \n\ - or %0,0e0000h" : "=r" (tscache) : "0" (tscache)); \ - nextop1; } - -#undef N_OP_VAG2 -#define N_OP_VAG2 \ - { \ - asm(" sub edi,4"); \ - asm(" mov eax,[edi]"); \ - asm(" rol ebx,16"); \ - asm(" mov bx,ax"); \ - asm(" ror ebx,16"); \ - nextop1; } - diff --git a/inc/kbdif.h b/inc/kbdif.h deleted file mode 100644 index 17b2001..0000000 --- a/inc/kbdif.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef KBDIF_H -#define KBDIF_H 1 -/* $Id: kbdif.h,v 1.2 1999/01/03 02:06:06 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ -#include /* for u_char */ - -/* The Keyboard structure. */ - -typedef struct { - u_char KeyMap[0x80]; - void (* sync_device)(); /* Make reality and emulator coincide with each other */ - void (* enter_device)(); - void (* exit_device)(); - void (* device_event)(); - void (* before_raid)(); - void (* after_raid)(); - int lispkeycode; -} KbdInterfaceRec, *KbdInterface; -#endif /* KBDIF_H */ diff --git a/inc/lispver1.h b/inc/lispver1.h deleted file mode 100644 index 9fa8664..0000000 --- a/inc/lispver1.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef LISPVER1_H -#define LISPVER1_H 1 -/* $Id: lispver1.h,v 1.2 1999/01/03 02:06:08 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */ - -/* DOS version of LispVersionToUnixVersion */ -#define LispVersionToUnixVersion(pathname, ver) \ - { \ - \ - register char *cp; \ - register char *vp; \ - char ver_buf[VERSIONLEN]; \ - \ - cp = pathname; \ - vp = NULL; \ - while (*cp) \ - { \ - switch (*cp) \ - { \ - \ - case ';': \ - *cp = 0; \ - cp++; \ - vp = cp; \ - break; \ - \ - case '\'': \ - if (*(cp + 1) != 0) cp += 2; \ - else cp++; \ - break; \ - \ - default: \ - cp++; \ - break; \ - } \ - } \ - \ - if (vp) \ - { \ - NumericStringP(vp, YES, NO); \ - NO: *vp = 0; \ - YES: \ - if ((*vp)) ver = atoi(vp); \ - else ver = -1; \ - } \ - else ver = -1; \ - } -#endif /* LISPVER1_H */ diff --git a/src/doscomm.c b/src/doscomm.c deleted file mode 100644 index 2de5b14..0000000 --- a/src/doscomm.c +++ /dev/null @@ -1,14 +0,0 @@ -/* $Id: doscomm.c,v 1.3 1999/05/31 23:35:27 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -DOS_handlecomm(int args) {} diff --git a/src/doskbd.c b/src/doskbd.c deleted file mode 100644 index 5be1ead..0000000 --- a/src/doskbd.c +++ /dev/null @@ -1,314 +0,0 @@ -/* $Id: doskbd.c,v 1.2 1999/01/03 02:06:55 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ -/************************************************************************/ -/* */ -/* D O S K E Y B O A R D H A N D L E R */ -/* */ -/* */ -/************************************************************************/ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -#include /* defines REGS & other structs */ -#include /* "#pragma interrupt" & '_chain_intr'*/ -#include -#include - -#include "lispemul.h" -#include "keyboard.h" -#include "keysym.h" -#include "devif.h" - -int nokbdflag = FALSE; -extern int eurokbd; -extern KbdInterface currentkbd; -extern MouseInterface currentmouse; -extern IOPAGE *IOPage68K; -extern IFPAGE *InterfacePage; -extern int KBDEventFlg; - -extern keybuffer *CTopKeyevent; - -extern LispPTR *LASTUSERACTION68k; -extern LispPTR *KEYBUFFERING68k; - -/************************************************/ -/* Keyboard-Interface Registers, Status Codes */ -/************************************************/ -#define KBD_COMMAND_PORT 0x64 /* I/O port commands go out on */ -#define KBD_ENABLE 0xAE -#define KBD_DISABLE 0xAD -#define KBD_RESET 0xF6 - -#define PORT_8042 0x60 /* Port scan codes come in on */ -#define KBD_SCAN_CODE_PORT 0x60 -#define KBD_resend 0xFE /* KBD asked for resend */ -#define KBD_ack 0xFA /* KBD ack's our command */ -#define KBD_echo_response 0xEE /* KBD responds to echo req */ -#define KBD_failure 0xFD /* Failure code */ -#define KBD_prefix 0xE0 /* Prefix for extended chars */ -#define KBD_pause_prefix 0xE1 /* Pause prefix?? */ -#define KBD_overflow 0x00 /* Overflow of some kind */ -#define KBD_overrun 0xFF /* KBD buffer overrun */ - -#define KBD_STATUS_PORT 0x64 /* Port KBD status comes in on */ -#define KBD_INP_FULL 0x02 /* input buffer full */ - -#define INTA00 0x20 /* The 8259 port, to reset irq */ -#define ENDOFINTERRUPT 0x20 - -#define PRTSC_KEY 0x37 /* Keyboard codes for extended chars */ -#define HOME_KEY 0x47 -#define UPARROW_KEY 0x48 -#define PGUP_KEY 0x49 -#define LEFTARROW_KEY 0x4b -#define RIGHTARROW_KEY 0x4d -#define END_KEY 0x4f -#define DOWNARROW_KEY 0x50 -#define PGDOWN_KEY 0x51 -#define INS_KEY 0x52 -#define DEL_KEY 0x53 - -/******************************************************/ -/* Tell the Interrupt-dispatch IC we're done, and */ -/* Tell the keyboard itself that we're ready again. */ -/* */ -/* (This process is critical to the proper function */ -/* of the handler, so let's do it once, correctly.) */ -/******************************************************/ -#define ENABLE_KBD \ - { \ - outp(INTA00, ENDOFINTERRUPT); \ - outp(KBD_COMMAND_PORT, KBD_ENABLE); /* Turn kbd on again. */ \ - } - -/************************************************************************/ -/* */ -/* K B D _ E V E N T */ -/* */ -/* Keyboard interrupt handler routine */ -/************************************************************************/ -extern DLword *DisplayRegion68k; - -#pragma interrupt(Kbd_event) - -void Kbd_event() { - _XSTACK *ebp; /* Real-mode handler stack frame */ - DLword w, r; - KBEVENT *kbevent; - unsigned char keycode, tmpkey; - - ebp = (_XSTACK *)_get_stk_frame(); /* Get stack frame address */ - ebp->opts |= _STK_NOINT; /* Bypass real-mode handler */ - - /*************************************************/ - /* First, get the scan code from the keyboard. */ - /* Handle exceptional conditions & errors, and */ - /* the extended-character prefix, 0xE0 */ - /* generated for, e.g., the INSERT key. */ - /*************************************************/ - - _disable(); /* prevent further interrupts from killing us */ - outp(KBD_COMMAND_PORT, KBD_DISABLE); /* Turn the kbd off. */ - do { tmpkey = inp(KBD_STATUS_PORT); } while (tmpkey & KBD_INP_FULL); - - /* Finite state machine that either returns or goes to label handle: */ - switch (tmpkey = inp(KBD_SCAN_CODE_PORT)) { - case KBD_overflow: /* Ignore these. */ - case KBD_pause_prefix: - case KBD_echo_response: - case KBD_ack: - case KBD_failure: - case KBD_resend: - case KBD_overrun: - ENABLE_KBD; - return; - break; - - case KBD_prefix: /* It's a prefix, so really use next char. */ - /* Remember that we saw the prefix: */ - currentkbd->lastbyte = tmpkey; - ENABLE_KBD; - return; - break; - - default: - tmpkey = inp(KBD_SCAN_CODE_PORT); - if (currentkbd->lastbyte == KBD_prefix) - switch (tmpkey) /* deal with prefixed characters */ - { - case 0x2A: /* by ignoring some (what are they??) */ - case 0xAA: - case 0xB6: - case 0x36: - ENABLE_KBD; - return; - break; - - default: /* and passing the rest thru as-is */ - currentkbd->lastbyte = tmpkey; /* Set the state. */ - goto handle; - break; - } - else { - currentkbd->lastbyte = tmpkey; /* Set the state. */ - goto handle; - } - } - - return; /* Don't have anything to handle yet, so just return */ - -/*****************************************************/ -/* Second, translate the scan code into a LISP key */ -/* transition, add it to the ring buffer, and set */ -/* the interrupt-request flags so lisp sees it. */ -/*****************************************************/ -handle: - /* The upflag is the eight bit in the char ie. upflag = currentkbd->lastbyte >> 7 */ - /* The event is the lower seven bits of the byte */ - - keycode = currentkbd->KeyMap[currentkbd->lastbyte & 0x7f]; - - if (keycode != 0xff) { - if (keycode < 64) { - PUTBASEBIT68K(&(IOPage68K->dlkbdad0), keycode, (currentkbd->lastbyte >> 7) & 1); - } else if (keycode >= 80) { - PUTBASEBIT68K(&(IOPage68K->dlkbdad0), keycode - 16, (currentkbd->lastbyte >> 7) & 1); - } else { - PUTBASEBIT68K(&(IOPage68K->dlutilin), (keycode & 0xf), (currentkbd->lastbyte >> 7) & 1); - PUTBASEBIT68K(&(InterfacePage->fakemousebits), (keycode & 0xf), - (currentkbd->lastbyte >> 7) & 1); - } - } - - /* In DOS we can't enter uraid inside an exception handler. */ - /* Uraid may touch a swapped out address and that dumps Medley */ - if (((IOPage68K->dlkbdad2 & 2113) == 0) || /* Ctrl-shift-NEXT */ - ((IOPage68K->dlkbdad2 & 2114) == 0)) { /* Ctrl-shift-DEL */ - currentkbd->URaid = TRUE; /* Tell the dispatch loop about it. */ - return; - } - - r = CTopKeyevent->ring.vectorindex.read; - w = CTopKeyevent->ring.vectorindex.write; - - if (r != w) { - kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w); - /* Copy the Hardware bits. */ - kbevent->W0 = IOPage68K->dlkbdad0; - kbevent->W1 = IOPage68K->dlkbdad1; - kbevent->W2 = IOPage68K->dlkbdad2; - kbevent->W3 = IOPage68K->dlkbdad3; - kbevent->W4 = IOPage68K->dlkbdad4; - kbevent->W5 = IOPage68K->dlkbdad5; - kbevent->WU = IOPage68K->dlutilin; - - /* If queue was empty, update the read pointer */ - if (r == 0) CTopKeyevent->ring.vectorindex.read = w; - - /* Update the write pointer */ - if (w >= currentkbd->maxkeyevent) - CTopKeyevent->ring.vectorindex.write = MINKEYEVENT; - else - CTopKeyevent->ring.vectorindex.write += currentkbd->keyeventsize; - } - if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T; - - KBDEventFlg++; - Irq_Stk_End = 0; - Irq_Stk_Check = 0; - - ENABLE_KBD; - return; -} - -extern u_char DOSLispKeyMap_101[]; - -/************************************************************************/ -/* */ -/* E X I T D O S K B D */ -/* */ -/* Turn off the DOS keyboard handler, and reinstall the */ -/* normal DOS handler. */ -/************************************************************************/ - -void ExitDosKbd(KbdInterface kbd) -{ - if (kbd->device.active == TRUE) { - kbd->device.active = FALSE; - - _dpmi_unlockregion((void *)¤tkbd, sizeof(currentkbd)); - _dpmi_unlockregion((void *)kbd, sizeof(*kbd)); - _dpmi_unlockregion((void *)&InterfacePage, sizeof(InterfacePage)); - _dpmi_unlockregion((void *)InterfacePage, sizeof(IFPAGE)); - _dpmi_unlockregion((void *)&IOPage68K, sizeof(IOPage68K)); - _dpmi_unlockregion((void *)IOPage68K, sizeof(IOPAGE)); - - _dpmi_unlockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent)); - _dpmi_unlockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent)); - - _dpmi_unlockregion((void *)&MachineState, sizeof(MachineState)); - _dpmi_unlockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k)); - _dpmi_unlockregion((void *)&ExitDosKbd, 4096); - _dpmi_unlockregion((void *)&Kbd_event, 4096); - - _dos_setvect(0x09, kbd->prev_handler); /* unhook our handlr, install previous*/ - } -} - -/************************************************************************/ -/* */ -/* E N T E R D O S K B D */ -/* */ -/* Turn on the DOS keyboard device. */ -/* */ -/************************************************************************/ - -void EnterDosKbd(KbdInterface kbd) -{ - int i; - - if (kbd->device.active == FALSE) { - kbd->device.active = TRUE; - for (i = 0; i < 0x80; i++) kbd->KeyMap[i] = DOSLispKeyMap_101[i]; - - if (eurokbd) - kbd->keyeventsize = EUROKEYEVENTSIZE; - else - kbd->keyeventsize = NOEUROKEYEVENTSIZE; - kbd->eurokbd = eurokbd; - - /* Offset of the end of the ring buffer */ - kbd->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * kbd->keyeventsize)); - - _dpmi_lockregion((void *)¤tkbd, sizeof(currentkbd)); - _dpmi_lockregion((void *)kbd, sizeof(*kbd)); - _dpmi_lockregion((void *)&InterfacePage, sizeof(InterfacePage)); - _dpmi_lockregion((void *)InterfacePage, sizeof(IFPAGE)); - _dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K)); - _dpmi_lockregion((void *)IOPage68K, sizeof(IOPAGE)); - _dpmi_lockregion((void *)&MachineState, sizeof(MachineState)); - - _dpmi_lockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent)); - _dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent)); - - _dpmi_lockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k)); - _dpmi_lockregion((void *)&ExitDosKbd, 4096); - _dpmi_lockregion((void *)&Kbd_event, 4096); - - /* Don't hook in our handler if the user flagged he wants to run */ - /* without a kbd. */ - if (!nokbdflag) { - kbd->prev_handler = _dos_getvect(0x09); /* get addr of current 09 hndlr */ - _dos_setvect(0x09, kbd->device_event); /* hook our int handler to interrupt */ - } - } -} diff --git a/src/dosmouse.c b/src/dosmouse.c deleted file mode 100644 index 6152073..0000000 --- a/src/dosmouse.c +++ /dev/null @@ -1,624 +0,0 @@ -/* $Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -#include /* Defines "#pragma interrupt" */ -#include /* _XSTACK struct definition */ -#include /* Defines REGS & other structs */ - -#include "lispemul.h" -#include "display.h" -#include "bb.h" - -#include "dbprint.h" -#include "devif.h" -#include "keyboard.h" -#include "ifpage.h" - -extern int eurokbd; -extern IOPAGE *IOPage68K; -extern MISCSTATS *MiscStats; -extern IFPAGE *InterfacePage; -extern int KBDEventFlg; -extern DspInterface currentdsp; -extern MouseInterface currentmouse; -extern KbdInterface currentkbd; - -extern keybuffer *CTopKeyevent; -extern DLword *DisplayRegion68k; -extern DLword *Lisp_world; - -extern LispPTR *KEYBOARDEVENTQUEUE68k; -extern LispPTR *KEYBUFFERING68k; -extern LispPTR *LASTUSERACTION68k; - -#define MOUSE_MV 0x01 /* Mouse movement occurred */ -#define LB_PRESS 0x02 /* Left button pressed */ -#define LB_OFF 0x04 /* Left button released */ -#define RB_PRESS 0x08 /* Right button pressed */ -#define RB_OFF 0x10 /* Right button released */ -#define CB_PRESS 0x20 /* Center button released */ -#define CB_OFF 0x40 /* Center button pressed */ - -#pragma interrupt(TwoButtonHandler) -#pragma interrupt(ThreeButtonHandler) -#pragma interrupt(ButtonTimer) -void ButtonTimer(); -void MouseButtonSignal(); - -void EnterDosMouse(MouseInterface mouse, DspInterface dsp) -{ - union REGS regs; - - probemouse(); - _dpmi_lockregion((void *)&MouseButtonSignal, 4096); - /* Set up the ringbuffer */ - if (eurokbd) - mouse->keyeventsize = EUROKEYEVENTSIZE; - else - mouse->keyeventsize = NOEUROKEYEVENTSIZE; - - mouse->eurokbd = eurokbd; - - /* Offset of the end of the ring buffer */ - mouse->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * mouse->keyeventsize)); - - /* Lock myself */ - _dpmi_lockregion((void *)mouse, sizeof(*mouse)); - _dpmi_lockregion((void *)¤tmouse, sizeof(currentmouse)); - - /* Lock the handler routines */ - _dpmi_lockregion((void *)mouse->Handler, 4096); - - if (mouse->Button.TwoButtonP) { _dpmi_lockregion((void *)&ButtonTimer, 4096); } - - /* Lock the structures used, both pointers to 'em & the whole structure. */ - _dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K)); - _dpmi_lockregion((void *)IOPage68K, sizeof(IOPAGE)); - _dpmi_lockregion((void *)&InterfacePage, sizeof(InterfacePage)); - _dpmi_lockregion((void *)InterfacePage, sizeof(IFPAGE)); - _dpmi_lockregion((void *)&MiscStats, sizeof(MiscStats)); - _dpmi_lockregion((void *)MiscStats, sizeof(MISCSTATS)); - - /* Lock the flags */ - _dpmi_lockregion((void *)&KBDEventFlg, sizeof(KBDEventFlg)); - _dpmi_lockregion((void *)&MachineState, sizeof(MachineState)); - - /* Lock the pointers into the sysout */ - _dpmi_lockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k)); - - /* Lock the regions of the sysout that the pointers points to */ - /* KEYBUFFERINF68k points to the value cell for a symbol */ - _dpmi_lockregion((void *)KEYBUFFERING68k, sizeof(LispPTR)); - - /* CTopKeyevent points to the ring-buffer of keyboard events */ - _dpmi_lockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent)); - _dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent)); - - /* Now Lock the lastuseraction machine. */ - /* _dpmi_lockregion(mouse->timestamp, sizeof(LispPTR)); */ /* Lisp_world itself */ - - regs.w.eax = 0x0001; /* Function 1 = turn on mouse cursor */ - int86(0x33, ®s, ®s); - regs.w.eax = 0x0002; /* Function 2 = hide mouse cursor */ - int86(0x33, ®s, ®s); - - regs.w.eax = 0x0C; /* Function 0C = set user-defined mouse handler */ - regs.w.ecx = LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF | MOUSE_MV; - regs.w.edx = FP_OFF(*(mouse->Handler)); /* Address of our mouse handler routine */ - int86(0x33, ®s, ®s); /* Install our handler to process events */ - - if (regs.w.eax == 'MERR') - VESA_errorexit("Unable to install mouse handler - not enough low memory.\n", -1); - - regs.x.ax = 0x7; /* Set mouse horizontal range */ - regs.x.cx = 0x0; - regs.x.dx = (short)(dsp->Display.width - 1); - int86(0x33, ®s, ®s); - - regs.x.ax = 0x8; /* Set mouse vertical range */ - regs.x.cx = 0x0; - regs.x.dx = (short)(dsp->Display.height - 1); - int86(0x33, ®s, ®s); - - /* See if turning this off fixes the "mouse granularity" problem */ - /* Nope. It didn't. */ - regs.x.ax = 0xf; /* Set mickey per pixel range */ - regs.x.cx = 0x8; - regs.x.dx = 0x8; - int86(0x33, ®s, ®s); - - mouse->Button.NextHandler = _dos_getvect(0x1c); - _dos_setvect(0x1c, ButtonTimer); - - mouse->device.active = TRUE; -} - -void ExitDosMouse(MouseInterface mouse) -{ - if (mouse->device.active) { - /* Unlock myself */ - _dpmi_unlockregion((void *)mouse, sizeof(*mouse)); - _dpmi_unlockregion((void *)¤tmouse, sizeof(currentmouse)); - - /* Unlock the handler routines */ - _dpmi_unlockregion((void *)mouse->Handler, 4096); - _dpmi_unlockregion((void *)&ButtonTimer, 4096); - _dpmi_unlockregion((void *)&MouseButtonSignal, 4096); - - /* Unlock the structures used. */ - _dpmi_unlockregion((void *)&IOPage68K, sizeof(IOPage68K)); - _dpmi_unlockregion((void *)&InterfacePage, sizeof(InterfacePage)); - _dpmi_unlockregion((void *)&MiscStats, sizeof(MiscStats)); - - /* Unlock the flags */ - _dpmi_unlockregion((void *)&KBDEventFlg, sizeof(KBDEventFlg)); - _dpmi_unlockregion((void *)&MachineState, sizeof(MachineState)); - - /* Unlock the pointers into the sysout */ - _dpmi_unlockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k)); - /* _dpmi_unlockregion((void *)&KEYBOARDEVENTQUEUE68k, sizeof(KEYBOARDEVENTQUEUE68k)); */ - - /* Unlock the regions of the sysout that the pointers points to */ - _dpmi_unlockregion((void *)KEYBUFFERING68k, sizeof(LispPTR)); - - _dpmi_unlockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent)); - _dpmi_unlockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent)); - - /* _dpmi_unlockregion(mouse->timestamp, sizeof(LispPTR)); */ - - _dos_setvect(0x1c, mouse->Button.NextHandler); - mouse->device.active = FALSE; - } -} - -void DosMouseAfterRaid(MouseInterface mouse, DspInterface dsp) -{ - union REGS regs; - - /* Screen mode changed. We have to reinit the ranges. */ - regs.x.ax = 0x7; /* Set mouse horizontal range */ - regs.x.cx = 0x0; - regs.x.dx = (short)(dsp->Display.width - 1); - int86(0x33, ®s, ®s); - - regs.x.ax = 0x8; /* Set mouse vertical range */ - regs.x.cx = 0x0; - regs.x.dx = (short)(dsp->Display.height - 1); - int86(0x33, ®s, ®s); - - mouse->device.active = TRUE; -} - -void DosMouseBeforeRaid(MouseInterface mouse, DspInterface dsp) -{ mouse->device.active = FALSE; } - -/***************************************************************/ -/* d o s _ c u r s o r _ i n v i s s i b l e */ -/* Since we only blit the cursor to the VESA/VGA displaybuffer */ -/* and not to the emulator displaybuffer we can make the cursor*/ -/* invisible just by updating the area under the cursor! */ -/***************************************************************/ -void dos_cursor_invisible(DspInterface dsp, IOPAGE *iop) - -{ (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, iop->dlcursorx, iop->dlcursory, 16, 16); } - -/***************************************************************/ -/* d o s _ c u r s o r _ v i s s i b l e */ -/* blit the mouse to the display ... */ -/* The cursor should be blitted according to the following: */ -/* ((backgroundbm AND maskbm) OR ((NOT mask) OR cursorbm)) */ -/* ie. bltAND the mask to the background then bltOR the rest */ -/* */ -/* Hah!! this crappy machine doesn't have a mask!! /jarl */ -/* ie. use the inverted bitmap as a mask!!!! */ -/* */ -/* More to the point. The mask is the image inverted. (sigh..) */ -/* */ -/***************************************************************/ - -set_DOSmouseposition(DspInterface dsp, int x, int y) - -{ - union REGS regs; - - dsp->device.locked++; - currentmouse->device.active++; - -#ifdef NEVER - /* int 33h, case 0004, cx=col, dx = row */ - regs.w.eax = 4; /* Function 4 = move cursor */ - regs.w.ecx = x; - regs.w.edx = y; - int86(0x33, ®s, ®s); -#endif /* NEVER */ - - /* Actually move the cursor image */ - IOPage68K->dlmousex = x; - IOPage68K->dlmousey = y; - - /* *(currentmouse->timestamp) = MiscStats->secondstmp; */ - - (currentdsp->mouse_invisible)(currentdsp, IOPage68K); - currentmouse->Cursor.New.x = IOPage68K->dlcursorx = x; - currentmouse->Cursor.New.y = IOPage68K->dlcursory = y; - (currentdsp->mouse_visible)(x, y); - - dsp->device.locked--; - currentmouse->device.active--; -} - -void docopy(int newx, int newy) -{ - register DLword *srcbase, *dstbase; - static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0; - static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0; - - srcbase = IOPage68K->dlcursorbitmap; - dstbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16); - sx = 0; - dx = newx; - w = currentmouse->Cursor.Last.width; - h = currentmouse->Cursor.Last.height; - srcbpl = 16; - dstbpl = currentdsp->Display.width; - op = 2; /* OR-in */ - -#ifdef NEWBITBLT - bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 2, 0, 0, 0); -#else - new_bitblt_code; -#endif /* NEWBITBLT */ -} - -dostaking_mouse_up(int newx, int newy) -{ - /* save hidden bitmap */ - - register DLword *srcbase, *dstbase; - static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0; - static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0; - - /* newx and newy are hotspot coordinates. */ - /* newx -= currentmouse->Cursor.Hotspot.x; */ - /* newy -= ( 15 - currentmouse->Cursor.Hotspot.y); */ - - /* save image */ - srcbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16); - dstbase = currentmouse->Cursor.Savebitmap; - sx = newx; - dx = 0; - - if (currentdsp->Display.width < (newx + 16)) { - currentmouse->Cursor.Last.width = w = currentdsp->Display.width - newx; - } else { - currentmouse->Cursor.Last.width = w = 16; - }; - - if (currentdsp->Display.height < (newy + 16)) { - currentmouse->Cursor.Last.height = h = currentdsp->Display.height - newy; - } else { - currentmouse->Cursor.Last.height = h = 16; - }; - - srcbpl = currentdsp->Display.width; - dstbpl = 16; - op = 0; /* replace */ - -#ifdef NEWBITBLT - bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, gray, num_gray, - curr_gray_line); -#else - new_bitblt_code; -#endif /* NEWBITBLT */ - - /* Copy Cursor Image */ - docopy(newx, newy); - - currentmouse->Cursor.Last.x = newx; - currentmouse->Cursor.Last.y = newy; - - (currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x, - currentmouse->Cursor.Last.y, w, h); -} - -dostaking_mouse_down(DspInterface dsp, IOPAGE *iop) -{ - register DLword *srcbase, *dstbase; - static int sx, dx, w, h, srcbpl, dstbpl, backwardflg = 0; - static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0; - - /* restore saved image */ - srcbase = currentmouse->Cursor.Savebitmap; - dstbase = - DisplayRegion68k + ((currentmouse->Cursor.Last.y) * (dsp->Display.width / 16)); /* old y */ - sx = 0; - dx = currentmouse->Cursor.Last.x; /* old x */ - w = currentmouse->Cursor.Last.width; - h = currentmouse->Cursor.Last.height; - srcbpl = 16; - dstbpl = dsp->Display.width; - op = 0; - -#ifdef NEWBITBLT - bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, 0, 0, 0); -#else - new_bitblt_code; -#endif /* NEWBITBLT */ - - (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, currentmouse->Cursor.Last.x, - currentmouse->Cursor.Last.y, w, h); -} - -/************************************************************************/ -/* */ -/* M o u s e B u t t o n S i g n a l */ -/* */ -/* Tell LISP about a mouse event by putting an entry on the ring buf- */ -/* fer of mouse/kbd events, with the new mouse-button state in it. */ -/* */ -/* */ -/************************************************************************/ - -void MouseButtonSignal(MouseInterface mouse) -{ - DLword w, r; - KBEVENT *kbevent; - - /* In the mouse device TRUE means button pressed */ - /* In the IOPage 0 means button pressed */ - /* Hence the ! in the lines below. */ - PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_LEFT, !mouse->Button.Left); - PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_MIDDLE, !mouse->Button.Middle); - PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_RIGHT, !mouse->Button.Right); - - r = CTopKeyevent->ring.vectorindex.read; - w = CTopKeyevent->ring.vectorindex.write; - - if (r != w) { - kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w); - - /* Copy the Hardware bits. */ - kbevent->W0 = IOPage68K->dlkbdad0; - kbevent->W1 = IOPage68K->dlkbdad1; - kbevent->W2 = IOPage68K->dlkbdad2; - kbevent->W3 = IOPage68K->dlkbdad3; - kbevent->W4 = IOPage68K->dlkbdad4; - kbevent->W5 = IOPage68K->dlkbdad5; - kbevent->WU = IOPage68K->dlutilin; - - /* If queue was empty, update the read pointer */ - if (r == 0) CTopKeyevent->ring.vectorindex.read = w; - - /* Update the write pointer */ - if (w >= mouse->maxkeyevent) - CTopKeyevent->ring.vectorindex.write = MINKEYEVENT; - else - CTopKeyevent->ring.vectorindex.write += mouse->keyeventsize; - } - - if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T; - - KBDEventFlg++; /* Signal the emulator to tell Lisp */ - Irq_Stk_Check = 0; - Irq_Stk_End = 0; -} - -/***************************************************************/ -/* B u t t o n T i m e r */ -/* This function is used with the mouse chording machinery. */ -/* This function is the timer interrupt handler. When a button */ -/* event happens we will wait to report it until the next */ -/* timeout happens. We will thus obtain the ``rubbery feeling''*/ -/* that proponents of chording so desire. */ -/***************************************************************/ -void ButtonTimer() { - if (currentmouse->Button.RunTimer) - if (currentmouse->Button.tick-- <= 0) { - currentmouse->Button.RunTimer = FALSE; /* Turn the timer off. */ - currentmouse->Button.Left |= currentmouse->Button.StateLeft; - currentmouse->Button.Right |= currentmouse->Button.StateRight; - - /* Mouse chording code. If at the end of the timeout - the left and right buttons are down we signal middle - button and bring the others up. */ - /* Are L & R down? */ - - if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) { - currentmouse->Button.Left = FALSE; - currentmouse->Button.Right = FALSE; - currentmouse->Button.Middle = TRUE; - } - - currentmouse->Button.StateLeft = FALSE; - currentmouse->Button.StateRight = FALSE; - - /* Did L & R go up after a simulated M */ - /* if((currentmouse->Button.Middle && - !(currentmouse->Button.StateLeft || - currentmouse->Button.StateRight))) - { - currentmouse->Button.Left = FALSE; - currentmouse->Button.Right = FALSE; - currentmouse->Button.Middle = FALSE; - } - */ - MouseButtonSignal(currentmouse); - } - _chain_intr(currentmouse->Button.NextHandler); -} - -/***************************************************************/ -/* T w o B u t t o n H a n d l e r */ -/* This function is the interrupt handler for the mouse. */ -/* This function sets the state of the mouse structure and */ -/* signals the dispatch loop to take care of the matter. This */ -/* awkward solution is due to the severe braindamage in DOS. */ -/***************************************************************/ -void TwoButtonHandler(void) { - _XSTACK *stk_ptr; - - /* First save the stack frame. */ - stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */ - stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */ - - if (!currentmouse->device.active) return; - - if (stk_ptr->eax & LB_PRESS) - if (currentmouse->Button.RunTimer) /* Prior right-down seen... */ - { - currentmouse->Button.RunTimer = FALSE; - currentmouse->Button.FakeMiddle = TRUE; - currentmouse->Button.Middle = TRUE; - currentmouse->Button.StateLeft = TRUE; - MouseButtonSignal(currentmouse); - } else if (currentmouse->Button.Right) { - currentmouse->Button.Left = TRUE; - currentmouse->Button.StateLeft = TRUE; - MouseButtonSignal(currentmouse); - } else /* No other button down... */ - { - currentmouse->Button.StateLeft = TRUE; - currentmouse->Button.tick = currentmouse->Button.StartTime; - currentmouse->Button.RunTimer = TRUE; - } - if (stk_ptr->eax & LB_OFF) /* Left button released, and */ - if (currentmouse->Button.RunTimer) /* Timer had been running */ - { - currentmouse->Button.RunTimer = FALSE; - currentmouse->Button.Left = TRUE; - MouseButtonSignal(currentmouse); - currentmouse->Button.StateLeft = FALSE; - /* currentmouse->Button.Left = FALSE; - MouseButtonSignal(currentmouse); */ - } else /* timer wasn't running */ - { - currentmouse->Button.StateLeft = FALSE; - currentmouse->Button.Left = FALSE; - currentmouse->Button.FakeMiddle = FALSE; - currentmouse->Button.Middle = currentmouse->Button.StateMiddle; - MouseButtonSignal(currentmouse); - } - - if ((stk_ptr->eax & CB_PRESS) || (stk_ptr->eax & CB_OFF)) { - currentmouse->Button.Middle = - ((stk_ptr->eax & CB_PRESS) && TRUE) || currentmouse->Button.FakeMiddle; - currentmouse->Button.StateMiddle = (stk_ptr->eax & CB_PRESS) && TRUE; - currentmouse->Button.RunTimer = FALSE; - MouseButtonSignal(currentmouse); - } - - if (stk_ptr->eax & RB_PRESS) /* Right button pressed, and */ - if (currentmouse->Button.RunTimer) /* Timer was running... */ - { - currentmouse->Button.RunTimer = FALSE; - currentmouse->Button.FakeMiddle = TRUE; - currentmouse->Button.Middle = TRUE; - currentmouse->Button.StateRight = TRUE; - MouseButtonSignal(currentmouse); - } else if (currentmouse->Button.Left) { - currentmouse->Button.Right = TRUE; - currentmouse->Button.StateRight = TRUE; - MouseButtonSignal(currentmouse); - } else { - currentmouse->Button.StateRight = TRUE; - currentmouse->Button.tick = currentmouse->Button.StartTime; - currentmouse->Button.RunTimer = TRUE; - } - if (stk_ptr->eax & RB_OFF) /* Right button released */ - if (currentmouse->Button.RunTimer) /* Timer had been running */ - { - currentmouse->Button.RunTimer = FALSE; - currentmouse->Button.Right = TRUE; - MouseButtonSignal(currentmouse); - currentmouse->Button.StateRight = FALSE; - /* currentmouse->Button.Right = FALSE; - MouseButtonSignal(currentmouse); */ - } else { - currentmouse->Button.StateRight = FALSE; - currentmouse->Button.Right = FALSE; - currentmouse->Button.FakeMiddle = FALSE; - currentmouse->Button.Middle = currentmouse->Button.StateMiddle; - MouseButtonSignal(currentmouse); - } - - /* The dude moved the mouse. Set the chordstate NOW. */ - /* And turn the timer off. */ - if ((stk_ptr->eax & MOUSE_MV) && (!currentdsp->device.locked)) { - currentmouse->Button.RunTimer = FALSE; - - /* Are L & R down? */ - /* if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight) - { - currentmouse->Button.Left = FALSE; - currentmouse->Button.Right = FALSE; - currentmouse->Button.Middle = TRUE; - } - */ - /* currentmouse->Cursor.New.x = (DLword)stk_ptr->ecx & 0xFFFF; - currentmouse->Cursor.New.y = (DLword)stk_ptr->edx & 0xFFFF; */ - currentmouse->Cursor.Moved = TRUE; - - if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) { - currentmouse->Button.Left = FALSE; - currentmouse->Button.Right = FALSE; - currentmouse->Button.Middle = TRUE; - } else { - currentmouse->Button.Left |= currentmouse->Button.StateLeft; - currentmouse->Button.Right |= currentmouse->Button.StateRight; - } - - currentmouse->Button.StateLeft = currentmouse->Button.StateRight = FALSE; - MouseButtonSignal(currentmouse); - } -} - -/***************************************************************/ -/* T h r e e B u t t o n H a n d l e r */ -/* This function is the interrupt handler for the mouse. */ -/* This function sets the state of the mouse structure and */ -/* signals the dispatch loop to take care of the matter. This */ -/* awkward solution is due to the severe braindamage in DOS. */ -/***************************************************************/ -void ThreeButtonHandler() - -{ - _XSTACK *stk_ptr; - unsigned long mouse_flags; - - /* First save the stack frame. */ - stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */ - stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */ - - if (currentmouse->device.active) { - mouse_flags = stk_ptr->eax; /* Save event flags from mouse driver */ - - /* Decode the transition bits. */ - if (mouse_flags & LB_PRESS) currentmouse->Button.Left = TRUE; - if (mouse_flags & LB_OFF) currentmouse->Button.Left = FALSE; - - if (mouse_flags & CB_PRESS) currentmouse->Button.Middle = TRUE; - if (mouse_flags & CB_OFF) currentmouse->Button.Middle = FALSE; - - if (mouse_flags & RB_PRESS) currentmouse->Button.Right = TRUE; - if (mouse_flags & RB_OFF) currentmouse->Button.Right = FALSE; - - if ((!currentdsp->device.locked) && (mouse_flags & MOUSE_MV)) { - currentmouse->Cursor.Moved = TRUE; - Irq_Stk_Check = 0; - Irq_Stk_End = 0; - } - - if (mouse_flags & (LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF)) - MouseButtonSignal(currentmouse); - } -} diff --git a/src/kbdif.c b/src/kbdif.c deleted file mode 100644 index ba6a0e6..0000000 --- a/src/kbdif.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $Id: kbdif.c,v 1.3 1999/05/31 23:35:35 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -/* * K Y E B O A R D I N T E R F A C E * */ - -#include "lispemul.h" -#include "dbprint.h" -#include "devif.h" - -KbdInterfaceRec curkbd; -KbdInterface currentkbd = &curkbd; - -void make_kbd_instance(KbdInterface kbd) { -#if XWINDOW -#endif /* DOS or XWINDOW */ -} diff --git a/src/mouseif.c b/src/mouseif.c deleted file mode 100644 index fdb5a9e..0000000 --- a/src/mouseif.c +++ /dev/null @@ -1,27 +0,0 @@ -/* $Id: mouseif.c,v 1.2 1999/01/03 02:07:26 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -/* * * * D O S M O U S E I N T E R F A C E * * * */ - -#include "version.h" - -#include "lispemul.h" -#include "dbprint.h" -#include "devif.h" - -MouseInterfaceRec curmouse; -MouseInterface currentmouse = &curmouse; - -void make_mouse_instance(MouseInterface mouse) -{ -#if XWINDOW -#endif /* DOS or XWINDOW */ -} diff --git a/src/vesainit.c b/src/vesainit.c deleted file mode 100644 index 5ad44ef..0000000 --- a/src/vesainit.c +++ /dev/null @@ -1,452 +0,0 @@ -/* $Id: vesainit.c,v 1.2 1999/01/03 02:07:44 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1992, 1993, 1994, 1995 Venue. All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -/************************************************************************/ -/* */ -/* V E S A I N I T . C */ -/* */ -/* Using VESA calls, initialize the (S)VGA for Medley's use. */ -/* */ -/************************************************************************/ - -#include /* #pragma interrupt & _get_stk_frame */ -#include -#include /* _XSTACK struct definition */ -#include -#include -#include -#include - -#include "dbprint.h" -#include "lispemul.h" -#include "devif.h" - -#define VESA 0x4f -#define SUCESS 0x00 -/* VESA functions */ -#define _DESCRIBEMODE 0x1 -#define _SETMODE 0x2 -#define _GETCURRENTMODE 0x3 - -/* VESA modevector indexes */ -#define _DISPLAYWIDTH 0x12 -#define _DISPLAYHEIGHT 0x14 -#define _COLORPLANES 0x18 -#define _BITSPERPIXEL 0x19 - -#define VESA_MODE_SUPPORTED_P(vector) ((((short *)vector)[0] & 1) ? TRUE : FALSE) -#define VESA_OPT_INFO_P(vector) ((((short *)vector)[0] & 2) ? TRUE : FALSE) -#define VESA_COLOR_MODE_P(vector) ((((short *)vector)[0] & 4) ? TRUE : FALSE) -#define VESA_GRAPHICS_MODE_P(vector) ((((short *)vector)[0] & 8) ? TRUE : FALSE) -#define VESA_SWITCH_BANK(vector) ((PFV)(((long *)vector)[3])) -#define VESA_DSP_SEGSIZE(vector) ((long)(0xffff & ((short *)vector)[3])) -#define VESA_DSP_STARTSEG_A(vector) ((long)(0xffff & ((short *)vector)[4])) -#define VESA_DSP_WIDTH(vector) ((long)(((short *)vector)[9])) -#define VESA_DSP_HEIGHT(vector) ((long)(((short *)vector)[10])) -#define VESA_DSP_COLORS(vector) ((long)(1 << (((char *)vector)[0x19]))) -#define VESA_DSP_BPP(vector) ((long)(((char *)vector)[0x19])) -#define VESA_DSP_NUM_OF_BANKS(vector) ((long)(((char *)vector)[0x1a])) -#define VESA_DSP_BANK_SIZE(vector) ((long)(((char *)vector)[0x1c])) - -#define MAKE_SEG(low_flat) ((FP_OFF(low_flat) & 0xfffffff0) >> 4) -#define MAKE_OFF(low_flat) (FP_OFF(low_flat & 0x0000000f)) - -#pragma interrupt(VESA_Intrpt_Hndlr) /* int 0x10 intercept */ - -extern DLword *DisplayRegion68k; -extern DLword *DisplayRegion68k_end_addr; -extern DspInterface currentdsp; -extern void docopy(); - -extern PFUL GenericReturnT(); -extern void GenericPanic(); -extern unsigned long VGA_not_color(); -extern void VGA_exit(); -extern unsigned long Dosbbt1(); -extern unsigned long Dosbbt2(); -extern unsigned long Dosbbt3(); -extern void Dosclearbanks(); -extern long DOSCursorVisible(); -extern long dos_cursor_invisible(); -extern int dostaking_mouse_down(); -extern int dostaking_mouse_up(); - -void VESA_Intrpt_Hndlr(void); -void *VESA_prev_hndlr; /* addr of previous 0x10 intercept */ - -extern int dosdisplaymode; - -/**************************************************************/ -/* V E S A _ c a l l */ -/* General utility function for doing a BIOS call to the VESA */ -/* bios. */ -/**************************************************************/ -int VESA_call(int class, int subfunc) -{ - union REGS inregs, outregs; - - inregs.h.ah = VESA; - inregs.h.al = class; - inregs.x.bx = subfunc; - int86(0x10, &inregs, &outregs); - return ((outregs.h.al == VESA) && (outregs.h.ah == SUCESS)); -} - -unsigned long set_DAC_color(LispPTR args[]) -{ - union REGS inregs, outregs; - - inregs.x.ax = 0x1010; - inregs.x.bx = (unsigned char)(args[0] & 0xff); - inregs.h.dh = (unsigned char)(args[1] & 0xff); - inregs.h.ch = (unsigned char)(args[2] & 0xff); - inregs.h.cl = (unsigned char)(args[3] & 0xff); - int86(0x10, &inregs, &outregs); -} - -/**************************************************************/ -/* V E S A _ c u r r e n t m o d e */ -/* Returns the current VESA mode for the display. */ -/* Modes defined to date are: */ -/* 0x100 640x400 & 256 colors (Not tested yet) */ -/* 0x101 640x480 & 256 colors */ - -/* 0x102 800x600 & 16 colors */ -/* 0x103 800x600 & 256 colors (Not tested yet) */ - -/* 0x104 1024x768 & 16 colors */ -/* 0x105 1024x768 & 256 colors (Not tested yet) */ - -/* 0x106 1280x1024 & 16 colors (Not tested yet) */ -/* 0x107 1280x1024 & 256 colors (Not tested yet) */ -/* */ -/**************************************************************/ -int VESA_currentmode() { - union REGS inregs, outregs; - - inregs.h.ah = VESA; - inregs.h.al = _GETCURRENTMODE; - inregs.x.bx = 0; - int86(0x10, &inregs, &outregs); - if ((outregs.h.al == VESA) && (outregs.h.ah == SUCESS)) { - return (outregs.x.bx); - } else { - return (FALSE); - } -} - -int VESA_setmode(int mode, int clearscreen) -{ - union REGS inregs, outregs; - - inregs.h.ah = VESA; - inregs.h.al = _SETMODE | ((clearscreen) ? 0x8000 : 0); - inregs.x.bx = mode; - int86(0x10, &inregs, &outregs); - return ((outregs.h.al == VESA) && (outregs.h.ah == SUCESS)); -} - -#define VESABUFLEN 256 -char VESAmodevector[VESABUFLEN]; -char *VESAmodebytes = VESAmodevector; - -/* VESA_describemode */ -int VESA_describemode(int mode) -{ - union REGS inregs, outregs; - int i; - unsigned buf; - - TPRINT(("Enter VESA_describemode\n")); - VESA_prev_hndlr = _dos_getvect(0x10); /* get current 10 intercept, if any */ - _dos_setvect(0x10, VESA_Intrpt_Hndlr); /* install our int 10 intercept */ - - if (_dos_allocmem(VESABUFLEN, &buf) != 0) return (-1); - - inregs.w.eax = 0x4f01; - inregs.w.ebx = buf; - inregs.w.ecx = mode; - int86(0x10, &inregs, &outregs); - - if (outregs.x.ax == VESA) { - for (i = 0; i < VESABUFLEN; i++) { VESAmodebytes[i] = ((char *)buf)[i]; } - } else { - return (-1); - } - - _dos_freemem(buf); /* release the buffer */ - _dos_setvect(0x10, VESA_prev_hndlr); /* re-install previous 10 intercept */ - TPRINT(("Exit VESA_describemode\n")); - return (0); -} - -void VESA_Intrpt_Hndlr(void) { - int inbuffer, func; - _XSTACK *stk_ptr; - - /* get ptr to _XSTACK - regs, etc */ - stk_ptr = (_XSTACK *)_get_stk_frame(); - - func = (unsigned short)stk_ptr->eax; /* get function */ - - if (((stk_ptr->flg & _FLAG_VM) == 0) /* process only if NOT virtual mode*/ - && (func == 0x4f01)) { /* AND only if func 4f */ - inbuffer = stk_ptr->ebx; /* get ebx as passed (flat addr) */ - stk_ptr->edi = MAKE_OFF(inbuffer); /* convert to seg:off form */ - stk_ptr->es = MAKE_SEG(inbuffer); /* service requires it in es:di */ - - ((PFV)VESA_prev_hndlr)(); /* call VESA getmode */ - } else { - _chain_intr(VESA_prev_hndlr); /* always best to chain to prev int*/ - } -} - -void VESA_beforeraid(DspInterface dsp) -{ - TPRINT(("Enter VESA_beforeraid\n")); - _setvideomode(_DEFAULTMODE); - _clearscreen(_GCLEARSCREEN); - TPRINT(("Exit VESA_beforeraid\n")); -} - -void VESA_afterraid(DspInterface dsp) -{ - TPRINT(("Enter VESA_afterraid\n")); - VESA_setmode(dsp->graphicsmode, TRUE); - TPRINT(("Exit VESA_afterraid\n")); -} - -void VESA_enter(DspInterface dsp) -{ - union REGS regs; - - TPRINT(("Enter VESA_enter\n")); - VESA_setmode(dsp->graphicsmode, TRUE); - if (!((VESA_describemode(dsp->graphicsmode) == 0))) { - _setvideomode(_DEFAULTMODE); - _clearscreen(_GCLEARSCREEN); - fprintf(stderr, "Can't set VESA mode %o.\n", dsp->graphicsmode); - exit(0); - } - /* Get the segaddr. An addr. is a seg shifted 4 bits! */ - dsp->DisplayStartAddr = VESA_DSP_STARTSEG_A(VESAmodebytes) << 4; - /* Get the size. */ - dsp->DisplaySegSize = (VESA_DSP_SEGSIZE(VESAmodebytes) << 10); - - /* How many bits in the segment addr. */ - switch (VESA_DSP_SEGSIZE(VESAmodebytes)) { - case 64: dsp->DisplaySegMagnitude = 0x10; break; - case 128: dsp->DisplaySegMagnitude = 0x11; break; - case 256: dsp->DisplaySegMagnitude = 0x12; break; - } - - dsp->SwitchBank = NULL; - - if (VESA_OPT_INFO_P(VESAmodebytes)) { - dsp->Display.width = VESA_DSP_WIDTH(VESAmodebytes); - dsp->Display.height = VESA_DSP_HEIGHT(VESAmodebytes); - } else { /* Drat! No optional info. Hardcode. */ - switch (dsp->graphicsmode) { - case 0x100: - dsp->Display.width = 640; - dsp->Display.height = 400; - break; - case 0x101: - dsp->Display.width = 640; - dsp->Display.height = 480; - break; - case 0x102: - case 0x103: - dsp->Display.width = 800; - dsp->Display.height = 600; - break; - case 0x104: - case 0x105: - dsp->Display.width = 1024; - dsp->Display.height = 768; - break; - case 0x106: - case 0x107: - dsp->Display.width = 1280; - dsp->Display.height = 1024; - break; - } - } - dsp->colors = VESA_DSP_COLORS(VESAmodebytes); - dsp->bitsperpixel = VESA_DSP_BPP(VESAmodebytes); - dsp->numberofbanks = VESA_DSP_NUM_OF_BANKS(VESAmodebytes); - - /* Assumption: 8 bits per pixel */ - dsp->LinesPerBank = 8 * (dsp->DisplaySegSize / dsp->Display.width); - - _dpmi_lockregion(¤tdsp, sizeof(currentdsp)); - _dpmi_lockregion(&DisplayRegion68k, sizeof(DisplayRegion68k)); - _dpmi_lockregion(DisplayRegion68k, 1600 * 1208 / 8); - - /* These are needed in the interrupt processing. Lock'em to prevent pagefaults. */ - _dpmi_lockregion(dsp, sizeof(*dsp)); - _dpmi_lockregion(dsp->bitblt_to_screen, 0x2000); - _dpmi_lockregion(dsp->mouse_invisible, 0x2000); - _dpmi_lockregion(dsp->mouse_visible, 0x2000); - _dpmi_lockregion((void *)&docopy, 0x2000); - - TPRINT(("Exit VESA_enter\n")); -} - -void VESA_exit(DspInterface dsp) -{ - TPRINT(("Enter VESA_exit\n")); - /* Unlock the following to avoid waste of mainmem. */ - _dpmi_unlockregion(¤tdsp, sizeof(currentdsp)); - _dpmi_unlockregion(&DisplayRegion68k, sizeof(DisplayRegion68k)); - _dpmi_unlockregion(DisplayRegion68k, 1600 * 1208 / 8); - - _dpmi_unlockregion(dsp->bitblt_to_screen, 0x2000); - _dpmi_unlockregion(dsp->mouse_invisible, 0x2000); - _dpmi_unlockregion(dsp->mouse_visible, 0x2000); - _dpmi_unlockregion((void *)&docopy, 0x2000); - _dpmi_unlockregion(dsp, sizeof(*dsp)); - - _setvideomode(_DEFAULTMODE); - _clearscreen(_GCLEARSCREEN); - TPRINT(("Exit VESA_exit\n")); -} - -VESA_errorexit(char *s, int errno) -{ - _setvideomode(_DEFAULTMODE); - _clearscreen(_GCLEARSCREEN); - fprintf(stderr, s); - fflush(stderr); - exit(errno); -} - -void tmpclearbanks(DspInterface dsp) -{ - TPRINT(("Enter tmpclearbanks\n")); - /* Dosclearbanks(dsp); */ - TPRINT(("Exit tmpclearbanks\n")); -} - -unsigned long tmpbbt(DspInterface dsp, char *buffer, long left, long top, long swidth, long height) -{ - TPRINT(("Enter tmpbbt\n")); - TPRINT(("Mode display is: %d\n", dsp->graphicsmode)); - TPRINT(("dsp->Display.width = %d\n", dsp->Display.width)); - TPRINT(("dsp->Display.height = %d\n", dsp->Display.height)); - TPRINT(("left = %d, top = %d, swidth = %d, height = %d\n", left, top, swidth, height)); - (Dosbbt3)(dsp, buffer, left, top, swidth, height); - TPRINT(("Exit tmpbbt\n")); -} - -void VESA_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint) -{ - TPRINT(("Enter VESA_init\n")); - /* Kludge. going away soon. */ - dsp->graphicsmode = dosdisplaymode; - - /* A graphics mode is requested. Test its validity */ - if (dsp->graphicsmode == 0) { - /* No mode requested. Find a suitable mode from hints. */ - switch (depth_hint) { - case 0: - case 1: - if ((VESA_describemode(0x104) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) - dsp->graphicsmode = 0x104; - else if ((VESA_describemode(0x102) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) - dsp->graphicsmode = 0x102; - else - VESA_errorexit("Displaymode not supported", -1); - break; - case 8: - if ((VESA_describemode(0x105) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) { - dsp->graphicsmode = 0x105; - } else if ((VESA_describemode(0x103) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) { - dsp->graphicsmode = 0x103; - } else if ((VESA_describemode(0x101) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) { - dsp->graphicsmode = 0x101; - } else if ((VESA_describemode(0x100) == 0) && (VESA_MODE_SUPPORTED_P(VESAmodevector))) { - dsp->graphicsmode = 0x100; - } else - VESA_errorexit("Displaymode not supported", -1); - break; - default: VESA_errorexit("Requested display depth not supported", -1); - } - } else if (!((VESA_describemode(dsp->graphicsmode) == 0) && - (VESA_MODE_SUPPORTED_P(VESAmodevector)))) { - VESA_errorexit("Can't find suitable VESA mode.\n", -1); - } - - switch (dsp->graphicsmode) { - case 0x100: - case 0x101: - dsp->BytesPerLine = 640; - dsp->bitblt_to_screen = &tmpbbt; - break; - case 0x102: - dsp->BytesPerLine = 100; - dsp->bitblt_to_screen = &Dosbbt1; - break; - case 0x103: - dsp->BytesPerLine = 800; - dsp->bitblt_to_screen = &tmpbbt; - break; - case 0x104: - dsp->BytesPerLine = 128; - dsp->bitblt_to_screen = &Dosbbt2; - break; - case 0x105: - dsp->BytesPerLine = 1024; - dsp->bitblt_to_screen = &tmpbbt; - break; - case 0x106: - dsp->BytesPerLine = 160; - dsp->bitblt_to_screen = &Dosbbt2; - break; - case 0x107: - dsp->BytesPerLine = 1280; - dsp->bitblt_to_screen = &tmpbbt; - break; - default: VESA_errorexit("Displaymode not supported", -1); - } - - TPRINT(("Mode display is: %d\n", dsp->graphicsmode)); - - dsp->device.locked = FALSE; - dsp->device.active = FALSE; - - dsp->device.enter = &VESA_enter; - dsp->device.exit = &VESA_exit; - - dsp->device.before_raid = &VESA_beforeraid; - dsp->device.after_raid = &VESA_afterraid; - - dsp->drawline = &GenericPanic; - - dsp->cleardisplay = &tmpclearbanks; - - dsp->get_color_map_entry = &VGA_not_color; - dsp->set_color_map_entry = &set_DAC_color; - dsp->available_colors = &VGA_not_color; - dsp->possible_colors = &VGA_not_color; - - dsp->medley_to_native_bm = (PFUL)&GenericPanic; - dsp->native_to_medley_bm = (PFUL)&GenericPanic; - - dsp->bitblt_from_screen = (PFUL)&GenericPanic; - dsp->scroll_region = (PFUL)&GenericPanic; - - dsp->mouse_invisible = (PFV)&dostaking_mouse_down; - dsp->mouse_visible = (PFV)&dostaking_mouse_up; - - TPRINT(("Exit VESA_init\n")); -} diff --git a/src/vgainit.c b/src/vgainit.c deleted file mode 100644 index b9824fa..0000000 --- a/src/vgainit.c +++ /dev/null @@ -1,147 +0,0 @@ -/* $Id: vgainit.c,v 1.2 1999/01/03 02:07:45 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved - */ - -/************************************************************************/ -/* */ -/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */ -/* All Rights Reserved. */ -/* Manufactured in the United States of America. */ -/* */ -/************************************************************************/ - -#include "version.h" - -#include -#include -#include "lispemul.h" -#include "devif.h" - -extern unsigned long Dosbbt1(); -extern unsigned long Dosbbt2(); -extern int dostaking_mouse_down(); -extern int dostaking_mouse_up(); - -extern DLword *DisplayRegion68k; -extern DLword *DisplayRegion68k_end_addr; -extern DspInterface currentdsp; -extern void docopy(); - -extern void GenericPanic(); - -void VGA_setmax(DspInterface dsp) -{ - struct videoconfig vc; - - if (!_setvideomode(_MAXRESMODE)) { - fprintf(stderr, "Can't set graphics mode.\n"); - exit(1); - } - _getvideoconfig(&vc); - dsp->Display.width = vc.numxpixels; - dsp->Display.height = vc.numypixels; - dsp->bitsperpixel = vc.bitsperpixel; - dsp->colors = vc.numcolors; - - /* These are needed in the interrupt processing. Lock'em to prevent pagefaults. */ - _dpmi_lockregion(¤tdsp, sizeof(currentdsp)); - _dpmi_lockregion(&DisplayRegion68k, sizeof(DisplayRegion68k)); - _dpmi_lockregion(DisplayRegion68k, 1600 * 1208 / 8); - - /* These are needed in the interrupt processing. Lock'em to prevent pagefaults. */ - _dpmi_lockregion(dsp, sizeof(*dsp)); - _dpmi_lockregion(dsp->bitblt_to_screen, 0x2000); - _dpmi_lockregion(dsp->mouse_invisible, 0x2000); - _dpmi_lockregion(dsp->mouse_visible, 0x2000); - _dpmi_lockregion((void *)&docopy, 0x2000); -} - -void VGA_exit(DspInterface dsp) -{ - /* Unlock the following to avoid waste of mainmem. */ - _dpmi_unlockregion(¤tdsp, sizeof(currentdsp)); - _dpmi_unlockregion(&DisplayRegion68k, sizeof(DisplayRegion68k)); - _dpmi_unlockregion(DisplayRegion68k, 1600 * 1208 / 8); - - /* These are needed in the interrupt processing. Lock'em to prevent pagefaults. */ - _dpmi_unlockregion(dsp, sizeof(*dsp)); - _dpmi_unlockregion(dsp->bitblt_to_screen, 0x2000); - _dpmi_unlockregion(dsp->mouse_invisible, 0x2000); - _dpmi_unlockregion(dsp->mouse_visible, 0x2000); - _dpmi_unlockregion((void *)&docopy, 0x2000); - - _setvideomode(_DEFAULTMODE); - _clearscreen(_GCLEARSCREEN); -} - -unsigned long VGA_not_color(DspInterface dsp) -{ - printf("Colormode not set!\n"); - fflush(stdout); - return (0); -} - -unsigned long VGA_colornum(DspInterface dsp) -{ /* Return the number of available colors */ - return (1 << dsp->bitsperpixel); -} - -unsigned long VGA_possiblecolors(DspInterface dsp) -{ return (dsp->colors); } - -void VGA_mono_drawline(DspInterface dsp, unsigned long startX, unsigned long startY, unsigned long width, unsigned long height, - int function, unsigned long color, unsigned long thickness, int butt, - unsigned long clipX, unsigned long clipY, unsigned long clipWidth, unsigned long clipHeight, - LispPTR *dashing) -{ - _moveto_w(startX, startY); - _lineto_w(width, height); -} - -void VGA_color_drawline(DspInterface dsp, unsigned long startX, unsigned long startY, unsigned long width, unsigned long height, - int function, unsigned long color, unsigned long thickness, int butt, - unsigned long clipX, unsigned long clipY, unsigned long clipWidth, unsigned long clipHeight, - LispPTR *dashing) - -{} - -void VGA_cleardisplay(DspInterface dsp) -{ _clearscreen(_GCLEARSCREEN); } - -VGA_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint) -{ - struct videoconfig vc; - - dsp->device.enter = (PFV)&VGA_setmax; - dsp->device.exit = (PFV)&VGA_exit; - - dsp->device.before_raid = (PFV)&VGA_exit; - dsp->device.after_raid = (PFV)&VGA_setmax; - - dsp->drawline = (PFV)&VGA_mono_drawline; - - dsp->cleardisplay = (PFV)&VGA_cleardisplay; - - dsp->get_color_map_entry = (PFUL)&VGA_not_color; - dsp->set_color_map_entry = (PFUL)&VGA_not_color; - dsp->available_colors = (PFUL)&VGA_not_color; - dsp->possible_colors = (PFUL)&VGA_not_color; - - dsp->medley_to_native_bm = (PFUL)&GenericPanic; - dsp->native_to_medley_bm = (PFUL)&GenericPanic; - - dsp->bitblt_to_screen = (PFUL)&Dosbbt1; - dsp->bitblt_from_screen = (PFUL)&GenericPanic; - dsp->scroll_region = (PFUL)&GenericPanic; - - dsp->DisplayStartAddr = 0xa0000; - dsp->DisplaySegSize = 0x10000; /* 64K segments */ - dsp->DisplaySegMagnitude = 0x10; /* How many bits in the addr. */ - dsp->BytesPerLine = 80; - dsp->LinesPerBank = 512; - - dsp->mouse_invisible = (PFV)&dostaking_mouse_down; - dsp->mouse_visible = (PFV)&dostaking_mouse_up; - - dsp->device.locked = FALSE; - dsp->device.active = FALSE; -}