1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-16 06:47:22 +00:00

Compare commits

..

31 Commits

Author SHA1 Message Date
Nick Briggs
85c4ebf0ac Merge branch 'master' of github.com:Interlisp/maiko 2021-09-03 16:47:02 -07:00
Nick Briggs
7284e19b32 Suppress clang-tidy warnings for uses of bzero()
The only uses of bzero() in the maiko sources come about because it is used in the macOS
definition of the FD_ZERO() macro in sys/select.h.  Suppress the warning by including
   -clang-analyzer-security.insecureAPI.bzero
in the clang-tidy list of checks.  This may well have been replaced by a memset()
call in more up-to-date macOS releases.
2021-09-03 16:39:29 -07:00
Nick Briggs
0de1b1438b Left shift is undefined if left argument is negative (#454) (#393) 2021-09-03 12:46:21 -07:00
Nick Briggs
740f012254 Eliminate URaid access to uninitialized pointer when saving post-crash VM image
Old code attempted to save the display region through an uninitialized pointer
which occurs nowhere else in the system.  Removed the save.
2021-09-02 15:14:32 -07:00
Nick Briggs
377a6f3f47 Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals (#392)
* Rewrite keyboard and async I/O handling to improve performance and reduce dependency on async I/O signals

Replaces the SIGIO handler, which used to process X events in the interrupt context, with
a stub routine that sets a flag to signal processing is required.
Actual event processing is moved to the main dispatch loop where Lisp periodic interrupts
are handled.

Removes the X connection file descriptor from the set of fds contributing to SIGIO events
and moves the processing of X events to where the Lisp periodic interrupt is handled in
the main dispatch loop.  This code is already guarded by a check for XPending() so can
be called regardless of whether any file descriptors are known to be ready.

Actual processing of async I/O events and X events are handled by procedures
process_io_events() and process_Xevents() respectively.  For the most part these are
a renaming of getsignaldata() and getXsignaldata().

The Lisp periodic timer (VTALRM) was set to operate with a 25000 us period (40 Hz),
but on modern hardware it is possible to run this timer with a period of 10000 us (100 Hz)

Incidentally, a bug was noted (and fixed) in the X event handling code for motion events:
Mouse motion without any keyboard activity should not add an entry to the keyboard event
ring buffer as these events do not represent a key state change.
Since the ring buffer is of limited size, when it is filled new events are ignored
until the buffered events are processed.  This resulted in the loss of a key/mouse button
transition (up or down) if the mouse was moved about "too much" between keyboard events.

A few incidental cleanups were also made:
  - KBDEventFlg initialization fixed (wrong semantic type)
  - Event_Req renamed to IO_Signalled (more appropriate name)
  - int_io_open() sets up process (self) to handle SIGIO generated by O_ASYNC operations
  - LOCK_X_EVENTS turned off since X library calls can no longer happen in an interrupt context

* Use of O_ASYNC must depend on the symbol being defined (looking at you, Cygwin)

* Add SA_RESTART flag to sigaction for SIGVTALRM periodic interrupt

* LOCK_X_UPDATE is no longer needed and should not be defined by default for Solaris in version.h
2021-09-02 12:42:51 -07:00
Nick Briggs
c07618f55c Do not attempt to use ether_fd as valid fd if it is -1. Closes medley #450 2021-09-02 10:35:10 -07:00
Nick Briggs
dbbb59b30b Add clang-tidy to CMakeLists.txt -- run it at compile time if it is found at cmake configuration time 2021-08-29 13:39:07 -07:00
Nick Briggs
e957e331c4 Lock X updates for all systems and lock around X cleanup at exit (#391)
* Lock X updates for all systems and lock around X cleanup at exit

All systems which could generate I/O interrupts on the X file descriptor need
to have locking enabled, or there is a high probability that the X library
will deadlock. This requirement may be removed in the future with restructuring
of the way that the interrupt driven I/O is handled.

Ensure that the appropriate XLOCK/XUNLOCK is done around the X window
closing code.

* Also lock X updates when building with CMake.
2021-08-26 16:29:10 -07:00
Nick Briggs
934a86fbb5 Remove Create_N_Set_Cell() which is unused since native code is not supported. 2021-08-24 12:05:17 -07:00
Nick Briggs
28ea238807 Check for flags in argv[1..n] not argv[0..n] 2021-08-23 21:15:23 -07:00
Nick Briggs
81c36341ef Fully initialize XImage ScreenBitmap with XInitImage() before using it. 2021-08-22 18:23:41 -07:00
Nick Briggs
6cad51735f Fix errors preventing the use of -DDTDDEBUG for mkcell.c (#389) 2021-08-11 11:37:15 -07:00
Nick Briggs
c33386ef44 Remove code for unsupported Sun display configurations (#388)
* Remove code for unsupported Sun display configurations

Initial cleanup removing all code that was #ifdef'd for SUNDISPLAY.
Other SunWindows dependent code may also be removeable

* prropstyle will never be defined with no SunWindows support and therefore no pixrect code

* Remove code that is ifndef NOPIXRECT, since pixrects are part of the obsolete Sun windows code.

There are still traces of pixrect dependent code that could be removed.
2021-08-10 16:31:59 -07:00
Nick Briggs
588e804a2f Merge branch 'master' of github.com:Interlisp/maiko 2021-08-09 13:15:04 -07:00
Nick Briggs
c56cbb2a91 Add missing include of <time.h> to initsout.c 2021-08-09 12:30:34 -07:00
Tim Hawes
ef31b3fe0b Additional Makefiles for FreeBSD amd64, Raspberry Pi (#387)
* Add makefiles for FreeBSD amd64 and aarch64

* Add appropriate comments in new makefiles

* Add makefile-init files for the new FreeBSD archs
2021-08-08 14:59:15 -07:00
Nick Briggs
ea8d31f590 Set up git workflow to build a maiko docker image with multi-architecture support
On pushes to master: builds images for x86_64, Apple M1, and ARMv7
architectures based on Ubuntu Focal release.  This builds only the
regular lde/ldex and does NOT build the ldeinit, so these are not
suitable for doing a loadup from scratch.

Commit based on https://github.com/stumbo/maiko/tree/gitHubBuild
2021-07-31 11:34:27 -07:00
Nick Briggs
093fb9a3d5 Merge branch 'master' of github.com:Interlisp/maiko 2021-07-30 18:30:05 -07:00
Nick Briggs
b53620852a Clean up makefile fragments for FreeBSD on 386
* Add LOCK_X_UPDATES
* Increase optimization level to -O2 and adjust -g option
* Add makefile-init-freebsd.386 in order to do loadups
2021-07-30 17:46:35 -07:00
Nick Briggs
13163c6772 Add build directory to .gitignore so typical cmake build doesn't generate git changes 2021-07-30 17:25:00 -07:00
Nick Briggs
9e179e66f2 Call getXsignaldata() with XLocked set
getXsignaldata() can call additional Xlib procedures which could generate an I/O
interrupt.  To avoid deadlocks in Xlib, ensure that XLocked is set when
getXsignaldata() is called.
2021-07-08 15:18:41 -07:00
Nick Briggs
084d69c6e8 Comment out build-pi in workflows because the RPi system is not online at this time. 2021-07-06 20:21:03 -07:00
Nick Briggs
40e18e6da0 Remove unnecessary XLOCK/XUNLOCK around calls to bitblt_to_screen/clipping_Xbitblt in getXsignaldata() 2021-07-06 20:15:35 -07:00
Nick Briggs
9ed46e6b69 Integer variables referenced from a signal handler (XLocked, XNeedSignal) should be type sig_atomic_t 2021-07-05 14:19:23 -07:00
Nick Briggs
934b15b63b Correct declaration mismatch for Event_Req between xc.c and other (correct) sites 2021-07-05 14:10:38 -07:00
Nick Briggs
2de44247b5 Include byteswapdefs.h for swapx() and byte_swap_code_block() 2021-07-05 14:03:02 -07:00
Nick Briggs
ef6a6554ac Remove SIGPOLL usage (#385)
* Remove unnecessary calls to XLOCK/XUNLOCK

The X methods called by flush_display_region() and flush_display_lineregion() handle the
locking/unlocking, therefore it is unnecessary to invoke the locking here.

* Remove explict signals when doing XUNLOCK()

Call getXsignaldata() directly if a signal happened while X code
was locked, instead of generating a signal and then handling it.

Some macros and functions needed to pass the DspInterface instead of
extracting the X display and window and passing those so that the
correct structure was available for the XUNLOCK() call.
2021-06-27 19:02:02 -07:00
Nick Briggs
1c47bf5df0 Fix the FastRetCALL macro to use do {} while (0) style (#384) 2021-06-17 13:21:00 -07:00
Nick Briggs
f42671022f Remove outdated hand-optimized assembler support for gcc on 386 (#379) 2021-05-29 17:32:32 -07:00
Nick Briggs
2122f095e8 Simplify OPFN/OPFNX macros by removing hand expansion of 1, 2, N bindings (#383)
The OPFN and OPFNX macros had been coded with a hand expansion of a loop
pushing values on the stack to separately handle the cases of 1, 2, and
more values.  This actually lead to larger, likely slower, and certainly
less obvious code.
2021-05-18 16:35:21 -07:00
Abe Jellinek
91fe7d51f9 Correct Medley GitHub link in README (#380) 2021-04-14 09:38:11 -07:00
101 changed files with 6945 additions and 2164 deletions

View File

@@ -21,14 +21,17 @@ jobs:
working-directory: bin
run: ./makeright x
build-pi:
runs-on: [self-hosted, linux, ARM]
if: ${{ github.repository == 'Interlisp/maiko' }}
steps:
- uses: actions/checkout@v2
- name: Build
working-directory: bin
run: ./makeright x
#
# Commented out because the RPi is not online at this time (6 July 2021)
#
# build-pi:
# runs-on: [self-hosted, linux, ARM]
# if: ${{ github.repository == 'Interlisp/maiko' }}
# steps:
# - uses: actions/checkout@v2
# - name: Build
# working-directory: bin
# run: ./makeright x
build-cmake:
runs-on: ${{ matrix.os }}

84
.github/workflows/buildDocker.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
# based on https://blog.oddbit.com/post/2020-09-25-building-multi-architecture-im/
---
# Interlisp workflow to build a Docker Image that supports multiple architectures
name: 'Build Maiko Docker image'
# Run this workflow on push to master
# Other branches can be added it needed.
on:
push:
branches:
- master
# Jobs that are run as part of this workflow.
jobs:
# Job to build the docker image
# see: https://github.com/docker/build-push-action
docker:
runs-on: ubuntu-latest
steps:
# Checkout the branch
- name: Checkout
uses: actions/checkout@v2
# Setup some environment variables
- name: Prepare
id: prep
run: |
# Name of the Docker Image.
DOCKER_IMAGE=interlisp/${GITHUB_REPOSITORY#*/}
VERSION=latest
SHORTREF=${GITHUB_SHA::8}
## Do we want to use tags and or versions
# If this is git tag, use the tag name as a docker tag
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
# If the VERSION looks like a version number, assume that
# this is the most recent version of the image and also
# tag it 'latest'.
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
# Set output parameters.
echo ::set-output name=tags::${TAGS}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# Setup the Docker Machine Emulation environment.
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
# Setup the Docker Buildx funtion
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# Login into DockerHub - required to store the created image
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Start the Docker Build using the Dockerfile in the repository we
# checked out.
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
build-args: BUILD_DATE=${{ steps.prep.outputs.build_time }}
context: .
file: ./Dockerfile
# Platforms - Sepecify the platforms to include in the build
# linux/amd64 -- Standard x86_64
# linux/arm64 -- Apple M1
# linux/arm/v7 -- Raspberry pi
platforms: linux/amd64,linux/arm64,linux/arm/v7
# Push the result to DockerHub
push: true
# tags to assign to the Docker image
tags: ${{ steps.prep.outputs.tags }}

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@
\#*#
.DS_Store
# build directories
build/**
*.386-x/**
*.386/**
*.ppc-x/**

View File

@@ -16,6 +16,19 @@ IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
ENDIF()
find_program(
CLANG_TIDY_EXE
NAMES "clang-tidy" "clang-tidy12" "clang-tidy11" "clang-tidy10"
DOC "Path to clang-tidy executable"
)
IF (CLANG_TIDY_EXE)
# There are many many warnings for strcpy instances to deal with,
# but suppress it for now so that other issues are more obvious
#
SET(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXE} -checks=-*,cert-*,clang-analyzer-security.*,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-security.insecureAPI.bzero -header-filter=.*)
ENDIF()
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m fmod "" NEED_LIB_M)
IF(NEED_LIB_M)
@@ -79,9 +92,13 @@ 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
@@ -98,6 +115,8 @@ SET(BAD_SRCS
src/rawrs232c.c
src/rs232c.c
src/truecolor.c
src/vesainit.c
src/vgainit.c
)
SET(MAIKO_SRCS
@@ -169,6 +188,7 @@ SET(MAIKO_SRCS
src/miscn.c
src/mkatom.c
src/mkcell.c
src/mouseif.c
src/mvs.c
src/osmsg.c
src/perrno.c
@@ -273,10 +293,12 @@ 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
@@ -288,6 +310,7 @@ SET(MAIKO_HDRS
inc/lisp2cdefs.h
inc/lispemul.h
inc/lispmap.h
inc/lispver1.h
inc/lispver2.h
inc/llcolordefs.h
inc/lldsp.h

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM ubuntu:focal
ARG BUILD_DATE
LABEL name="Maiko"
LABEL description="Virtual machine for Interlisp Medley"
LABEL url="https://github.com/Interlisp/maiko"
LABEL build-time=$BUILD_DATE
ARG TARGETPLATFORM
RUN apt-get update && apt-get install -y make clang libx11-dev gcc x11vnc xvfb
COPY --chown=nonroot:nonroot . /app/maiko
RUN rm -rf /app/maiko/linux*
WORKDIR /app/maiko/bin
RUN ./makeright x
RUN rm -rf /app/maiko/inc /app/maiko/include /app/maiko/src

View File

@@ -6,7 +6,7 @@ connecting with Lisp for access to display (via X11) and disk etc.
For an overview, see [Medley Interlisp Introduction](https://github.com/Interlisp/medley/wiki/Medley-Interlisp-Introduction).
See [the Medley repository](https://github.org/Interlisp/medley) for
See [the Medley repository](https://github.com/Interlisp/medley) for
* [Issues](https://github.com/Interlisp/medley/issues) (note that maiko issues are there too)
* [Discussions](https://github.com/Interlisp/medley/discussions) (Q&A, announcements, etc)
* [Medley's README](https://github.com/Interlisp/medley/blob/master/README.md)

View File

@@ -128,5 +128,4 @@ bitbltsub.c:#ifdef GETBASE
testdisplay.c:#ifdef NOTUSED
uraid.c:#ifdef ETHERINT
bitblt.c:#ifndef COLOR
bitbltsub.c:#ifndef prropstyle
lispmap.h:#ifdef MEDLEY

View File

@@ -19,7 +19,7 @@ XFLAGS = -I/opt/X11/include -DXWINDOW
OPTFLAGS = -O2 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) \
-DRELEASE=351 -DSTACKCHECK -DFSBCHECK -DPCTRACE
-DRELEASE=351 # -DSTACKCHECK -DFSBCHECK -DPCTRACE
LDFLAGS = -L/opt/X11/lib -lX11 -lm
LDELDFLAGS = -L/opt/X11/lib -lX11 -lm

614
bin/makefile-dos Normal file
View File

@@ -0,0 +1,614 @@
AFLAGS = /T
ARCHFILES = dosmouse.obj doskbd.obj vesafns.obj vesainit.obj vgainit.obj kbdif.obj
ADMINFILES = makefile mkvdate.c
LPFILES = lpmain.obj lpread.obj lpsolve.obj lpwrite.obj lpdual.obj lptran.obj
CFLAGS = -DDOS -DKBINT -DNOPIXRECT \
-DNOVERSION -DLPSOLVE -g
LDFLAGS = -g graphics.lib binmode.lib mouse.lib
RM = del
SRCFILES = conspage.c gcoflow.c shift.c dbgtool.c gcr.c gcrcell.c llstk.c gcscan.c loopsops.c storage.c allocmds.c dir.c gvar2.c lowlev1.c subr.c arith2.c lowlev2.c subr0374.c arith3.c doscomm.c hardrtn.c lsthandl.c sxhash.c arith4.c draw.c main.c testtool.c array.c dsk.c inet.c misc7.c timer.c array2.c dspif.c initdsp.c miscn.c typeof.c array3.c initkbd.c ubf1.c array4.c dspsubrs.c initsout.c mkatom.c ubf2.c array5.c eqf.c intcall.c mkcell.c ubf3.c array6.c ether.c mkvdate.c ufn.c atom.c findkey.c kbdsubrs.c mouseif.c ufs.c bbtsub.c foreign.c keyevent.c unixcomm.c bin.c fp.c binds.c asmbbt.c fvar.c mvs.c unwind.c bitblt.c gc.c uraid.c blt.c gc2.c kprint.c osmsg.c usrsubr.c byteswap.c gcarray.c perrno.c ldeboot.c ldeether.c uutils.c carcdr.c gccode.c rawcolor.c vars3.c gcfinal.c ldsout.c return.c vmemsave.c chardev.c gchtfind.c lineblt8.c rpc.c xc.c common.c gcmain3.c lisp2c.c rplcons.c z2.c xmkicon.c xbbt.c xinit.c xscroll.c xcursor.c xlspwin.c xrdopt.c xwinman.c dosmouse.c vesafns.asm vesainit.c vgainit.c kbdif.c dspsparc.il copyright launch.asm lpread.c lpsolve.c lpmain.c lpwrite.c lpdual.c lptran.c
OFILES = conspage.obj gcoflow.obj shift.obj dbgtool.obj gcr.obj gcrcell.obj llstk.obj gcscan.obj loopsops.obj storage.obj allocmds.obj dir.obj gvar2.obj lowlev1.obj subr.obj arith2.obj lowlev2.obj subr0374.obj arith3.obj doscomm.obj hardrtn.obj lsthandl.obj sxhash.obj arith4.obj draw.obj main.obj testtool.obj array.obj dsk.obj inet.obj misc7.obj timer.obj array2.obj dspif.obj initdsp.obj miscn.obj typeof.obj array3.obj initkbd.obj ubf1.obj array4.obj dspsubrs.obj initsout.obj mkatom.obj ubf2.obj array5.obj eqf.obj intcall.obj mkcell.obj ubf3.obj array6.obj ether.obj ufn.obj atom.obj findkey.obj kbdsubrs.obj mouseif.obj ufs.obj bbtsub.obj foreign.obj keyevent.obj unixcomm.obj bin.obj fp.obj binds.obj fvar.obj mvs.obj unwind.obj bitblt.obj gc.obj uraid.obj blt.obj gc2.obj kprint.obj osmsg.obj usrsubr.obj byteswap.obj gcarray.obj perrno.obj uutils.obj carcdr.obj asmbbt.obj gccode.obj vars3.obj gcfinal.obj ldsout.obj return.obj vmemsave.obj chardev.obj gchtfind.obj lineblt8.obj rpc.obj xc.obj common.obj gcmain3.obj lisp2c.obj rplcons.obj z2.obj vdate.obj $(COLORFILES) $(ARCHFILES) $(LPFILES)
HFILES = address.h adr68k.h arith.h cell.h dbprint.h display.h dspif.h ifpage.h iopage.h lispemul.h lispmap.h lsptypes.h miscstat.h lspglob.h array.h bb.h bitblt.h debug.h devconf.h dspdata.h ether.h fast_dsp.h gcdata.h hdw_conf.h initatms.h inlinec.h keyboard.h lispver1.h lispver2.h lldsp.h locfile.h medleyfp.h mouseif.h my.h opcodes.h osmsg.h pilotbbt.h print.h return.h stack.h stream.h subrs.h timeout.h tos1defs.h tosfns.h tosret.h vmemsave.h xdefs.h xbitmaps.h xkeymap.h
bigvm:
CFLAGS = $(CFLAGS)
make -f foot emul.exe
emul.exe : $(OFILES)
@ echo $** > linkopts
@ echo $(CFLAGS) > copts
$(RM) vdate.c
$(CC) @copts @linkopts $(LDFLAGS) /e$@
del linkopts
del copts
@ echo "Executable is now named '$@'"
main.o : lispemul.h address.h lsptypes.h adr68k.h stack.h lspglob.h lispmap.h ifpage.h iopage.h return.h debug.h
.SUFFIXES .exe .lib .c .obj .c .asm .s .c
medley.exe: launch.obj
TLINK launch,medley
launch.obj: launch.asm
# xc.obj: xc.s
# tasm /ml xc.s
#
#xc.s: xc.c
# rsh sparky (cd /users/nilsson/curr ; gcc-make $* )
vdate.obj : mkvdate.exe
mkvdate > vdate.c
$(CC) vdate.c -c $@
mkvdate.exe : ../src/mkvdate.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkvdate.c
del copts
xc.obj : ../src/xc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/xc.c -I ../inc -c $@
del copts
lpmain.obj : ../src/lpmain.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpmain.c -I ../inc -c $@
del copts
lpsolve.obj : ../src/lpsolve.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpsolve.c -I ../inc -c $@
del copts
lpread.obj : ../src/lpread.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpread.c -I ../inc -c $@
del copts
lptran.obj : ../src/lptran.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lptran.c -I ../inc -c $@
del copts
lpdual.obj : ../src/lpdual.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpdual.c -I ../inc -c $@
del copts
lpwrite.obj : ../src/lpwrite.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lpwrite.c -I ../inc -c $@
del copts
conspage.obj : ../src/conspage.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/conspage.c -I ../inc -c $@
del copts
dosmouse.obj : ../src/dosmouse.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dosmouse.c -I ../inc -c $@
del copts
doskbd.obj : ../src/doskbd.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/doskbd.c -I ../inc -c $@
del copts
vesafns.obj : ../src/vesafns.asm
tasm /ml ..\src\vesafns.asm
vesainit.obj : ../src/vesainit.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vesainit.c -I ../inc -c $@
del copts
vgainit.obj : ../src/vgainit.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vgainit.c -I ../inc -c $@
del copts
kbdif.obj : ../src/kbdif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kbdif.c -I ../inc -c $@
del copts
gcoflow.obj : ../src/gcoflow.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcoflow.c -I ../inc -c $@
del copts
shift.obj : ../src/shift.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/shift.c -I ../inc -c $@
del copts
dbgtool.obj : ../src/dbgtool.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dbgtool.c -I ../inc -c $@
del copts
gcr.obj : ../src/gcr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcr.c -I ../inc -c $@
del copts
gcrcell.obj : ../src/gcrcell.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcrcell.c -I ../inc -c $@
del copts
llstk.obj : ../src/llstk.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/llstk.c -I ../inc -c $@
del copts
gcscan.obj : ../src/gcscan.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcscan.c -I ../inc -c $@
del copts
loopsops.obj : ../src/loopsops.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/loopsops.c -I ../inc -c $@
del copts
storage.obj : ../src/storage.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/storage.c -I ../inc -c $@
del copts
allocmds.obj : ../src/allocmds.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/allocmds.c -I ../inc -c $@
del copts
dir.obj : ../src/dir.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dir.c -I ../inc -c $@
del copts
gvar2.obj : ../src/gvar2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gvar2.c -I ../inc -c $@
del copts
lowlev1.obj : ../src/lowlev1.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lowlev1.c -I ../inc -c $@
del copts
subr.obj : ../src/subr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/subr.c -I ../inc -c $@
del copts
arith2.obj : ../src/arith2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith2.c -I ../inc -c $@
del copts
lowlev2.obj : ../src/lowlev2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lowlev2.c -I ../inc -c $@
del copts
subr0374.obj : ../src/subr0374.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/subr0374.c -I ../inc -c $@
del copts
arith3.obj : ../src/arith3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith3.c -I ../inc -c $@
del copts
doscomm.obj : ../src/doscomm.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/doscomm.c -I ../inc -c $@
del copts
hardrtn.obj : ../src/hardrtn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/hardrtn.c -I ../inc -c $@
del copts
lsthandl.obj : ../src/lsthandl.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lsthandl.c -I ../inc -c $@ -Le
del copts
sxhash.obj : ../src/sxhash.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/sxhash.c -I ../inc -c $@
del copts
arith4.obj : ../src/arith4.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/arith4.c -I ../inc -c $@
del copts
draw.obj : ../src/draw.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/draw.c -I ../inc -c $@
del copts
main.obj : ../src/main.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/main.c -I ../inc -c $@
del copts
testtool.obj : ../src/testtool.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/testtool.c -I ../inc -c $@
del copts
array.obj : ../src/array.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array.c -I ../inc -c $@
del copts
dsk.obj : ../src/dsk.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dsk.c -I ../inc -c $@
del copts
inet.obj : ../src/inet.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/inet.c -I ../inc -c $@
del copts
misc7.obj : ../src/misc7.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/misc7.c -I ../inc -c $@
del copts
timer.obj : ../src/timer.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/timer.c -I ../inc -c $@
del copts
array2.obj : ../src/array2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array2.c -I ../inc -c $@
del copts
dspif.obj : ../src/dspif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dspif.c -I ../inc -c $@
del copts
initdsp.obj : ../src/initdsp.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initdsp.c -I ../inc -c $@
del copts
miscn.obj : ../src/miscn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/miscn.c -I ../inc -c $@
del copts
typeof.obj : ../src/typeof.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/typeof.c -I ../inc -c $@
del copts
array3.obj : ../src/array3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array3.c -I ../inc -c $@
del copts
initkbd.obj : ../src/initkbd.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initkbd.c -I ../inc -c $@
del copts
ubf1.obj : ../src/ubf1.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf1.c -I ../inc -c $@
del copts
array4.obj : ../src/array4.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array4.c -I ../inc -c $@
del copts
dspsubrs.obj : ../src/dspsubrs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/dspsubrs.c -I ../inc -c $@
del copts
initsout.obj : ../src/initsout.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/initsout.c -I ../inc -c $@
del copts
mkatom.obj : ../src/mkatom.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkatom.c -I ../inc -c $@
del copts
ubf2.obj : ../src/ubf2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf2.c -I ../inc -c $@
del copts
array5.obj : ../src/array5.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array5.c -I ../inc -c $@
del copts
eqf.obj : ../src/eqf.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/eqf.c -I ../inc -c $@
del copts
intcall.obj : ../src/intcall.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/intcall.c -I ../inc -c $@
del copts
mkcell.obj : ../src/mkcell.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mkcell.c -I ../inc -c $@
del copts
ubf3.obj : ../src/ubf3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ubf3.c -I ../inc -c $@
del copts
array6.obj : ../src/array6.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/array6.c -I ../inc -c $@
del copts
ether.obj : ../src/ether.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ether.c -I ../inc -c $@
del copts
ufn.obj : ../src/ufn.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ufn.c -I ../inc -c $@
del copts
atom.obj : ../src/atom.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/atom.c -I ../inc -c $@
del copts
findkey.obj : ../src/findkey.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/findkey.c -I ../inc -c $@
del copts
kbdsubrs.obj : ../src/kbdsubrs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kbdsubrs.c -I ../inc -c $@
del copts
mouseif.obj : ../src/mouseif.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mouseif.c -I ../inc -c $@
del copts
ufs.obj : ../src/ufs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ufs.c -I ../inc -c $@
del copts
bbtsub.obj : ../src/bbtsub.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bbtsub.c -I ../inc -c $@
del copts
foreign.obj : ../src/foreign.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/foreign.c -I ../inc -c $@
del copts
keyevent.obj : ../src/keyevent.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/keyevent.c -I ../inc -c $@
del copts
unixcomm.obj : ../src/unixcomm.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/unixcomm.c -I ../inc -c $@
del copts
bin.obj : ../src/bin.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bin.c -I ../inc -c $@
del copts
fp.obj : ../src/fp.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/fp.c -I ../inc -c $@
del copts
binds.obj : ../src/binds.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/binds.c -I ../inc -c $@
del copts
fvar.obj : ../src/fvar.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/fvar.c -I ../inc -c $@
del copts
mvs.obj : ../src/mvs.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/mvs.c -I ../inc -c $@
del copts
unwind.obj : ../src/unwind.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/unwind.c -I ../inc -c $@
del copts
bitblt.obj : ../src/bitblt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/bitblt.c -I ../inc -c $@
del copts
gc.obj : ../src/gc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gc.c -I ../inc -c $@
del copts
uraid.obj : ../src/uraid.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/uraid.c -I ../inc -c $@
del copts
blt.obj : ../src/blt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/blt.c -I ../inc -c $@
del copts
gc2.obj : ../src/gc2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gc2.c -I ../inc -c $@
del copts
kprint.obj : ../src/kprint.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/kprint.c -I ../inc -c $@
del copts
osmsg.obj : ../src/osmsg.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/osmsg.c -I ../inc -c $@
del copts
usrsubr.obj : ../src/usrsubr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/usrsubr.c -I ../inc -c $@
del copts
byteswap.obj : ../src/byteswap.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/byteswap.c -I ../inc -c $@
del copts
gcarray.obj : ../src/gcarray.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcarray.c -I ../inc -c $@
del copts
perrno.obj : ../src/perrno.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/perrno.c -I ../inc -c $@
del copts
uutils.obj : ../src/uutils.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/uutils.c -I ../inc -c $@
del copts
carcdr.obj : ../src/carcdr.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/carcdr.c -I ../inc -c $@
del copts
asmbbt.obj : ../src/asmbbt.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/asmbbt.c -I ../inc -c $@
del copts
gccode.obj : ../src/gccode.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gccode.c -I ../inc -c $@
del copts
vars3.obj : ../src/vars3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vars3.c -I ../inc -c $@
del copts
gcfinal.obj : ../src/gcfinal.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcfinal.c -I ../inc -c $@
del copts
ldsout.obj : ../src/ldsout.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/ldsout.c -I ../inc -c $@
del copts
return.obj : ../src/return.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/return.c -I ../inc -c $@
del copts
vmemsave.obj : ../src/vmemsave.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/vmemsave.c -I ../inc -c $@
del copts
chardev.obj : ../src/chardev.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/chardev.c -I ../inc -c $@
del copts
gchtfind.obj : ../src/gchtfind.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gchtfind.c -I ../inc -c $@
del copts
lineblt8.obj : ../src/lineblt8.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lineblt8.c -I ../inc -c $@
del copts
rpc.obj : ../src/rpc.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/rpc.c -I ../inc -c $@
del copts
common.obj : ../src/common.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/common.c -I ../inc -c $@
del copts
gcmain3.obj : ../src/gcmain3.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/gcmain3.c -I ../inc -c $@
del copts
lisp2c.obj : ../src/lisp2c.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/lisp2c.c -I ../inc -c $@
del copts
rplcons.obj : ../src/rplcons.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/rplcons.c -I ../inc -c $@
del copts
z2.obj : ../src/z2.c
@ echo $(CFLAGS) > copts
$(CC) @copts ../src/z2.c -I ../inc -c $@
del copts

View File

@@ -16,7 +16,7 @@ XFILES = $(OBJECTDIR)xmkicon.o \
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O1 -gdwarf-2
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, ARMv7 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel x86_64 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel 386/486 and X Windows
CC = clang -m32 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, ARMv7 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -0,0 +1,27 @@
# Options for FreeBSD, Intel x86_64 and X-Windows
CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/local/include -DXWINDOW
# OPTFLAGS is normally -O0 for init
OPTFLAGS = -O0 -g
DFLAGS = $(XFLAGS) -DRELEASE=351 -DNOVERSION -DINIT
LDFLAGS = -L/usr/local/lib -lX11 -lc -lm
LDELDFLAGS = -L/usr/local/lib -lX11 -lc -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/ldeinit

View File

@@ -41,7 +41,7 @@ OPTFLAGS = -g3 -O0
DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
MACHINEFLAGS = -DOS5 -DUSE_DLPI -DLOCK_X_UPDATES
MACHINEFLAGS = -DOS5 -DUSE_DLPI
# The LDEINIT wants to have NOVERSION set, so we don't hang up on
# any change-over in versions.

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 \
-DLOCK_X_UPDATES \
-DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lsocket -lnsl

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 -DUSE_DLPI \
-DLOCK_X_UPDATES \
-I$(OPENWINHOME)/include \
-DRELEASE=210

View File

@@ -40,7 +40,7 @@ OPTFLAGS = -O2 -g3
DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
MACHINEFLAGS = -DOS5 -DUSE_DLPI -DLOCK_X_UPDATES
MACHINEFLAGS = -DOS5 -DUSE_DLPI
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \

View File

@@ -36,7 +36,6 @@ DEBUGFLAGS = # -DSTACKCHECK -DFNSTKCHECK
DFLAGS = $(XFLAGS) \
$(DEBUGFLAGS) \
-DOS5 \
-DLOCK_X_UPDATES \
-DUSE_DLPI \
-DRELEASE=351

View File

@@ -485,6 +485,14 @@ $(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 \

View File

@@ -77,7 +77,7 @@ typedef struct
, White_Pixel ); \
XLOCK; \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
(child_win)->parent = parent_win; \
if( (child_win)->after_create ) \
((child_win)->after_create)(parent_win,child_win);\
@@ -96,7 +96,7 @@ typedef struct
, (window)->width \
, (window)->height ); \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
if( (window)->after_resize ) \
((window)->after_resize)( window ); \
} \
@@ -106,7 +106,7 @@ typedef struct
XLOCK; \
XDefineCursor( display, (window)->win, *(mycursor) ); \
XFlush( display ); \
XUNLOCK; \
XUNLOCK( display ); \
(window)->cursor = mycursor; \
}

View File

@@ -1,36 +1,19 @@
#ifndef BBTSUBDEFS_H
#define BBTSUBDEFS_H 1
/***** Don't use PixRect code on 386i for now *****/
/***** -or on any machine that doesn't support it (HP, e.g.) *****/
/********************************************************/
/* */
/* prropstyle is DEFINED when we want to use */
/* pixrect versions of the operations in this */
/* file, and UNDEFINED, when we want to use */
/* Don Charnley's bitblt code to do them. */
/* Don Charnley's bitblt code */
/* */
/********************************************************/
#include "lispemul.h" /* for LispPTR, DLword */
#if defined(SUNDISPLAY) && \
!defined(NOPIXRECT) && \
!defined(NEWBITBLT)
#define prropstyle 1
#endif
void bitbltsub(LispPTR *argv);
LispPTR n_new_cursorin(DLword *baseaddr, int dx, int dy, int w, int h);
LispPTR bitblt_bitmap(LispPTR *args);
LispPTR bitshade_bitmap(LispPTR *args);
#ifndef prropstyle
void bltchar(LispPTR *args);
void newbltchar(LispPTR *args);
#else
LispPTR bltchar(LispPTR *args);
LispPTR newbltchar(LispPTR *args);
#endif
void ccfuncall(unsigned int atom_index, int argnum, int bytenum);
void tedit_bltchar(LispPTR *args);

View File

@@ -49,13 +49,11 @@ extern int DisplayRasterWidth;
#define MOUSEYH ((int)*EmMouseY68K + YDELTA)
#if defined(SUNDISPLAY) && defined(OLD_CURSOR)
extern struct winlock DisplayLockArea;
#define HideCursor \
ioctl( LispWindowFd, WINLOCKSCREEN, &DisplayLockArea)
#ifdef DOS
#define HideCursor { (currentdsp->mouse_invisible)(currentdsp, IOPage68K); }
#define ShowCursor { (currentdsp->mouse_visible)(IOPage68K->dlmousex, \
IOPage68K->dlmousey); }
#define ShowCursor \
ioctl( LispWindowFd, WINUNLOCKSCREEN, &DisplayLockArea)
#else
extern DLword *EmCursorX68K,*EmCursorY68K;
#define HideCursor { taking_mouse_down();}
@@ -77,7 +75,14 @@ extern DLword *EmCursorX68K,*EmCursorY68K;
/* Macro for locking and unlocking screen to prevent multiple updates */
#ifdef DOS
#define LOCKSCREEN currentdsp->device.locked++;
#define UNLOCKSCREEN currentdsp->device.locked--;
#else
#define LOCKSCREEN ScreenLocked = T;
#define UNLOCKSCREEN ScreenLocked = NIL;
#endif /* DOS */
#endif /* BITBLT_H */

View File

@@ -154,6 +154,19 @@ typedef struct
{
DevRec device;
PFV device_event; /* Event handler for the keyboard. */
#ifdef DOS
u_char KeyMap[0x80]; /* The key translation table. Use the keycode you
get from the keyboard as an index. The value
gives the lispkeycode.*/
unsigned char lastbyte; /* Last byte that we got from the keyboard. */
unsigned int keyeventsize; /* The sizeof() one kbd event */
unsigned int maxkeyevent; /* Offset to the end of the ringbuffer. */
int eurokbd; /* Keep tabs of the euro-ness of the kbd */
PFV prev_handler; /* The previous keyboard handler.
Keep this around
to restore when we exit Medley */
int URaid; /* Put this in a better place later.. /jarl */
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
@@ -208,7 +221,20 @@ typedef struct
unsigned long oldstate; /* Keep the old state around */
unsigned long graphicsmode; /* Magic cookie used to set the state. */
unsigned long numberofbanks;
#if XWINDOW
#ifdef DOS
unsigned long BytesPerLine;
unsigned long DisplayStartAddr;
unsigned long DisplaySegSize;
unsigned long DisplaySegMagnitude;
unsigned long LinesPerBank;
unsigned short LastLineLen[32]; /* length of last line fragment per bank */
unsigned short LinesInBank[32]; /* True # of full lines in this bank */
/* # of lines we can do with the full-line dumpline */
/* for sure. */
unsigned short LinesBeforeBank[32]; /* Scan lines before start of this bank. */
void (* SwitchBank)(); /* Method to switch the bank (see vesa standard) */
#elif XWINDOW
char *identifier;
int BitGravity;
Display *display_id;
@@ -238,11 +264,12 @@ typedef struct
#ifdef XWINDOW
#define DefineCursor(display, window, mycursor) { \
XLOCK;\
XDefineCursor( display, window, *(mycursor) );\
XUNLOCK;\
}
#define DefineCursor(dsp, window, mycursor) \
do { \
XLOCK; \
XDefineCursor((dsp)->display_id, window, *(mycursor) ); \
XUNLOCK(dsp); \
} while (0)
#endif /* XWINDOW */
#define OUTER_SB_WIDTH(dsp) ((dsp)->ScrollBarWidth + 2*((dsp)->InternalBorderWidth))

View File

@@ -1,6 +1,9 @@
#ifndef DIRDEFS_H
#define DIRDEFS_H 1
#include "lispemul.h" /* for LispPTR */
#ifdef DOS
int make_old_version(char *old, char *file);
#endif
#ifdef FSDEBUG
void print_finfo(FINFO *fp);
#endif

View File

@@ -44,6 +44,10 @@ extern DLword *DISP_MAX_Address;
#define DISPLAYBUFFER
#endif /* XWINDOW */
#ifdef DOS
#define DISPLAYBUFFER
#endif /* DOS */
#ifdef DISPLAYBUFFER
/************************************************************************/
/* */

View File

@@ -1,7 +1,11 @@
#ifndef DSKDEFS_H
#define DSKDEFS_H 1
#include "lispemul.h" /* for LispPTR */
#ifdef DOS
void separate_host(char *lfname, char *host, char *drive);
#else
void separate_host(char *lfname, char *host);
#endif
LispPTR COM_openfile(register LispPTR *args);
LispPTR COM_closefile(register LispPTR *args);
LispPTR DSK_getfilename(register LispPTR *args);

703
inc/inlndos.h Executable file
View File

@@ -0,0 +1,703 @@
/* $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; }

34
inc/kbdif.h Normal file
View File

@@ -0,0 +1,34 @@
#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 <sys/types.h> /* for u_char */
/* The Keyboard structure. */
typedef struct {
u_char KeyMap[0x80];
#ifdef DOS
u_char lastbyte;
void (*prev_handler)();
#endif /* DOS */
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;
#ifdef DOS
int device_active;
int device_locked;
#endif /* DOS */
} KbdInterfaceRec, *KbdInterface;
#endif /* KBDIF_H */

View File

@@ -1,7 +1,7 @@
#ifndef KEYEVENTDEFS_H
#define KEYEVENTDEFS_H 1
#include <sys/types.h>
void getsignaldata(int sig);
void process_io_events();
void kb_trans(u_short keycode, u_short upflg);
void taking_mouse_down(void);
void copy_cursor(int newx, int newy);

View File

@@ -13,23 +13,24 @@
/************************************************************************/
#ifdef LOCK_X_UPDATES
#define XLOCK { XLocked++; /* printf("L"); fflush(stdout);*/}
#define XUNLOCK \
{ XLocked--;/* printf("U"); fflush(stdout);*/ \
if (XNeedSignal) \
#define XLOCK do { XLocked++; } while (0)
#define XUNLOCK(dsp) \
do { \
if (XLocked == 1 && XNeedSignal) \
{ \
XNeedSignal = 0; \
kill(getpid(), SIGPOLL); \
}; \
}
getXsignaldata(dsp); \
}; \
XLocked--; \
} while (0)
#else
#define XLOCK
#define XUNLOCK
#endif /* LOCK_X_UPDATES */
extern int XLocked;
extern int XNeedSignal;
/* this is !0 if we're locked; it should be 0 or larger always */
#include <signal.h>
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
#endif

47
inc/lispver1.h Normal file
View File

@@ -0,0 +1,47 @@
#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 */

View File

@@ -312,8 +312,16 @@ extern DLword *Lisp_world; /* To access LispSysout area */
* They might be lost in the course of the conversion.
*
*/
#ifdef DOS
/* DOS version of LispVersionToUnixVersion */
/* * * * * This is done this way because DOS can't handle the non-DOS version -- */
/* * * * * it gave "Too many characters in a character constant" errors! */
#include "lispver1.h"
#else /* DOS */
/* NON-DOS version of the macro LispVersionToUnixVersion */
#include "lispver2.h"
#endif /* DOS */
/*
@@ -493,9 +501,13 @@ extern DLword *Lisp_world; /* To access LispSysout area */
(((varray)->version_no == LASTVERSIONARRAY)? 1 : 0)
#define OnlyVersionlessP(varray) \
#ifdef DOS
#define OnlyVersionlessP(varray) 0
#else
#define OnlyVersionlessP(varray) \
(((varray)->version_no == 0 && ((varray) + 1)->version_no == LASTVERSIONARRAY) ? \
1 : 0)
#endif /* DOS */
/* An argument of AddDotNoExtension must be LispVersion convention */
/* Like "foo/fee.fee;3" or "/foo/foo;3" */
@@ -610,6 +622,13 @@ extern int errno;
/* DRIVESEP = OS-specific drive separator character. */
/* (only used with DOS as of 3/93) */
/********************************************************/
#ifdef DOS
#define DIRSEP '\\'
#define DIRSEPSTR "\\"
#define DRIVESEP ':'
#define UNIXDIRSEP '/'
#define MAXNAMLEN _MAX_PATH
#else
#define DIRSEPSTR "/"
#define DIRSEP '/'
#define UNIXDIRSEP '/'
@@ -617,5 +636,6 @@ extern int errno;
#if !defined(MAXNAMLEN)
#define MAXNAMLEN NAME_MAX
#endif
#endif
#endif /* LOCFILE_H */

View File

@@ -39,6 +39,11 @@ extern volatile sig_atomic_t FP_error;
#define FPCLEAR FP_error = 0;
#define FPTEST(result) FP_error
#elif defined(DOS)
#include <i32.h>
#define FPCLEAR
#define FPTEST(result) (_getrealerror() & ( I87_ZERO_DIVIDE | I87_OVERFLOW | I87_UNDERFLOW))
#else
#include <math.h>
#define FPCLEAR

View File

@@ -3,5 +3,4 @@
#include "lispemul.h" /* for LispPTR, DLword */
LispPTR N_OP_createcell(register LispPTR tos);
DLword *createcell68k(unsigned int type);
LispPTR Create_n_Set_Cell(unsigned int type, LispPTR value);
#endif

View File

@@ -35,7 +35,7 @@
/* FAST case return use */
#ifndef RESWAPPEDCODESTREAM
#define FastRetCALL \
{ \
do { \
/* Get IVar from Returnee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Returnee's FNHEAD slot in FX */ \
@@ -43,10 +43,10 @@
Addr68k_from_LADDR(FX_FNHEADER); \
/* Get PC from Returnee's pc slot in FX */ \
PC = (ByteCode *)FuncObj + CURRENTFX->pc ; \
}
} while (0)
#else
#define FastRetCALL \
{ \
do { \
/* Get IVar from Returnee's IVAR offset slot(BF) */ \
IVar = Addr68k_from_LADDR(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \
/* Get FuncObj from Returnee's FNHEAD slot in FX */ \
@@ -59,7 +59,7 @@
byte_swap_code_block(FuncObj); \
FuncObj->byteswapped = 1; \
} \
}
} while (0)
#endif /* RESWAPPEDCODESTREAM */

View File

@@ -33,6 +33,7 @@ LispPTR *MakeAtom68k(char *string);
void GETTOPVAL(char *string);
void all_stack_dump(DLword start, DLword end, DLword silent);
void dtd_chain(DLword type);
void check_dtd_chain(DLword type);
void Trace_FNCall(int numargs, int atomindex, int arg1, LispPTR *tos);
void Trace_APPLY(int atomindex);
#endif

View File

@@ -223,22 +223,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
@@ -291,22 +279,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \

View File

@@ -5,7 +5,11 @@ LispPTR UFS_getfilename(LispPTR *args);
LispPTR UFS_deletefile(LispPTR *args);
LispPTR UFS_renamefile(LispPTR *args);
LispPTR UFS_directorynamep(LispPTR *args);
#ifdef DOS
int unixpathname(char *src, char *dst, int versionp, int genp, char *drive, int *extlenptr, char *rawname);
#else
int unixpathname(char *src, char *dst, int versionp, int genp);
#endif
int lisppathname(char *fullname, char *lispname, int dirp, int versionp);
int quote_fname(char *file);
int quote_fname_ufs(char *file);

View File

@@ -223,7 +223,6 @@ error Must specify RELEASE to build Medley.
#ifdef OS5
/* Solaris, sort of SYSV-ish, but not really */
#define MAIKO_ENABLE_ETHERNET
#define LOCK_X_UPDATES 1
#endif /* OS5 */
@@ -233,7 +232,15 @@ error Must specify RELEASE to build Medley.
/* */
/********************************************************/
#ifdef DOS
typedef unsigned char u_char;
typedef unsigned long u_int;
typedef unsigned short u_short;
#undef UNALIGNED_FETCH_OK
#define USHORT unsigned
#else
#define USHORT unsigned short
#endif /* DOS */
/****************************************************************/
/* End of architecture-specific flag settings */

View File

@@ -6,6 +6,6 @@
#include "devif.h" /* for DspInterface */
void Init_XCursor(void);
void Set_XCursor(int x, int y);
void init_Xcursor(Display *display, Window window);
void init_Xcursor(DspInterface dsp);
void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hotspot_y, Cursor *return_cursor, int from_lisp);
#endif

View File

@@ -32,22 +32,25 @@
#include <unistd.h>
#include <signal.h>
extern int XLocked;
extern int XNeedSignal;
/* this is !0 if we're locked; it should be 0 or larger always */
#include "xwinmandefs.h"
#define XLOCK do { XLocked++; /* printf("L"); fflush(stdout);*/} while (0)
#define XUNLOCK \
do { XLocked--;/* printf("U"); fflush(stdout);*/ \
if (XNeedSignal) \
/* this is !0 if we're locked; it should be 0 or larger always */
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
#define XLOCK do { XLocked++; } while (0)
#define XUNLOCK(dsp) \
do { \
if (XLocked == 1 && XNeedSignal) \
{ \
XNeedSignal = 0; \
kill(getpid(), SIGPOLL); \
getXsignaldata(dsp); \
}; \
XLocked--; \
} while (0)
#else
#define XLOCK
#define XUNLOCK
#define XUNLOCK(dsp)
#endif /* LOCK_X_UPDATES */
#endif /* XDEFS_H */

View File

@@ -8,5 +8,5 @@ void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int gr
void enable_Xkeyboard(DspInterface dsp);
void disable_Xkeyboard(DspInterface dsp);
void beep_Xkeyboard(DspInterface dsp);
void getXsignaldata(DspInterface dsp);
void process_Xevents(DspInterface dsp);
#endif

View File

@@ -28,19 +28,15 @@
#include <stdlib.h>
#ifdef XWINDOW
#ifndef DOS
#include <sys/ioctl.h>
#endif /* DOS */
#include <sys/types.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "xdefs.h"
#endif /* XWINDOW */
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
#include "lispemul.h"
#include "lspglob.h"
@@ -85,10 +81,8 @@ extern int kbd_for_makeinit;
};
#endif
#if !defined(SUNDISPLAY)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* SUNDISPLAY */
#ifdef COLOR
extern int MonoOrColor;
@@ -99,7 +93,7 @@ extern int MonoOrColor;
/* take care of cursor movement & hiding */
/* (during bitblts to screen) ourselves. */
/*******************************************/
#if defined(SUNDISPLAY)
#if defined(SUNDISPLAY) || defined(DOS)
#define REALCURSOR
#else
#undef REALCURSOR
@@ -451,7 +445,11 @@ void bitbltsub(LispPTR *argv) {
}
do_it_now:
#ifdef DOS
currentdsp->device.locked++;
#else
ScreenLocked = T;
#endif /* DOS */
#ifdef REALCURSOR
displayflg |= n_new_cursorin(dstbase, dx, dty, w, h);
@@ -478,16 +476,26 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(dx, dty, w, h);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(dx, dty, w, h);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
#ifdef DOS
currentdsp->device.locked--;
#else
ScreenLocked = NIL;
#endif /* DOS */
} /* end of bitbltsub */
@@ -823,11 +831,17 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(dlx, dty, width, height);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(dlx, dty, width, height);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1064,11 +1078,17 @@ do_it_now:
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_region(left, dty, width, height);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
/* Copy the changed section of display bank to the frame buffer */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltsub: x %d, y %d, w %d, h %d.\n",dx, dty, w,h)); */
flush_display_region(left, dty, width, height);
}
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1110,7 +1130,6 @@ bad_arg:
/* */
/* */
/************************************************************************/
#ifndef prropstyle
/********************************************************/
/* Non-PIXRECT version of the code */
/********************************************************/
@@ -1188,11 +1207,13 @@ void bltchar(LispPTR *args)
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
XUNLOCK;
#endif /* XWINDOW */
#ifdef DOS
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
@@ -1200,96 +1221,6 @@ void bltchar(LispPTR *args)
UNLOCKSCREEN;
}
#else
/* prropstyle */
LispPTR bltchar(LispPTR *args)
/* args[0] : PILOTBBT
* args[1] : DISPLAYDATA
* args[2] : CHAR8CODE
* args[3] : CURX
* args[4] : LEFT
* args[5] : RIGHT
*/
{
register PILOTBBT *pbt;
register DISPLAYDATA *dspdata;
int x, y, destbpl, srcebpl, srcebit, distance;
int base;
register int displayflg;
unsigned int pix_op;
DLword *dstbase;
pbt = (PILOTBBT *)Addr68k_from_LADDR(((BLTC *)args)->pilotbbt);
dspdata = (DISPLAYDATA *)Addr68k_from_LADDR(((BLTC *)args)->displaydata);
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
dstbase = (mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
base = GETWORD(Addr68k_from_LADDR(dspdata->ddoffsetscache + ((BLTC *)args)->char8code));
srcebit = base + ((BLTC *)args)->left - ((BLTC *)args)->curx;
#ifdef REALCURSOR
/* if displayflg != 0 then source or destination is DisplayBitMap
* Now we consider about only destination
*/
displayflg = old_cursorin(pbt->pbtdesthi, pbt->pbtdestlo, ((BLTC *)args)->left, (((BLTC *)args)->right - ((BLTC *)args)->left),
pbt->pbtheight, y, pbt->pbtbackward);
#endif /* REALCURSOR */
/**** for DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG *****/
/* displayflg = T; */
/**** for DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG *****/
pix_op = PixOperation(pbt->pbtsourcetype, pbt->pbtoperation);
LOCKSCREEN;
#ifdef REALCURSOR
if (displayflg) HideCursor;
#endif /* REALCURSOR */
if (pr_rop(DestPixRect, ((BLTC *)args)->left, 0, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight, pix_op,
SrcePixRect, srcebit, 0) != 0)
error("pilotbitblt: pr_rop failed\n");
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) {
/* DBPRINT(("bltchar pix: x %x, y %d, w %d, h %d.\n", ((BLTC *)args)->left, dstbase,
* (((BLTC *)args)->right - ((BLTC *)args)->left),pbt->pbtheight));
*/
flush_display_lineregion(((BLTC *)args)->left, dstbase, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight);
}
#endif
#ifdef XWINDOW
XLOCK;
if (in_display_segment(dstbase))
flush_display_lineregion(((BLTC *)args)->left, dstbase, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight);
XUNLOCK;
#endif /* XWINDOW */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
#endif /* REALCURSOR */
ScreenLocked = NIL;
}
#endif
/************************************************************************/
/* */
@@ -1376,7 +1307,6 @@ LispPTR BLTCHAR_index; /* Atom # for \PUNTBLTCHAR punt fn */
LispPTR TEDIT_BLTCHAR_index; /* if NIL ,TEDIT is not yet loaded */
#ifndef prropstyle
/************************************************************************/
/* */
@@ -1493,6 +1423,9 @@ void newbltchar(LispPTR *args) {
#ifdef XWINDOW
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* XWINDOW */
#ifdef DOS
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif /* DOS */
#ifdef REALCURSOR
if (displayflg) ShowCursor;
@@ -1502,145 +1435,6 @@ void newbltchar(LispPTR *args) {
} /* end of newbltchar */
#else /* prropstyle */
/************************************************************************/
/* */
/* n e w b l t c h a r */
/* (PIXRECT version) */
/* */
/************************************************************************/
LispPTR newbltchar(LispPTR *args) {
register DISPLAYDATA *displaydata68k;
register int right, left, curx;
register PILOTBBT *pbt;
register int lmargin, rmargin, xoff;
int displayflg; /* T if cursor needs to be taken down */
displaydata68k = (DISPLAYDATA *)Addr68k_from_LADDR(((BLTARG *)args)->displaydata);
if ((displaydata68k->ddcharset & 0xFFFF) != ((BLTARG *)args)->charset) {
/* Currently, this has BUG, so I can't call it */
/*if(changecharset_display(displaydata68k,((BLTARG *)args)->charset) ==-1)*/
{ PUNT_TO_BLTCHAR; }
}
if (displaydata68k->ddslowprintingcase) { PUNT_TO_BLTCHAR; /** \SLOWBLTCHAR--return;**/ }
FGetNum(displaydata68k->ddxposition, curx);
FGetNum(displaydata68k->ddrightmargin, rmargin);
FGetNum(displaydata68k->ddleftmargin, lmargin);
FGetNum(displaydata68k->ddxoffset, xoff);
right =
curx +
GETWORD((DLword *)Addr68k_from_LADDR(displaydata68k->ddcharimagewidths + ((BLTARG *)args)->char8code));
if ((right > rmargin) && (curx > lmargin)) PUNT_TO_BLTCHAR;
if (((BLTARG *)args)->displaystream != *TOPWDS68k) PUNT_TO_BLTCHAR;
{
register int newpos;
newpos = curx +
GETWORD((DLword *)Addr68k_from_LADDR(displaydata68k->ddwidthscache + ((BLTARG *)args)->char8code));
if ((0 <= newpos) && (newpos < 65536))
(displaydata68k->ddxposition) = (LispPTR)(S_POSITIVE | newpos);
else if (-65537 < newpos)
(displaydata68k->ddxposition) = (LispPTR)(S_NEGATIVE | (0xffff & newpos));
else {
PUNT_TO_BLTCHAR;
}
}
curx += xoff;
right += xoff;
if (right > (int)(displaydata68k->ddclippingright)) right = displaydata68k->ddclippingright;
if (curx > (int)(displaydata68k->ddclippingleft))
left = curx;
else
left = displaydata68k->ddclippingleft;
if (left < right) {
pbt = (PILOTBBT *)Addr68k_from_LADDR(displaydata68k->ddpilotbbt);
if (pbt->pbtheight != 0) {
/****** OLD bltchar *****/
register int destbpl, srcebpl, sourcebit;
DLword *dstbase;
int base, y;
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
dstbase = (mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
base = GETBASE(Addr68k_from_LADDR(displaydata68k->ddoffsetscache), ((BLTARG *)args)->char8code);
sourcebit = base + left - curx;
LOCKSCREEN;
#ifdef SUNDISPLAY
if (displayflg = old_cursorin(pbt->pbtdesthi, pbt->pbtdestlo, left, (right - left),
pbt->pbtheight, y, pbt->pbtbackward)) {
HideCursor;
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
/* Save SHOWCURSOR 'til after paint to screen */
#ifndef DISPLAYBUFFER
ShowCursor;
#endif
} /* display case */
else {
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
} /* else */
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) {
/* DBPRINT(("newbltchar: x %d, y 0x%x, w %d, h %d.\n", left, dstbase,
* (right - left), pbt->pbtheight)); */
flush_display_lineregion(left, dstbase, (right - left), pbt->pbtheight);
if (displayflg) ShowCursor; /* because hide is done earlier */
}
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (pr_rop(DestPixRect, left, 0, (right - left), pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect, sourcebit,
0) != 0)
error("pilotbitblt: pr_rop failed\n");
if (in_display_segment(dstbase))
flush_display_lineregion(left, dstbase, (right - left), pbt->pbtheight);
#endif /* XWINDOW */
ScreenLocked = NIL;
/****** OLD bltchar *****/
}
}
} /* newbltchar */
#endif
/******************************************************************/
#ifndef BYTESWAP
@@ -1938,7 +1732,6 @@ void ccfuncall(register unsigned int atom_index, register int argnum, register i
/* */
/****************************************************************/
#ifndef prropstyle
/***************************/
/* Non-PIXRECT version */
/***************************/
@@ -1996,67 +1789,6 @@ void tedit_bltchar(LispPTR *args)
#undef backwardflg
} /* end tedit_bltchar */
#else
/* pr_op style */
/**********************/
/* PIXRECT version */
/**********************/
void tedit_bltchar(LispPTR *args)
{
register DISPLAYDATA *displaydata68k;
register int left, right;
register PILOTBBT *pbt;
register int imagewidth, newx;
register displayflg;
displaydata68k = (DISPLAYDATA *)Addr68k_from_LADDR(((TBLTARG *)args)->displaydata);
if (displaydata68k->ddcharset != ((TBLTARG *)args)->charset) {
/**if(changecharset_display(displaydata68k, ((TBLTARG *)args)->charset)== -1)**/
{ PUNT_TO_TEDIT_BLTCHAR; }
}
imagewidth = *((DLword *)Addr68k_from_LADDR(displaydata68k->ddcharimagewidths + ((TBLTARG *)args)->char8code));
newx = ((TBLTARG *)args)->current_x + imagewidth;
left = IMAX(0, ((TBLTARG *)args)->current_x);
right = IMIN(newx, ((TBLTARG *)args)->clipright);
LOCKSCREEN;
if (left < right) {
pbt = (PILOTBBT *)Addr68k_from_LADDR(displaydata68k->ddpilotbbt);
if (pbt->pbtheight) {
(mpr_d(SrcePixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtsourcehi, pbt->pbtsourcelo));
(mpr_d(DestPixRect))->md_image =
(short *)Addr68k_from_LADDR(VAG2(pbt->pbtdesthi, pbt->pbtdestlo));
{
register int srcebpl, destbpl;
SrcePixRect->pr_width = srcebpl = abs(pbt->pbtsourcebpl);
DestPixRect->pr_width = destbpl = abs(pbt->pbtdestbpl);
SrcePixRect->pr_height = DestPixRect->pr_height = pbt->pbtheight;
mpr_mdlinebytes(DestPixRect) = (destbpl + 7) >> 3;
mpr_mdlinebytes(SrcePixRect) = (srcebpl + 7) >> 3;
}
pbt->pbtwidth = IMIN(imagewidth, (right - left));
pbt->pbtsourcebit =
GETBASE(Addr68k_from_LADDR(displaydata68k->ddoffsetscache), ((TBLTARG *)args)->char8code);
if (pr_rop(DestPixRect, left, 0, pbt->pbtwidth, pbt->pbtheight,
PixOperation(pbt->pbtsourcetype, pbt->pbtoperation), SrcePixRect,
pbt->pbtsourcebit, 0) != 0)
error("pilotbitblt: pr_rop failed\n");
} /* if pbt->pbtheight */
} /* if left<right */
UNLOCKSCREEN;
} /* end tedit_bltchar */
#endif
#if defined(REALCURSOR) || defined(SUNDISPLAY)
#ifndef COLOR

View File

@@ -33,7 +33,7 @@ LispPTR *N_OP_bind(register LispPTR *stack_pointer, register LispPTR tos, int by
register int n1; /* # slots to bind to NIL (0, 0) */
register int n2; /* # slots to bind to value in stack */
register LispPTR *ppvar; /* pointer to argued slot in Pvar area */
register int i; /* temporary for control */
register unsigned i; /* temporary for control */
#ifdef TRACE
printPC();

View File

@@ -12,16 +12,6 @@
#include <stdio.h>
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/sunview.h>
#include <sunwindow/cms_mono.h>
#include <suntool/canvas.h>
#include <sys/ioctl.h>
#include <signal.h>
#endif
#ifdef XWINDOW
#define DISPLAYBUFFER
@@ -46,6 +36,13 @@
extern int kbd_for_makeinit;
#endif
#ifdef DOS
#include "devif.h"
#include "iopage.h"
extern DspInterface currentdsp;
extern IOPAGE *IOPage68K;
#endif
extern int LispWindowFd;
extern int ScreenLocked;
@@ -66,7 +63,7 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
{
PILOTBBT *pbt;
DLword *srcbase, *dstbase;
#if defined(SUNDISPLAY)
#if defined(SUNDISPLAY) || defined(DOS)
int displayflg;
#endif
int sx, dx, w, h, srcbpl, dstbpl, backwardflg;
@@ -98,9 +95,13 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
sx = pbt->pbtsourcebit;
backwardflg = pbt->pbtbackward;
/* if displayflg != 0 then source or destination is DisplayBitMap */
#ifdef DOS
currentdsp->device.locked++;
#else
ScreenLocked = T;
#endif /* DOS */
#if SUNDISPLAY
#if SUNDISPLAY || DOS
displayflg = cursorin(pbt->pbtdesthi, (pbt->pbtdestlo + (dx >> 4)), w, h, backwardflg) ||
cursorin(pbt->pbtsourcehi, (pbt->pbtsourcelo + (sx >> 4)), w, h, backwardflg);
#endif /* SUNDISPLAY */
@@ -116,28 +117,27 @@ LispPTR N_OP_pilotbitblt(LispPTR pilot_bt_tbl,int tos)
num_gray = ((TEXTUREBBT *)pbt)->pbtgrayheightlessone + 1;
curr_gray_line = ((TEXTUREBBT *)pbt)->pbtgrayoffset;
#ifdef SUNDISPLAY
if (displayflg) HideCursor;
#endif /* SUNDISPLAY */
#if DOS
if (displayflg) (currentdsp->mouse_invisible)(currentdsp, IOPage68K);
;
#endif /* SUNDISPLAY / DOS */
new_bitblt_code
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
#ifdef COLOR
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
#endif
if (displayflg) ShowCursor;
#endif /* SUNDISPLAY */
#if DOS
flush_display_lineregion(dx, dstbase, w, h);
if (displayflg) (currentdsp->mouse_visible)(IOPage68K->dlmousex, IOPage68K->dlmousey);
#endif /* SUNDISPLAY / DOS */
#ifdef XWINDOW
flush_display_lineregion(dx, dstbase, w, h);
#endif /* XWINDOW */
#ifdef DOS
currentdsp->device.locked--;
#else
ScreenLocked = NIL;
#endif /* DOS */
return (pilot_bt_tbl);

View File

@@ -25,6 +25,7 @@
#include <string.h>
#include <unistd.h>
#ifndef DOS
#include <dirent.h>
#include <stdio.h>
#include <sys/types.h>
@@ -33,6 +34,7 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
@@ -73,6 +75,7 @@ LispPTR CHAR_openfile(LispPTR *args)
/* args[1] access */
/* args[2] errno */
{
#ifndef DOS
register int fd; /* return value of open system call. */
register int flags; /* open system call's argument */
/* struct stat statbuf; */
@@ -103,6 +106,7 @@ LispPTR CHAR_openfile(LispPTR *args)
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
return (GetSmallp(fd));
#endif /* DOS */
}
/************************************************************************/
@@ -123,6 +127,7 @@ LispPTR CHAR_closefile(LispPTR *args)
/* args[0] fd */
/* args[1] errno */
{
#ifndef DOS
register int fd; /* file descriptor */
register int rval;
Lisp_errno = (int *)(Addr68k_from_LADDR(args[1]));
@@ -143,6 +148,7 @@ LispPTR CHAR_closefile(LispPTR *args)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -165,6 +171,7 @@ LispPTR CHAR_closefile(LispPTR *args)
LispPTR CHAR_ioctl(LispPTR *args)
{
#ifndef DOS
int fd, request;
void *data;
register int rval;
@@ -180,6 +187,7 @@ LispPTR CHAR_ioctl(LispPTR *args)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -195,6 +203,7 @@ LispPTR CHAR_ioctl(LispPTR *args)
LispPTR CHAR_bin(int fd, LispPTR errn)
{
#ifndef DOS
register int rval;
unsigned char ch[4];
Lisp_errno = (int *)(Addr68k_from_LADDR(errn));
@@ -211,6 +220,7 @@ LispPTR CHAR_bin(int fd, LispPTR errn)
return (NIL);
}
return (GetSmallp(ch[0]));
#endif /* DOS */
}
/************************************************************************/
@@ -225,6 +235,7 @@ LispPTR CHAR_bin(int fd, LispPTR errn)
LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
{
#ifndef DOS
register int rval;
char buf[4];
Lisp_errno = (int *)(Addr68k_from_LADDR(errn));
@@ -243,6 +254,7 @@ LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
return (NIL);
}
return (ATOM_T);
#endif /* DOS */
}
/************************************************************************/
@@ -268,6 +280,7 @@ LispPTR CHAR_bout(int fd, LispPTR ch, LispPTR errn)
LispPTR CHAR_bins(LispPTR *args)
{
#ifndef DOS
register int fd, rval;
char *buffer;
int nbytes;
@@ -292,6 +305,7 @@ LispPTR CHAR_bins(LispPTR *args)
#endif /* BYTESWAP */
return (GetSmallp(rval));
#endif /* DOS */
}
/************************************************************************/
@@ -317,6 +331,7 @@ LispPTR CHAR_bins(LispPTR *args)
LispPTR CHAR_bouts(LispPTR *args)
{
#ifndef DOS
register int fd, rval;
char *buffer;
int nbytes;
@@ -344,4 +359,5 @@ LispPTR CHAR_bouts(LispPTR *args)
return (NIL);
}
return (GetSmallp(rval));
#endif /* DOS */
}

View File

@@ -91,6 +91,7 @@ int error(const char *cp) {
fflush(stdout); fflush(stderr);
URaid_currentFX = URMAXFXNUM + 1;
memset(URaid_FXarray, 0, URMAXFXNUM * 4);
#ifndef DOS
{
int stat = fcntl(fileno(stdin), F_GETFL, 0);
if (stat != O_RDONLY && stat != O_RDWR)
@@ -99,6 +100,7 @@ int error(const char *cp) {
exit(0);
}
}
#endif /* DOS */
uraidloop:
if (setjmp(BT_jumpbuf) == 1) goto uraidloop;
if (setjmp(SD_jumpbuf) == 1) goto uraidloop;

View File

@@ -67,6 +67,18 @@ extern int URaid_ArrMAXIndex;
int BT_lines;
int BT_temp;
jmp_buf BT_jumpbuf;
#ifdef DOS
#define BTMAXLINE 24
/* DOS has a 25-line screen, and getchar discards ESC for some reason */
#define BT_morep \
if ((BT_temp != '!') && (++BT_lines > BTMAXLINE)) { \
printf("Press Return(Esc & Ret to quit, ! don't stop):"); \
BT_temp = getch(); \
fflush(stdin); \
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
}
#else /* DOS */
#define BTMAXLINE 30
#define BT_morep \
if (++BT_lines > BTMAXLINE) { \
@@ -76,6 +88,7 @@ jmp_buf BT_jumpbuf;
BT_lines = 0; \
if (BT_temp == 27) longjmp(BT_jumpbuf, 1); \
}
#endif /* DOS */
/***************************************************************/
/*

527
src/dir.c
View File

@@ -18,9 +18,16 @@
#include <sys/types.h>
#include <unistd.h>
#ifndef DOS
#include <dirent.h>
#include <pwd.h>
#include <sys/param.h>
#else /* DOS, now */
#include <dos.h>
#define MAXPATHLEN _MAX_PATH
#define MAXNAMLEN _MAX_PATH
#define alarm(x) 1
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
@@ -139,6 +146,12 @@ static int match_pattern(char *tp, char *pp)
register char *tsp, *psp;
register int inastr;
#ifdef DOS
/* % is not allowed in DOS names for Medley. */
if (strchr(tp, '%')) return 0;
#endif /* DOS */
for (tsp = tp, psp = pp, inastr = 0;; tp++, pp++) {
switch (*pp) {
case '\0': return ((*tp == '\0') ? 1 : 0);
@@ -178,6 +191,29 @@ static int match_pattern(char *tp, char *pp)
}
}
#ifdef DOS
int make_old_version(char *old, char *file)
{
int len = (int)strlen(file) - 1;
if (file[len] == DIRCHAR) return 0;
/* look up old versions of files for version # 0's */
strcpy(old, file);
if (old[len] == '.')
strcat(old, "%");
else if ((len > 0) && old[len - 1] == '.')
strcat(old, "%");
else if ((len > 1) && old[len - 2] == '.')
strcat(old, "%");
else if ((len > 2) && old[len - 3] == '.')
old[len] = '%';
else
strcat(old, ".%");
return 1;
}
#endif /* DOS */
/************************************************************************/
/******** E N D O F P A T T E R N - M A T C H I N G C O D E *******/
/************************************************************************/
@@ -411,6 +447,167 @@ static int get_finfo_id() {
* of FINFO structures.
*/
#ifdef DOS
static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval, res, isslash = 0, drive = 0;
struct find_t dirp;
register struct passwd *pwd;
struct stat sbuf;
char namebuf[MAXPATHLEN];
char fver[VERSIONLEN];
char old[MAXNAMLEN];
/* The null directory has to be special cased */
/* because adjacent \'s in the pathname don't match anything */
if (dir[1] == DRIVESEP) drive = dir[0];
if (strcmp(dir, "\\") == 0)
isslash = 1;
else if (drive && (strcmp(dir + 2, "\\") == 0))
isslash = 1;
if (!isslash)
strcpy(namebuf, dir); /* Only add the dir if it's real */
else if (drive) {
namebuf[0] = drive;
namebuf[1] = DRIVESEP;
namebuf[2] = '\0';
} else
*namebuf = '\0';
strcat(namebuf, DIRSEPSTR);
strcat(namebuf, name);
TIMEOUT(res = _dos_findfirst(namebuf, _A_NORMAL | _A_SUBDIR, &dirp));
if (res < 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; res == 0;
S_TOUT(res = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, dirp.name);
else
sprintf(namebuf, "\\%s", dirp.name);
} else
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
strcat(namebuf, ".~1~");
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
DOWNCASE(namebuf);
strcpy(nextp->no_ver_name, namebuf);
nextp->version = 1;
nextp->ino = sbuf.st_ino;
nextp->prop->length = (unsigned)sbuf.st_size;
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
/* TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
len = strlen(pwd->pw_name);
strcpy(nextp->prop->author, pwd->pw_name);
*(nextp->prop->author + len) = '\0';
nextp->prop->au_len = len;
} */
n++;
}
/***********************/
/* Now go looking for version-0 entries */
/***********************/
for (nextp = prevp; nextp; nextp = nextp->next) {
FINFO *newp;
if (!make_old_version(old, nextp->no_ver_name)) continue;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, old);
else
sprintf(namebuf, "\\%s", old);
} else
sprintf(namebuf, "%s\\%s", dir, old);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1) continue;
AllocFinfo(newp);
newp->next = prevp;
/* All other types than directory. */
newp->dirp = 0;
sprintf(namebuf, "%s.~00~", nextp->no_ver_name);
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(newp->lname, namebuf);
*(newp->lname + len) = '\0';
newp->lname_len = len;
strcpy(newp->no_ver_name, old);
newp->version = 0;
newp->ino = sbuf.st_ino;
newp->prop->length = (unsigned)sbuf.st_size;
newp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
newp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
newp->prop->protect = (unsigned)sbuf.st_mode;
n++;
prevp = newp;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -509,6 +706,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_dsk
@@ -529,6 +727,150 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
*
* Similar to enum_dsk_prop, but file properties are not stored.
*/
#ifdef DOS
static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval, isslash = 0, drive = 0;
struct find_t dirp;
struct stat sbuf;
char namebuf[MAXPATHLEN];
char fver[VERSIONLEN];
char old[MAXPATHLEN];
/* The null directory has to be special cased */
/* because adjacent \'s in the pathname don't match anything */
if (dir[1] == DRIVESEP) drive = dir[0];
if (strcmp(dir, "\\") == 0)
isslash = 1;
else if (drive && (strcmp(dir + 2, "\\") == 0))
isslash = 1;
if (!isslash)
strcpy(namebuf, dir); /* Only add the dir if it's real */
else if (drive) {
namebuf[0] = drive;
namebuf[1] = DRIVESEP;
namebuf[2] = '\0';
} else
*namebuf = '\0';
strcat(namebuf, DIRSEPSTR);
strcat(namebuf, name);
TIMEOUT(rval = _dos_findfirst(namebuf, _A_NORMAL | _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, dirp.name);
else
sprintf(namebuf, "\\%s", dirp.name);
} else
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name); /* moved from below 2/26/93 */
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
strcat(namebuf, ".~1~");
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name); /* to get real versionless name */
len = strlen(namebuf);
DOWNCASE(namebuf);
strcpy(nextp->no_ver_name, namebuf);
nextp->version = 1;
nextp->ino = sbuf.st_ino;
n++;
}
/***********************/
/* Now go looking for version-0 entries */
/***********************/
for (nextp = prevp; nextp; nextp = nextp->next) {
FINFO *newp;
if (!make_old_version(old, nextp->no_ver_name)) continue;
if (isslash) {
if (drive)
sprintf(namebuf, "%c:\\%s", drive, old);
else
sprintf(namebuf, "\\%s", old);
} else
sprintf(namebuf, "%s\\%s", dir, old);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1) continue;
AllocFinfo(newp);
newp->next = prevp;
/* All other types than directory. */
newp->dirp = 0;
sprintf(namebuf, "%s.~00~", nextp->no_ver_name);
quote_fname(namebuf);
len = strlen(namebuf);
strcpy(newp->lname, namebuf);
*(newp->lname + len) = '\0';
newp->lname_len = len;
strcpy(newp->no_ver_name, old);
newp->version = 0;
newp->ino = sbuf.st_ino;
n++;
prevp = newp;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
@@ -614,6 +956,7 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_ufs_prop
@@ -637,6 +980,93 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
* File properties Lisp will need later are also stored in the result linked list
* of FINFO structures.
*/
#ifdef DOS
static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval;
struct find_t dirp;
/* register struct passwd *pwd; -- From author support */
struct stat sbuf;
char namebuf[MAXPATHLEN];
TIMEOUT(rval = _dos_findfirst(dir, _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP_Case(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
quote_fname_ufs(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
nextp->ino = sbuf.st_ino;
nextp->prop->length = (unsigned)sbuf.st_size;
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
/*
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
len = strlen(pwd->pw_name);
strcpy(nextp->prop->author, pwd->pw_name);
*(nextp->prop->author + len) = '\0';
nextp->prop->au_len = len;
}
*/
n++;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -729,6 +1159,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS */
/*
* Name: enum_ufs
@@ -749,6 +1180,77 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
*
* Similar to enum_ufs_prop, but file properties are not stored.
*/
#ifdef DOS
static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct direct *dp;
register FINFO *prevp;
register FINFO *nextp;
int n, len, rval;
struct find_t dirp;
struct stat sbuf;
char namebuf[MAXPATHLEN];
TIMEOUT(rval = _dos_findfirst(dir, _A_SUBDIR, &dirp));
if (rval != 0) {
*Lisp_errno = errno;
return (-1);
}
for (nextp = prevp = (FINFO *)NULL, n = 0; rval == 0;
S_TOUT(rval = _dos_findnext(&dirp)), prevp = nextp) {
if (strcmp(dirp.name, ".") == 0 || strcmp(dirp.name, "..") == 0) continue;
MatchP_Case(dirp.name, name, ver, match, unmatch);
unmatch:
continue;
match:
AllocFinfo(nextp);
if (nextp == (FINFO *)NULL) {
FreeFinfo(prevp);
*Lisp_errno = errno;
return (-1);
}
nextp->next = prevp;
sprintf(namebuf, "%s\\%s", dir, dirp.name);
TIMEOUT(rval = stat(namebuf, &sbuf));
if (rval == -1 && errno != ENOENT) {
/*
* ENOENT error might be caused by missing symbolic
* link. We should ignore such error here.
*/
FreeFinfo(nextp);
*Lisp_errno = errno;
return (-1);
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
len = strlen(namebuf);
*(nextp->lname + len) = DIRCHAR;
*(nextp->lname + len + 1) = '\0';
nextp->lname_len = len + 1;
} else {
/* All other types than directory. */
nextp->dirp = 0;
quote_fname_ufs(namebuf);
len = strlen(namebuf);
strcpy(nextp->lname, namebuf);
*(nextp->lname + len) = '\0';
nextp->lname_len = len;
}
strcpy(namebuf, dirp.name);
len = strlen(namebuf);
nextp->ino = sbuf.st_ino;
n++;
}
if (n > 0) *finfo_buf = prevp;
return (n);
}
#else /* DOS */
static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
{
register struct dirent *dp;
@@ -825,6 +1327,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
if (n > 0) *finfo_buf = prevp;
return (n);
}
#endif /* DOS*/
/*
* Name: trim_finfo
@@ -846,6 +1349,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
static int trim_finfo(FINFO **fp)
{
#ifndef DOS
register FINFO *tp, *sp, *mp, *cp, *pp;
register int num, pnum;
int linkp;
@@ -944,6 +1448,16 @@ static int trim_finfo(FINFO **fp)
}
} while (sp != (FINFO *)NULL);
#else /* DOS version */
int num = 0;
FINFO *tp;
tp = *fp;
while (tp) {
num++;
tp = tp->next;
}
#endif /* DOS */
return (num);
}
@@ -1331,8 +1845,10 @@ static int dsk_filecmp(FINFO **fp1, FINFO **fp2)
if ((res = strcmp((*fp1)->no_ver_name, (*fp2)->no_ver_name)) != 0) return (res);
if ((*fp1)->version == (*fp2)->version) return (0);
#ifndef DOS
if ((v1 = (*fp1)->version) == 0) return (-1);
if ((v2 = (*fp2)->version) == 0) return (1);
#endif /* DOS */
return ((v1 < v2) ? 1 : -1);
}
@@ -1513,6 +2029,9 @@ LispPTR COM_gen_files(register LispPTR *args)
{
char fbuf[MAXPATHLEN + 5], dir[MAXPATHLEN], pattern[MAXPATHLEN];
char host[MAXNAMLEN], name[MAXNAMLEN], ver[VERSIONLEN];
#ifdef DOS
char drive[1];
#endif
int dskp, count, highestp, propp, fid, version;
register char *cp;
FINFO *fp;
@@ -1534,7 +2053,11 @@ LispPTR COM_gen_files(register LispPTR *args)
if (count > MAXPATHLEN + 5) FileNameTooLong((GetSmallp(-1)));
LispStringToCString(args[0], fbuf, MAXPATHLEN);
#ifdef DOS
separate_host(fbuf, host, drive);
#else
separate_host(fbuf, host);
#endif /* DOS */
UPCASE(host);
if (strcmp(host, "DSK") == 0)
@@ -1568,7 +2091,11 @@ LispPTR COM_gen_files(register LispPTR *args)
* to do some trick here.
*/
#ifdef DOS
if (!unixpathname(fbuf, pattern, 1, 1, drive, 0, 0)) {
#else
if (!unixpathname(fbuf, pattern, 1, 1)) {
#endif /* DOS */
/* Yes, always dskp is on */
return (GetSmallp(-1));
}

14
src/doscomm.c Normal file
View File

@@ -0,0 +1,14 @@
/* $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) {}

314
src/doskbd.c Normal file
View File

@@ -0,0 +1,314 @@
/* $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 <dos.h> /* defines REGS & other structs */
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
#include <stk.h>
#include <conio.h>
#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 *)&currentkbd, 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 *)&currentkbd, 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 */
}
}
}

624
src/dosmouse.c Normal file
View File

@@ -0,0 +1,624 @@
/* $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 <i32.h> /* Defines "#pragma interrupt" */
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h> /* 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 *)&currentmouse, 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, &regs, &regs);
regs.w.eax = 0x0002; /* Function 2 = hide mouse cursor */
int86(0x33, &regs, &regs);
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, &regs, &regs); /* 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, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
/* 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, &regs, &regs);
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 *)&currentmouse, 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, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
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, &regs, &regs);
#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);
}
}

View File

@@ -20,11 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef SUNDISPLAY
#include <sys/ioctl.h>
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#endif
#include "lispemul.h"
#include "lspglob.h"
@@ -133,17 +128,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
HideCursor; /** Figure out how to be smart later **/
#else /* DISPLAYBUFFER */
#ifndef OLD_CURSOR
HideCursor;
#endif /* OLD_CURSOR */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
delta &= 0xFFFF;
op &= 3;
@@ -277,17 +261,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (MonoOrColor == MONO_SCREEN)
#endif /* COLOR */
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
ShowCursor; /** figure how to be smart later **/
#else
#ifndef OLD_CURSOR
ShowCursor;
#endif /* OLD_CURSOR */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef DISPLAYBUFFER
#ifdef COLOR
@@ -304,9 +277,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
((int)(temp_e = (DLword *)(dataptr - DisplayRegion68k)) >= 0) &&
((DLword *)dataptr < DisplayRegion68k_end_addr)) {
int start_x, start_y, end_x, end_y, w, h;
#if defined(SUNDISPLAY) && defined(OLD_CURSOR)
int displayflg;
#endif
start_y = (int)temp_s / DisplayRasterWidth;
start_x = ((int)temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
@@ -320,18 +290,6 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (start_x > end_x) start_x = end_x;
if (start_y > end_y) start_y = end_y;
#if defined(SUNDISPLAY) && !defined(BYTESWAP)
#ifdef OLD_CURSOR
if ((displayflg = n_new_cursorin_CG6(start_x, start_y, w, h))) HideCursor;
#endif /* OLD_CURSOR */
pr_rop(ColorDisplayPixrect, start_x, start_y, w, h, PIX_SRC, DisplayRegionPixrect, start_x,
start_y);
#ifdef OLD_CURSOR
if (displayflg) ShowCursor;
#endif /* OLD_CURSOR */
#endif /* SUNDISPLAY */
#if defined(XWINDOW) || defined(BYTESWAP)
flush_display_region(start_x, start_y, w, h);

574
src/dsk.c

File diff suppressed because it is too large Load Diff

View File

@@ -32,17 +32,53 @@ extern DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, i
int depth_hint);
#endif /* XWINDOW */
#ifdef DOS
extern int dosdisplaymode;
#endif /* DOS */
void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
int depth_hint) {
#if XWINDOW
#ifdef DOS
TPRINT(("Enter make_dsp_instance, dosdisplaymode is: %d\n", dosdisplaymode));
if (depth_hint == 0) depth_hint = 1;
switch (dosdisplaymode) {
case 1: VGA_init(dsp, 0, 0, 0, depth_hint); break;
case 0x102:
case 0x104: VESA_init(dsp, 0, 0, 0, depth_hint); break;
default:
if (VESA_p()) {
VESA_init(dsp, 0, 0, 0, depth_hint);
} else if (VGA_p()) {
VGA_init(dsp, 0, 0, 0, depth_hint);
} else { /* Can't set *ANY* video mode! */
(void)fprintf(stderr, "No portable graphics mode supported by this host.\n");
(void)fprintf(stderr, "\n-Expected VESA or VGA.\n");
exit(1);
}
break;
}
#elif XWINDOW
/* lispbitmap is 0 when we call X_init the first time. */
if (X_init(dsp, 0, LispDisplayRequestedWidth, LispDisplayRequestedHeight, depth_hint) == NULL) {
fprintf(stderr, "Can't open display.");
exit(-1);
}
#endif /* XWINDOW */
#endif /* DOS | XWINDOW */
} /* Now we know the maximum capabilities of the hardware. */
#ifdef DOS
VESA_p() {
/* Magic. Do a vesa call to determine the current mode. */
return (VESA_call(3, 0));
}
VGA_p() { return (TRUE); }
#endif /* DOS */
/*********************************************************************/
/* */
/* G e n e r i c R e t u r n T */
@@ -71,7 +107,16 @@ void describedsp(DspInterface dsp) {
printf("colors= %lu\n", dsp->colors);
printf("graphicsmode= %lu\n", dsp->graphicsmode);
printf("numberofbanks= %lu\n", dsp->numberofbanks);
#ifdef DOS
printf("BytesPerLine= %d\n", dsp->BytesPerLine);
printf("DisplayStartAddr= %d\n", dsp->DisplayStartAddr);
#endif /* DOS */
printf("bitblt_to_screen= %p\n", dsp->bitblt_to_screen);
printf("cleardisplay= %p\n", dsp->cleardisplay);
#ifdef DOS
printf("mouse_visible= %d\n", dsp->mouse_visible);
printf("mouse_invisible= %d\n", dsp->mouse_invisible);
printf("\n");
#endif /* DOS */
fflush(stdout);
}

View File

@@ -12,9 +12,6 @@
#include "version.h"
#include <stdio.h>
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#endif
#include "lispemul.h"
#include "lsptypes.h"
@@ -68,9 +65,7 @@ void DSP_showdisplay(LispPTR *args)
LispPTR DSP_VideoColor(LispPTR *args) /* args[0] : black flag */
{
int invert;
#ifdef SUNDISPLAY
return NIL;
#elif defined(XWINDOW)
#if defined(XWINDOW)
invert = args[0] & 0xFFFF;
lisp_Xvideocolor(invert);
if (invert)
@@ -99,50 +94,7 @@ void DSP_Cursor(LispPTR *args, int argnum)
extern int ScreenLocked;
extern DLword *EmCursorX68K, *EmCursorY68K;
extern int LastCursorX, LastCursorY;
#if defined(SUNDISPLAY) && !defined(OLD_CURSOR)
static int Init = T;
#endif
#ifdef SUNDISPLAY
if (argnum == 2) {
CurrentCursor.cur_xhot = args[0] & 0xffff;
CurrentCursor.cur_yhot = args[1] & 0xffff;
};
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &CurrentCursor);
#else
#ifndef INIT
ScreenLocked = T;
if (!Init) {
taking_mouse_down();
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
} else {
Init = NIL;
cursor_hidden_bitmap(0, 0);
taking_mouse_up(0, 0);
*EmCursorX68K = LastCursorX = 0;
*EmCursorY68K = LastCursorY = 0;
}
ScreenLocked = NIL;
#else
/* Init specific lde only */
ScreenLocked = T;
if (!Init) {
taking_mouse_down();
taking_mouse_up(0, 0);
} else {
Init = NIL;
cursor_hidden_bitmap(0, 0);
taking_mouse_up(0, 0);
}
ScreenLocked = NIL;
#endif /* INIT */
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* For X-Windows, set the cursor to the given location. */
@@ -161,32 +113,6 @@ void DSP_Cursor(LispPTR *args, int argnum)
*/
void DSP_SetMousePos(register LispPTR *args)
{
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
register int x, y;
x = GetSmalldata(args[0]);
y = GetSmalldata(args[1]); /* debug */
win_setmouseposition(LispWindowFd, GetSmalldata(args[0]), GetSmalldata(args[1]));
#else
extern int ScreenLocked;
extern DLword *EmCursorX68K, *EmCursorY68K, *EmMouseX68K, *EmMouseY68K;
register int x, y;
ScreenLocked = T;
x = GetSmalldata(args[0]);
y = GetSmalldata(args[1]);
/* for Suntool's invisible cursor */
win_setmouseposition(LispWindowFd, x, y);
/* for REAL cursor image */
taking_mouse_down();
taking_mouse_up(x, y);
#ifndef INIT
*EmMouseX68K = x;
*EmMouseY68K = y;
#endif
ScreenLocked = NIL;
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (Mouse_Included)
@@ -251,25 +177,6 @@ void flip_cursor() {
#endif
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &CurrentCursor);
#else
ScreenLocked = T;
taking_mouse_down();
#ifndef INIT
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
#else
if (!for_makeinit)
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
else
taking_mouse_up(0, 0);
#endif /* INIT */
ScreenLocked = NIL;
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* JDS 011213: 15- cur y, as function does same! */

View File

@@ -21,6 +21,7 @@
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#ifndef DOS
#include <sys/file.h>
#include <signal.h>
#include <errno.h>
@@ -58,6 +59,7 @@
#include <sys/mbuf.h>
#endif
#include <nlist.h>
#endif /* DOS */
#endif /* MAIKO_ENABLE_ETHERNET */
#include "commondefs.h"

View File

@@ -24,9 +24,6 @@
#include "commondefs.h"
#include "gchtfinddefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define MaskShift(x) (((x) << 16) & SEGMASK)

View File

@@ -34,9 +34,6 @@
#include "gc2defs.h"
#include "gcscandefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
/**********************************************************************/
/*

View File

@@ -52,9 +52,6 @@
#include "gcrcelldefs.h"
#include "gcscandefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define WORDSPERCELL 2
#define MAXHTCNT 63
@@ -99,203 +96,6 @@
#define STKREFBIT 0x200
#endif /* BIGVM */
#ifdef GCC386
/* byte-swapped, 386 assembler version */
LispPTR gcmapscan() {
volatile DLword probe;
volatile DLword *entry;
volatile DLword offset;
volatile LispPTR ptr;
asm volatile(
" \n\
movl $32768,%%edi / probe = HTSIZE. \n\
.align 4 \n\
nextentry: / nextentry: \n\
decl %%edi \n\
js returNIL \n\
leal 0(,%%edi,2),%%esi \n\
addl HTmain,%%esi /htlptr = (struct htlinkptr *)(HTmain+probe); \n\
.align 4 \n\
scanloop: \n\
movl %%esi,%%edx \n\
xorb $2,%%dl \n\
movzwl (%%edx),%%eax / contents = ((struct htlinkptr *)WORDPTR(htlptr))->contents \n\
testl %%eax,%%eax / if (contents && \n\
je scanbot \n\
testb $1,%%al \n\
jne scanok \n\
testb $254,%%ah \n\
jne scanbot \n\
scanok: \n\
jmp scandone \n\
.align 4 \n\
scanbot: \n\
addl $-2,%%esi / end of while loop. \n\
decl %%edi \n\
jns scanloop \n\
jmp returNIL \n\
\n\
\n\
scandone: \n\
movl %%edx,%0 / entry = (DLword *) HTmain + probe. \n\
retry: / retry: \n\
movl %0,%%ecx \n\
movzwl (%%ecx),%%eax \n\
testb $1,%%al / if HENTRY->collision, \n\
je nocollision \n\
xorl %%esi,%%esi / prev = 0 \n\
andl $65534,%%eax \n\
linkloop: // linkloop: \n\
leal 0(,%%eax,2),%%ecx \n\
addl HTcoll,%%ecx \n\
movw 2(%%ecx),%%ax / offset = ((struct htcoll *)link)->free_ptr; \n\
testb $254,%%ah / if StkCountIsZero(offset) \n\
jne stknz \n\
sall $15,%%eax / , (probe << 1)); \n\
andl $16711680,%%eax \n\
leal 0(,%%edi,2),%%edx \n\
orl %%eax,%%edx \n\
movl %%edx,%2 / to ptr. \n\
testl %%esi,%%esi / DelLink. if (prev != 0) \n\
je prevZ \n\
leal 2(%%esi),%%edx / GETWORD((DLword *)prev + 1) = GETWORD((DLword *)link + 1) \n\
xorb $2,%%dl \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movw (%%eax),%%ax \n\
jmp freelink \n\
.align 4 \n\
prevZ: \n\
movl %0,%%edx / else GETWORD((DLword *)entry) = GETWORD((DLword *)link + 1) \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movw (%%eax),%%ax \n\
orb $1,%%al \n\
freelink: / FreeLink \n\
movw %%ax,(%%edx) \n\
movl %%ecx,%%eax \n\
xorb $2,%%al \n\
movw $0,(%%eax) \n\
leal 2(%%ecx),%%eax \n\
xorb $2,%%al \n\
movl HTcoll,%%edx / GETWORD(link+1) = GETWORD(HTcoll); \n\
xorb $2,%%dl \n\
movw (%%edx),%%dx \n\
movw %%dx,(%%eax) \n\
movl HTcoll,%%edx / GETWORD(HTcoll) = (link - HTcoll); \n\
xorb $2,%%dl \n\
movl %%ecx,%%eax \n\
subl HTcoll,%%eax \n\
sarl $1,%%eax \n\
movw %%ax,(%%edx) \n\
movl %0,%%esi / link = (DLword *)HTcoll + GetLinkptr(GETWORD((DLword *)entry \n\
movw (%%esi),%%ax \n\
andl $65534,%%eax \n\
addl %%eax,%%eax \n\
movl %%eax,%%ecx \n\
addl HTcoll,%%ecx \n\
leal 2(%%ecx),%%edx / if (GETWORD((DLword *)link + 1) == 0) { \n\
xorb $2,%%dl \n\
cmpw $0,(%%edx) \n\
jne sgclp1 \n\
movl %%ecx,%%eax / GETWORD((DLword *)entry) = GETWORD((DLword *)link) \n\
xorb $2,%%al \n\
movw (%%eax),%%bx \n\
movw %%bx,(%%esi) \n\
movw $0,(%%eax) / FreeLink: GETWORD(link) = 0 \n\
movl HTcoll,%%eax / GETWORD(link+1) = GETWORD(HTcoll) \n\
xorb $2,%%al \n\
movw (%%eax),%%bx \n\
movw %%bx,(%%edx) \n\
movl %%ecx,%%ebx \n\
subl HTcoll,%%ebx \n\
sarl $1,%%ebx \n\
movw %%bx,(%%eax) \n\
.align 4 \n\
sgclp1: / start of gcloop 1 - do setup \n\
movl GcDisabled_word,%%ecx \n\
movl MDStypetbl,%%ebx \n\
gclp1: / GcreclaimLp: \n\
pushl %2 \n\
call gcreccell \n\
addl $4,%%esp \n\
movl %%eax,%2 \n\
testl %%eax,%%eax \n\
je eogclp1 \n\
shrl $9,%%eax \n\
leal 0(%%ebx,%%eax,2),%%eax \n\
xorb $2,%%al \n\
cmpw $0,(%%eax) \n\
jl gclp1 \n\
cmpl $76,(%%ecx) \n\
je gclp1 \n\
pushl $0 \n\
pushl %2 \n\
call rec_htfind \n\
addl $8,%%esp \n\
jmp gclp1 \n\
.align 4 \n\
.align 4 \n\
eogclp1: \n\
movl %0,%%eax / if (HTLPTR->contents == 0) \n\
cmpw $0,(%%eax) \n\
je nextentry / goto nextentry; \n\
jmp retry / else goto retry; \n\
.align 4 \n\
.align 4 \n\
\n\
stknz: \n\
movw (%%ecx),%%ax / if ((offset = ((struct htcoll *)link)->next_free)) \n\
testw %%ax,%%ax \n\
je nextentry \n\
movl %%ecx,%%esi \n\
andl $65535,%%eax \n\
jmp linkloop \n\
.align 4 \n\
.align 4 \n\
nocollision: \n\
testw $65024,(%%ecx) / if (StkCntIsZero(HTLPTR->contents)) { \n\
jne nextentry \n\
movw (%%ecx),%%dx /ptr = VAG2(HENTRY->segnum, (probe << 1)); \n\
sall $15,%%edx \n\
andl $16711680,%%edx \n\
leal (,%%edi,2),%%eax \n\
orl %%eax,%%edx \n\
movl %%edx,%2 \n\
movw $0,(%%ecx) / HTLPTR->contents = 0 \n\
.align 4 \n\
movl GcDisabled_word,%%ecx \n\
movl MDStypetbl,%%ebx \n\
gclp2: / GcreclaimLp \n\
pushl %2 \n\
call gcreccell \n\
addl $4,%%esp \n\
movl %%eax,%2 \n\
testl %%eax,%%eax \n\
je nextentry \n\
shrl $9,%%eax \n\
leal 0(%%ebx,%%eax,2),%%eax \n\
xorb $2,%%al \n\
cmpw $0,(%%eax) \n\
jl gclp2 \n\
cmpl $76,(%%ecx) \n\
je gclp2 \n\
pushl $0 \n\
pushl %2 \n\
call rec_htfind \n\
addl $8,%%esp \n\
jmp gclp2 \n\
.align 4 \n\
returNIL: \n\
"
: "=g"(entry), "=g"(offset), "=g"(ptr)
:
: "ax", "dx", "cx", "bx", "si", "di");
return NIL;
}
#else
LispPTR gcmapscan(void) {
register GCENTRY probe;
@@ -342,7 +142,6 @@ nextentry:
}
return (NIL);
}
#endif /* GCC386 */
LispPTR gcmapunscan(void) {
register GCENTRY probe;

View File

@@ -14,6 +14,7 @@
#include <stdio.h>
#include <string.h> /* for mem... fns */
#ifndef DOS
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
@@ -25,6 +26,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif /* DOS */
#if (defined(OS5) || defined(__CYGWIN__)) && !defined(O_ASYNC)
/* Cygwin and Solaris don't define O_ASYNC, yet still define FASYNC. */
@@ -47,9 +49,6 @@
#include "commondefs.h"
#include "mkcelldefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
#define TCPhostlookup 0
#define TCPservicelookup 1
@@ -76,6 +75,7 @@ fd_set LispIOFds;
LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, LispPTR bufaddr, LispPTR maxlen)
{
#ifndef DOS
int sock, len, buflen, res;
unsigned ures;
char namestring[100];
@@ -332,4 +332,5 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
default: return (NIL); break;
}
#endif /* DOS */
}

View File

@@ -18,20 +18,6 @@
#include <stdio.h>
#include <unistd.h>
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sunwindow/win_ioctl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <pixrect/pixrect_hs.h>
#include <sun/fbio.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <pixrect/pr_planegroups.h>
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
#ifdef OS4
#include <vfork.h>
@@ -60,12 +46,15 @@
#include "xcursordefs.h"
#endif
#if defined(XWINDOW)
#ifdef DOS
#define getpagesize() 512
#endif /* DOS */
#if defined(XWINDOW) || defined(DOS)
#include "devif.h"
DLword *DisplayRegion68k_end_addr;
extern DspInterface currentdsp;
int DisplayWidth8;
#endif /* XWINDOW */
#endif /* DOS */
/* from /usr/include/sun/fbio.h some machines don't have following def. */
#ifndef FBTYPE_SUNROP_COLOR
@@ -73,21 +62,6 @@ int DisplayWidth8;
#define FBTYPE_SUNFAST_COLOR 12
#endif
#ifdef SUNDISPLAY
struct screen LispScreen;
#ifndef NOPIXRECT
struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
struct pixrect *SrcePixRect, *DestPixRect;
#ifdef DISPLAYBUFFER
int black = 0, white = -1;
struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
#define COPY_PIXRECT_TO_COLOR (PIX_SRC /*| PIX_DONTCLIP */)
#ifdef DEBUG
int oldred[2], oldgreen[2], oldblue[2];
#endif /* DEBUG */
#endif /* DISPLAYBUFFER */
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
int LispWindowFd = -1;
int FrameBufferFd = -1;
@@ -104,10 +78,6 @@ DLword *DisplayRegion68k_end_addr;
/* some functions use this variable when undef DISPLAYBUFFER */
DLword *DISP_MAX_Address;
#ifdef SUNDISPLAY
struct cursor CurrentCursor, InvisibleCursor;
struct winlock DisplayLockArea;
#endif /* SUNDISPLAY */
extern DLword *EmCursorBitMap68K;
extern IFPAGE *InterfacePage;
@@ -124,13 +94,6 @@ DLword *DisplayRegion68k_end_addr;
extern int *Xdisplay; /* DAANGER -jarl nilsson 27-apr-92 */
#endif /* XWINDOW */
#ifdef SUNDISPLAY
/* For SunOS4.1 Window Security Feature. */
int Win_security_p;
#include <sys/wait.h>
#define SV_ACQUIRE "/bin/sunview1/sv_acquire"
#define SV_RELEASE "/bin/sunview1/sv_release"
#endif /* SUNDISPLAY */
/************************************************************************/
/* */
@@ -141,30 +104,6 @@ int Win_security_p;
/************************************************************************/
void init_cursor() {
#ifdef SUNDISPLAY
#ifndef NOPIXRECT
CursorBitMap = mem_create(CURSORWIDTH, CURSORHEIGHT, 1);
mpr_mdlinebytes(CursorBitMap) = CURSORWIDTH >> 3; /* 2(byte) */
#endif /* NOPIXRECT */
CurrentCursor.cur_xhot = 0;
CurrentCursor.cur_yhot = 0;
CurrentCursor.cur_shape = CursorBitMap;
CurrentCursor.cur_function = PIX_SRC | PIX_DST;
/* Invisible Cursor */
#ifndef NOPIXRECT
InvisibleCursorBitMap = mem_create(0, 0, 1);
#endif /* NOPIXRECT */
InvisibleCursor.cur_xhot = 0;
InvisibleCursor.cur_yhot = 0;
InvisibleCursor.cur_shape = InvisibleCursorBitMap;
InvisibleCursor.cur_function = /*PIX_SRC |*/ PIX_DST;
win_setcursor(LispWindowFd, &InvisibleCursor);
win_setmouseposition(LispWindowFd, 0, 0);
#endif /* SUNDISPLAY */
}
/************************************************************************/
@@ -175,18 +114,6 @@ void init_cursor() {
/* */
/************************************************************************/
void set_cursor() {
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
(mpr_d(CursorBitMap))->md_image = (short *)(IOPage->dlcursorbitmap);
/* BitmapBase of CurrentCursor
* is set to IOPage->dlcursorbitmap
*/
if (win_setcursor(LispWindowFd, &CurrentCursor) == -1) perror("SET Cursor");
if (win_setmouseposition(LispWindowFd, 0, 0) == -1) perror("SET Mouse POS");
#else
if (win_setcursor(LispWindowFd, &InvisibleCursor) == -1) perror("SET Cursor:");
#endif
#endif /* SUNDISPLAY */
#ifdef XWINDOW
Init_XCursor();
@@ -205,23 +132,12 @@ void set_cursor() {
#ifndef COLOR
void clear_display() {
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
register short *word;
register int w, h;
word = (short *)DisplayRegion68k;
for (h = displayheight; (h--);) {
for (w = DisplayRasterWidth; (w--);) { *word++ = 0; }
}
#else
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, PIX_CLR, ColorDisplayPixrect, 0,
0);
/* Original images are still kept in SYSOUT(DisplayRegion) */
/* clear_CG6; */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef DOS
TPRINT(("Enter Clear_display\n"));
(currentdsp->cleardisplay)(currentdsp);
TPRINT(("Exit Clear_display\n"));
#endif /* DOS */
}
#else /* COLOR */
@@ -253,84 +169,13 @@ void clear_display() {
void init_display2(DLword *display_addr, int display_max)
{
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
int mmapstat;
#endif
int fbgattr_result;
struct fbtype my_screen;
char groups[PIXPG_OVERLAY + 1];
struct fbgattr FBattr;
struct pixrect *ColorFb;
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
/* For SunOS4.1 Window Security Feature. */
union wait status;
/* Window Security is available? */
if (!access(SV_ACQUIRE, F_OK))
Win_security_p = 1;
else
Win_security_p = 0;
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "init_display: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_ACQUIRE, "sv_acquire", "0", "256", "250", 0);
/* should not return */
(void)fprintf(stderr, "init_display: exec for sv_acquire failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status); /* child dies after changing 6 */
if (status.w_retcode != 0) {
(void)fprintf(stderr, "init_display: failed to set ownership of win devices\n");
exit(1);
}
}
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
if ((LispWindowFd = win_screennew(&LispScreen)) == -1) {
perror("init_display: can't create LispWindow\n");
exit(-1);
} else {
#ifdef KBINT
/* int_io_open(LispWindowFd); JDS 4/27/94 move to initkbd, to try preventing the
* move-mouse-never-get-kbd bug */
#endif
fcntl(LispWindowFd, F_SETFL, fcntl(LispWindowFd, F_GETFL, 0) | O_NONBLOCK);
}
#endif /* SUNDISPLAY */
DisplayRegion68k = (DLword *)display_addr;
#ifdef SUNDISPLAY
if ((FrameBufferFd = open(LispScreen.scr_fbname, 2)) == -1) {
perror("init_display: can't open FrameBuffer\n");
exit(-1);
}
/* initialize Display parameters */
if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) == -1) {
perror("init_display: can't find screen parameters\n");
exit(-1);
}
displaywidth = my_screen.fb_width;
displayheight = my_screen.fb_height;
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
(currentdsp->device.enter)(currentdsp);
displaywidth = currentdsp->Display.width;
displayheight = currentdsp->Display.height;
@@ -343,146 +188,7 @@ void init_display2(DLword *display_addr, int display_max)
DBPRINT(("FBIOGTYPE w x h = %d x %d\n", displaywidth, displayheight));
DBPRINT(("FBIOGTYPE w x h = %d x %d\n", displaywidth, displayheight));
#ifdef SUNDISPLAY
DBPRINT((" (real) type = %d\n", my_screen.fb_type));
DBPRINT((" (real) bpp = %d\n", my_screen.fb_depth));
#endif /* SUNDISPLAY */
#ifdef SUNDISPLAY
/** now attempt to use the FBIOGATTR call for more information **/
fbgattr_result = ioctl(FrameBufferFd, FBIOGATTR, &FBattr);
if (fbgattr_result >= 0) {
DBPRINT(("FBIOGATTR realtype = %d\n", FBattr.real_type));
DBPRINT((" (real) size = %d x %d\n", FBattr.fbtype.fb_width, FBattr.fbtype.fb_height));
DBPRINT((" (real) type = %d\n", FBattr.fbtype.fb_type));
DBPRINT((" (real) bpp = %d\n", FBattr.fbtype.fb_depth));
DBPRINT((" emuls= %d %d %d %d\n", FBattr.emu_types[0], FBattr.emu_types[1],
FBattr.emu_types[2], FBattr.emu_types[3]));
} else { /* fill in defaults */
FBattr.real_type = my_screen.fb_type;
}
DBPRINT(("init_display: FBIOGATTR_result = %d\n", fbgattr_result));
/* probe for DISPLAY type */
/**********************************************************************
* FB-TYPE REAL-TYPE
* BW2 2 x
* CG2 3 3
* CG3 8 6
* CG4 2 8
* CG6 8 12
* CG8 6 7
* CG9(GP1) 4 4 ;gpconfig -f -b
* CG9(GP1) 2 13 ;gpconfig gpone0 -f -b cgtwo0
* ;We assume This config for GXP model
***********************************************************************/
/* Medley supports real (or emulated) BW2, so check for that first */
#ifndef DISPLAYBUFFER
if ((my_screen.fb_type == FBTYPE_SUN2BW) /* real or emulated bwtwo */
|| (my_screen.fb_type == FBTYPE_SUN3COLOR)) /* Sun 3 color? */
switch (FBattr.real_type) {
case FBTYPE_SUN2BW: DisplayType = SUN2BW; break;
case FBTYPE_MEMCOLOR: /* memory 24-bit (CG8) */
{
DisplayType = SUNMEMCOLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
} break;
case FBTYPE_SUN4COLOR: /* cg4 */
case FBTYPE_SUNROP_COLOR: /* cg9(GXP) */
{ /* need to clear overlay plane */
DisplayType = SUN4COLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
break;
}
default:
printf("initdisplay: Unsupported FBreal_type %d\n", FBattr.real_type);
DisplayType = (my_screen.fb_type) << 3;
/* should be able to proceed, since its an emulated bwtwo */
}
else { /* not currently a SUN2BW, perhaps can emulate it? */
if (fbgattr_result >= 0) { /* got gattrs, can try sattr */
#ifdef DEBUG
error("fb bwtwo emulation not implemented, q to proceed\n");
#endif /* DEBUG */
} else {
error("Not cgfour or bwtwo, q to attempt to proceed");
}
printf("initdisplay: Unsupported FBreal_type %d\n", FBattr.real_type);
DisplayType = (my_screen.fb_type) << 3;
/* try to muddle on */
}
#else /* DISPLAYBUFFER is defined, then: */
DisplayRegion68k_end_addr = DisplayRegion68k + DisplayRasterWidth * displayheight;
if (my_screen.fb_type == FBTYPE_SUN2BW) /* real or emulated bwtwo */
switch (FBattr.real_type) {
case FBTYPE_SUN4COLOR: { /* need to clear overlay plane */
DisplayType = SUN4COLOR;
ColorFb = pr_open("/dev/fb");
pr_available_plane_groups(ColorFb, sizeof(groups), groups);
if (groups[PIXPG_OVERLAY] && groups[PIXPG_OVERLAY_ENABLE]) {
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_CLR, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_8BIT_COLOR);
}
ColorDisplayPixrect = ColorFb;
break;
}
default: ColorDisplayPixrect = pr_open("/dev/fb"); break;
}
else if (my_screen.fb_type == FBTYPE_SUN4COLOR) { /* cg3 or cg6 */
switch (FBattr.real_type) {
case FBTYPE_SUN3COLOR: /* cg3 */
/* DisplayType = SUN3COLOR; */
DisplayType = (FBattr.real_type) << 3;
break;
case FBTYPE_SUNFAST_COLOR: /* cg6 */
/* DisplayType = SUNFASTCOLOR; */
DisplayType = (FBattr.real_type) << 3;
break;
default: /* unknown display */ DisplayType = (FBattr.real_type) << 3; break;
} /* end switch */
ColorDisplayPixrect = pr_open("/dev/fb");
} /* end else if() */
else
ColorDisplayPixrect = pr_open("/dev/fb");
DisplayRegionPixrect = mem_point(displaywidth, displayheight, 1, display_addr);
#ifdef DEBUG
pr_getcolormap(ColorDisplayPixrect, 0, 2, oldred, oldgreen, oldblue);
#endif /* DEBUG */
DBPRINT(("Color map for color pixrect:\n 0: R: %d, G: %d, B: %d\n 1: R: %d, G: %d, B: %d\n",
oldred[0], oldgreen[0], oldblue[0], oldred[1], oldgreen[1], oldblue[1]));
DBPRINT(("Color depth = %d.\n", ColorDisplayPixrect->pr_depth));
pr_putcolormap(ColorDisplayPixrect, 1, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, 0, 1, &white, &white, &white);
pr_putcolormap(ColorDisplayPixrect, 255, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, (1 << ColorDisplayPixrect->pr_depth) - 1, 1, &black, &black,
&black);
#endif
DisplayLockArea.wl_rect.r_width = displaywidth;
DisplayLockArea.wl_rect.r_height = displayheight;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
DisplayType = SUN2BW;
@@ -496,35 +202,15 @@ void init_display2(DLword *display_addr, int display_max)
DBPRINT((" length : 0x%x\n", DisplayByteSize));
DBPRINT((" pg size: 0x%x\n", getpagesize()));
#ifdef SUNDISPLAY
#ifndef DISPLAYBUFFER
mmapstat = (int)mmap(DisplayRegion68k, DisplayByteSize, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif
MAP_SHARED,
FrameBufferFd, 0);
DBPRINT(("after mmap: 0x%x\n", mmapstat));
if (mmapstat == -1) {
perror("init_display: ERROR at mmap system call\n");
exit(0);
}
#endif /* ifndef DISPLAYBUFFER */
DBPRINT(("after mem_point\n"));
#endif /* SUNDISPLAY */
#ifdef DOS
(currentdsp->cleardisplay)(currentdsp);
#else /* DOS */
clear_display();
#endif /* DOS */
DBPRINT(("after clear_display()\n"));
#if defined(SUNDISPLAY) && !defined(NOPIXRECT)
/* initialize pixrect used in pilotbitblt */
SrcePixRect = mem_point(0, 0, 1, NULL);
DestPixRect = mem_point(0, 0, 1, NULL);
#endif
DBPRINT(("exiting init_display\n"));
}
@@ -537,52 +223,19 @@ void init_display2(DLword *display_addr, int display_max)
/* */
/************************************************************************/
void display_before_exit() {
#ifdef SUNDISPLAY
union wait status;
#endif /* SUNDISPLAY */
#ifdef TRUECOLOR
truecolor_before_exit();
#endif /* TRUECOLOR */
clear_display();
#ifdef SUNDISPLAY
/* win_remove( LispWindowFd ); */
win_screendestroy(LispWindowFd);
#ifdef KBINT
int_io_close(LispWindowFd);
#endif
close(LispWindowFd);
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "display_before_exit: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_RELEASE, "sv_release", 0);
/* should not return */
(void)fprintf(stderr, "display_before_exit: exec for sv_release failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status);
if (status.w_retcode != 0) {
(void)fprintf(stderr, "display_before_raid: failed to set ownership of win devices\n");
exit(1);
}
}
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if defined(XWINDOW) || defined(DOS)
(currentdsp->device.exit)(currentdsp);
#endif /* XWINDOW */
#endif /* DOS */
}
#if defined(DISPLAYBUFFER)
#if defined(DISPLAYBUFFER) || defined(DOS)
/************************************************************************/
/* */
/* i n _ d i s p l a y _ s e g m e n t */
@@ -613,18 +266,17 @@ in_display_segment(baseaddr)
/************************************************************************/
void flush_display_buffer() {
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, 0, 0, displaywidth, displayheight, COPY_PIXRECT_TO_COLOR,
DisplayRegionPixrect, 0, 0);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#ifdef XWINDOW
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentdsp->Visible.x,
currentdsp->Visible.y, currentdsp->Visible.width,
currentdsp->Visible.height);
#endif /* XWINDOW */
#elif DOS
TPRINT(("Enter flush_display_buffer\n"));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, 0, 0, currentdsp->Display.width,
currentdsp->Display.height);
TPRINT(("Exit flush_display_buffer\n"));
#endif /* DOS */
}
/************************************************************************/
@@ -645,19 +297,12 @@ void flush_display_buffer() {
void flush_display_region(int x, int y, int w, int h)
{
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_region x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_region\n"));
#endif /* XWINDOW */
#endif /* DOS */
}
#ifdef BYTESWAP
void byte_swapped_displayregion(int x, int y, int w, int h)
@@ -695,19 +340,12 @@ void flush_display_lineregion(UNSIGNED x, DLword *ybase, UNSIGNED w, UNSIGNED h)
{
int y;
y = ((DLword *)ybase - DisplayRegion68k) / DLWORD_PERLINE;
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_lineregion x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_lineregion\n"));
#endif /* XWINDOW */
#endif /* DOS */
}
/************************************************************************/
@@ -734,11 +372,9 @@ void flush_display_ptrregion(DLword *ybase, UNSIGNED bitoffset, UNSIGNED w, UNSI
y = baseoffset / DLWORD_PERLINE;
x = bitoffset + (BITSPERWORD * (baseoffset - (DLWORD_PERLINE * y)));
#if (defined(SUNDISPLAY) && defined(DISPLAYBUFFER))
pr_rop(ColorDisplayPixrect, x, y, w, h, COPY_PIXRECT_TO_COLOR, DisplayRegionPixrect, x, y);
#elif defined(XWINDOW)
#if (defined(XWINDOW) || defined(DOS))
TPRINT(("Enter flush_display_ptrregion\n x=%d, y=%d, w=%d, h=%d\n", x, y, w, h));
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, x, y, w, h);
TPRINT(("Exit flush_display_ptrregion\n"));
#endif /* SUNDISPLAY & DISPLAYBUFFER, XWINDOW */
#endif /* DOS */
}

View File

@@ -17,18 +17,20 @@
#include <string.h>
#include <sys/types.h>
#ifndef DOS
#include <sys/file.h>
#include <sys/select.h>
#endif /* DOS */
#ifdef DOS
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
#include <dos.h> /* defines REGS & other structs */
#include <stdio.h> /* define NULL */
#include <conio.h>
#include <time.h>
#include <stk.h>
#endif /* DOS */
#ifdef SUNDISPLAY
#include <sundev/kbd.h>
#include <sundev/kbio.h>
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sys/ioctl.h>
#include <sunwindow/win_ioctl.h>
#include <pixrect/pixrect_hs.h>
#endif /* SUNDISPLAY */
#ifdef XWINDOW
#include <X11/Xlib.h>
@@ -59,9 +61,12 @@
extern DspInterface currentdsp;
#endif /* XWINDOW */
#ifdef SUNDISPLAY
extern struct screen LispScreen;
#endif /* SUNDISPLAY */
#ifdef DOS
#include "devif.h"
extern MouseInterface currentmouse;
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* DOS */
extern int LispWindowFd;
int LispKbdFd = -1;
@@ -71,9 +76,6 @@ int DebugKBD = NIL;
FILE *KBlog;
extern fd_set LispReadFds;
#ifdef SUNDISPLAY
struct inputmask LispEventMask;
#endif /* SUNDISPLAY */
IOPAGE *IOPage68K;
@@ -197,57 +199,38 @@ u_char DOSLispKeyMap_101[0x80] = {
void init_keyboard(int flg) /* if 0 init else re-init */
{
#ifdef SUNDISPLAY
int keytrans;
#endif
set_kbd_iopointers();
#ifdef SUNDISPLAY
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1) {
fprintf(stderr, "can't open %s\n", LispScreen.scr_kbdname);
exit(-1);
}
#endif /* SUNDISPLAY */
if (flg == 0) { keyboardtype(LispKbdFd); }
#ifdef SUNDISPLAY
keytrans = TR_UNTRANS_EVENT; /* keyboard does not encode key */
if (ioctl(LispKbdFd, KIOCTRANS, &keytrans) == -1) {
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
exit(-1);
}
close(LispKbdFd);
#ifdef KBINT
int_io_open(LispWindowFd); /* from init_dsp, try to prevent mouse-move-no-kbd bug */
#endif /* KBINT */
seteventmask(&LispEventMask);
#elif XWINDOW
#if XWINDOW
init_Xevent(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
if (flg == 0) { /* Install the handlers ONLY when we */
/* init the kbd the init the kbd the */
/* first time. */
/* turn on kbd */
make_kbd_instance(currentkbd);
(currentkbd->device.enter)(currentkbd);
/* turn on mouse */
make_mouse_instance(currentmouse);
(currentmouse->device.enter)(currentmouse, currentdsp);
}
#endif /* XWINDOW DOS */
}
/* ----------------------------------------------------------------*/
void device_before_exit() {
#ifdef SUNDISPLAY
int keytrans;
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1) {
fprintf(stderr, "can't open %s\n", LispScreen.scr_kbdname);
exit(-1);
}
keytrans = TR_EVENT; /* keyboard encodes key */
if (ioctl(LispKbdFd, KIOCTRANS, &keytrans) == -1) {
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
exit(-1);
}
close(LispKbdFd);
#endif /* SUNDISPLAY */
#if DOS
(currentmouse->device.exit)(currentmouse, currentdsp);
(currentkbd->device.exit)(currentkbd);
#endif /* SUNDISPLAY DOS*/
display_before_exit();
}
@@ -282,24 +265,6 @@ void set_kbd_iopointers() {
/* ----------------------------------------------------------------*/
#ifdef SUNDISPLAY
void seteventmask(struct inputmask *eventmask)
{
input_imnull(eventmask);
eventmask->im_flags |= IM_ASCII | IM_NEGASCII | IM_NEGEVENT;
win_setinputcodebit(eventmask, MS_LEFT);
win_setinputcodebit(eventmask, MS_MIDDLE);
win_setinputcodebit(eventmask, MS_RIGHT);
win_setinputcodebit(eventmask, LOC_MOVE);
win_unsetinputcodebit(eventmask, LOC_STILL);
win_unsetinputcodebit(eventmask, LOC_MOVEWHILEBUTDOWN);
win_unsetinputcodebit(eventmask, LOC_WINENTER);
win_unsetinputcodebit(eventmask, LOC_WINEXIT);
win_setinputmask(LispWindowFd, eventmask, eventmask, WIN_NULLLINK);
}
#endif /* SUNDISPLAY */
#define MIN_KEYTYPE 3
#define KB_AS3000J (7 + MIN_KEYTYPE)
@@ -307,7 +272,7 @@ void seteventmask(struct inputmask *eventmask)
#define KB_DEC3100 (9 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_HP9000 (10 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_X (11 + MIN_KEYTYPE)
#define KB_DOS (12 + MIN_KEYTYPE) /* TODO: Can we remove this? */
#define KB_DOS (12 + MIN_KEYTYPE)
/* KB_SUN4 not defined in older OS versions */
#ifndef KB_SUN4
@@ -378,7 +343,7 @@ static u_char *make_X_keymap() {
XDisplayKeycodes(currentdsp->display_id, &minkey, &maxkey);
codecount = maxkey + 1 - minkey;
mapping = XGetKeyboardMapping(currentdsp->display_id, minkey, codecount, &symspercode);
XUNLOCK;
XUNLOCK(currentdsp);
for (; *key_sym_pairs != -1;) {
int reusable = *key_sym_pairs++, code = *key_sym_pairs++, sym = *key_sym_pairs++, xcode;
@@ -465,11 +430,8 @@ void keyboardtype(int fd)
if ((key = getenv("LDEKBDTYPE")) == 0) {
#ifdef XWINDOW
type = KB_X;
#elif SUNDISPLAY
if (ioctl(fd, KIOCTYPE, &type) != 0) {
error("keyboardtype:IOCTL(KIOCTYPE) fails (cont. w. type-3");
type = KB_SUN3;
} /* otherwise, type is set */
#elif DOS
type = KB_DOS;
#endif /* XWINDOW */
} /* if end */
else {
@@ -522,6 +484,12 @@ void keyboardtype(int fd)
break;
#endif /* XWINDOW */
#ifdef DOS
case KB_DOS:
SUNLispKeyMap = DOSLispKeyMap_101;
InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE; /* 10 */
break;
#endif /* DOS */
default: {
char errmsg[200];
sprintf(errmsg, "Unsupported keyboard type: %d", type);

View File

@@ -20,9 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#ifndef DOS
#include <pwd.h>
#endif
#include "hdw_conf.h"
#include "lispemul.h"
@@ -141,12 +144,15 @@ void init_ifpage(int sysout_size) {
#endif /* BIGVM */
/* unfortunately, Lisp only looks at a 16 bit serial number */
#ifndef DOS
InterfacePage->serialnumber = 0xffff & gethostid();
#endif /* DOS */
/* get user name and stuff into vmem; this is the VMEM buffer;
This is a BCPL string -- it starts with a length count. C strings
are null terminated instead */
InterfacePage->usernameaddr = 0;
#ifndef DOS
{
struct passwd *pwd;
char *s;
@@ -170,6 +176,7 @@ are null terminated instead */
}
}
#endif /* DOS */
/* Days from Oct-13-87 12:00 It's Takeshi's birthday. */
/* MDate may be set by vdate.c, generated by mkvdate.c. */

39
src/kbdif.c Normal file
View File

@@ -0,0 +1,39 @@
/* $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;
#ifdef DOS
extern void Kbd_event();
extern void EnterDosKbd();
extern void ExitDosKbd();
extern unsigned long GenericReturnT();
#endif /* DOS */
void make_kbd_instance(KbdInterface kbd) {
#ifdef DOS
kbd->device_event = &Kbd_event; /* */
kbd->device.enter = &EnterDosKbd;
kbd->device.exit = &ExitDosKbd;
kbd->device.before_raid = &ExitDosKbd;
kbd->device.after_raid = &EnterDosKbd;
kbd->device.active = FALSE;
#elif XWINDOW
#endif /* DOS or XWINDOW */
}

View File

@@ -12,16 +12,16 @@
#include <errno.h>
#include <stdio.h>
#ifdef DOS
#include <time.h>
#include <conio.h>
#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/select.h>
#endif /* DOS */
#ifdef SUNDISPLAY
#include <sundev/kbd.h>
#include <sundev/kbio.h>
#include <sunwindow/window_hs.h>
#endif /* SUNDISPLAY */
#include "lispemul.h"
@@ -32,11 +32,16 @@
#include "xwinmandefs.h"
#endif
#if XWINDOW
#ifdef DOS
#define PORT_A 0x60
#include "devif.h"
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* XWINDOW */
#elif XWINDOW
#include "devif.h"
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
#endif /* DOS */
/****************************************************
*
@@ -45,9 +50,6 @@ extern DspInterface currentdsp;
*
****************************************************/
#ifdef SUNDISPLAY
extern struct screen LispScreen;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
#include <X11/Xlib.h>
@@ -62,17 +64,17 @@ void KB_enable(LispPTR *args) /* args[0] : ON/OFF flag
*/
{
if (args[0] == ATOM_T) {
#ifdef SUNDISPLAY
FD_SET(LispWindowFd, &LispReadFds);
#elif XWINDOW
#if XWINDOW
enable_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
(currentkbd->device.enter)(currentkbd);
#endif /* DOS */
} else if (args[0] == NIL) {
#ifdef SUNDISPLAY
FD_CLR(LispWindowFd, &LispReadFds);
#elif XWINDOW
#if XWINDOW
disable_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
(currentkbd->device.exit)(currentkbd);
#endif /* DOS */
} else {
error("KB_enable: illegal arg \n");
printf("KB_enable: arg = %d\n", args[0]);
@@ -92,36 +94,34 @@ struct timeval belltime ={
*/
extern int LispKbdFd;
#ifdef DOS
int bell_status_word;
#endif /* DOS */
void KB_beep(LispPTR *args) /* args[0] : ON/OFF flag
* T -- ON
* NIL -- OFF
* args[1] : frequency
*/
{
#ifdef SUNDISPLAY
int keycommand;
/* belltime.tv_usec = args[1] & 0xffff;
win_bell(LispWindowFd, belltime, 0);
*/
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1)
fprintf(stderr, "can't open %s, errno=%d\n", LispScreen.scr_kbdname, errno);
if (args[0] == ATOM_T) {
keycommand = KBD_CMD_BELL; /* Turn on the bell */
if (ioctl(LispKbdFd, KIOCCMD, &keycommand) == -1)
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
} else {
keycommand = KBD_CMD_NOBELL; /* Turn off the bell */
if (ioctl(LispKbdFd, KIOCCMD, &keycommand) == -1)
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
}
close(LispKbdFd);
#elif XWINDOW
#if XWINDOW
if (args[0] == ATOM_T) beep_Xkeyboard(currentdsp);
#endif /* SUNDISPLAY, XWINDOW */
#elif DOS
if (args[0] == ATOM_T) {
bell_status_word = inp(0x61);
outp(0x61, bell_status_word | 0x3); /* Turn on the speaker */
/* Prepare timer by sending 10111100 to port 43. */
outp(0x43, 0xb6);
/* Divide input frequency by timer ticks per second and
* write (byte by byte) to timer. */
outp(0x42, (char)(1193180L / (LispIntToCInt(args[1]))));
outp(0x42, (char)(1193180L / (LispIntToCInt(args[1])) >> 8));
} else {
outp(0x61, bell_status_word & ~0x3); /* Turn off the speaker (with */
/* bits 0 and 1). */
}
#endif /* SUNDISPLAY, XWINDOW, DOS */
}
/****************************************************
@@ -152,4 +152,9 @@ void KB_setmp(LispPTR *args) /* args[0] : MPCODE */
void KB_setled(LispPTR *args)
{
#ifdef DOS
outp(PORT_A, (unsigned char)0xED);
outp(PORT_A,
(unsigned char)(((args[0] != NIL) << 2) | ((args[1] != NIL) << 1) | (args[2] != NIL)));
#endif /* DOS */
}

View File

@@ -20,17 +20,25 @@
#include <signal.h>
#include <sys/types.h>
#include <string.h>
#ifndef DOS
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/time.h>
#if SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/window.h>
#include <ctype.h>
#include <sundev/kbio.h>
#endif /* SUNDISPLAY */
#else
#include <time.h>
#endif /* DOS */
#ifdef DOS
#include <i32.h> /* Defines "#pragma interrupt" */
#include <dos.h> /* Defines REGS & other structs */
#include <stk.h> /* _XSTACK struct definition */
#pragma interrupt(Mouse_hndlr)
void Mouse_hndlr(void); /* Fields mouse events from driver */
/* (during servicing of mouse interrupt) */
#endif /* DOS */
#include "lispemul.h"
#include "lspglob.h"
@@ -57,11 +65,11 @@
#endif /* MAIKO_ENABLE_ETHERNET */
#include "dbprint.h"
#if defined(XWINDOW)
#if (defined(DOS) || defined(XWINDOW))
#include "devif.h"
extern DspInterface currentdsp;
extern IOPAGE *IOPage68K;
#endif /* XWINDOW */
#endif /* DOS */
/* for contextsw */
#define AS_OPCODE 1
@@ -107,10 +115,11 @@ extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUti
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
extern u_char *SUNLispKeyMap;
extern int LispWindowFd;
extern int RS232C_Fd, RS232C_remain_data, XLocked;
extern int RS232C_Fd, RS232C_remain_data;
extern fd_set LispIOFds;
fd_set LispReadFds;
int XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
extern volatile sig_atomic_t XLocked;
extern volatile sig_atomic_t XNeedSignal;
extern int LogFileFd;
@@ -120,11 +129,9 @@ extern int ether_fd;
extern DLword *DisplayRegion68k;
#ifndef DOS
static struct timeval SelectTimeout = {0, 0};
#ifdef XWINDOW
extern volatile sig_atomic_t Event_Req;
#endif /* XWINDOW */
#endif /* DOS */
extern MISCSTATS *MiscStats;
LispPTR *LASTUSERACTION68k;
@@ -162,25 +169,6 @@ typedef struct {
/* EmXXXX68K are already swapped, no need for GETWORD */
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
#define TrackCursor(cx, cy) \
{ \
*CLastUserActionCell68k = MiscStats->secondstmp; \
*EmCursorX68K = cx; \
*EmCursorY68K = cy; \
}
#else
#define TrackCursor(cx, cy) \
{ \
*CLastUserActionCell68k = MiscStats->secondstmp; \
taking_mouse_down(); \
taking_mouse_up(cx, cy); \
*EmCursorX68K = cx; \
*EmCursorY68K = cy; \
}
#endif /* OLD_CURSOR */
#endif /* SUNDISPLAY */
/* commented out is some code that would also clobber
Irq_Stk_Check & Irq_Stk_End to force
@@ -195,7 +183,7 @@ LispPTR *MOUSECHORDTICKS68k;
/**NEW GLOBAL***-> will be moved***/
LispPTR *KEYBOARDEVENTQUEUE68k;
LispPTR *KEYBUFFERING68k;
int KBDEventFlg = NIL;
int KBDEventFlg = 0;
DLword *CTopKeyevent;
LispPTR DOBUFFEREDTRANSITION_index;
@@ -221,20 +209,12 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
/************************************************************************/
/* */
/* G E T S I G N A L D A T A */
/* */
/* Handler for the SIGIO interrupt, which happens */
/* 1. When a key transition happens */
/* 2. On mouse moves */
/* 3. When TCP input becomes available. */
/* 4. When a NIT ethernet packet becomes available. */
/* 5. When a console/log/stderr msg needs to be printed. */
/* */
/* */
/* */
/* */
/* */
/* p r o c e s s _ i o _ e v e n t s */
/* */
/* Periodically, or After a SIGIO interrupt which happens */
/* 1. When TCP input becomes available. */
/* 2. When a NIT ethernet packet becomes available. */
/* 3. When a console/log/stderr msg needs to be printed. */
/* */
/* */
/* Statics: LispReadFds A 32-bit vector with a 1 for each */
@@ -264,64 +244,16 @@ DLword ColorCursor_savebitmap[CURSORWIDTH / COLORPIXELS_IN_DLWORD * CURSORHEIGHT
/* */
/************************************************************************/
void getsignaldata(int sig)
void process_io_events()
{
#ifdef SUNDISPLAY
struct inputevent event;
#endif /* SUNDISPLAY */
fd_set rfds, efds;
#ifndef DOS
fd_set rfds;
u_int iflags;
int i;
#ifdef XWINDOW
#if defined(sun)
if (Event_Req) {
if (!XLocked++)
getXsignaldata(currentdsp);
else
XNeedSignal = 1;
Event_Req = FALSE;
XLocked--;
}
#endif
#endif /* XWINDOW */
/* #ifndef KBINT */
/* FD_COPY would be preferred but uses deprecated bcopy() on macOS. Why? */
memcpy(&rfds, &LispReadFds, sizeof(rfds));
memcpy(&efds, &LispReadFds, sizeof(efds));
/* label and ifs not needed if only keyboard on SIGIO */
getmore:
if (select(32, &rfds, NULL, &efds, &SelectTimeout) >= 0)
{
/* need to print out fd sets...
DBPRINT(("SIGIO: fd mask(r/e) = 0x%x/0x%x.\n", rfds, efds));
*/
#ifdef SUNDISPLAY
if (LispWindowFd >= 0 && FD_ISSET(LispWindowFd, &rfds)) {
/* #endif */
while (input_readevent(LispWindowFd, &event) >= 0) {
/*if(!kb_event( &event )) {goto getmore;};*/
if ((KBDEventFlg += kb_event(&event)) > 0) {
/* immediately request for IRQ check */
Irq_Stk_End = Irq_Stk_Check = 0;
}
}
/* #ifndef KBINT */
}
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (FD_ISSET(ConnectionNumber(currentdsp->display_id), &rfds)) {
if (!XLocked)
getXsignaldata(currentdsp);
else
XNeedSignal = 1;
}
#endif /* XWINDOW */
if (select(32, &rfds, NULL, NULL, &SelectTimeout) > 0) {
#ifdef MAIKO_ENABLE_ETHERNET
if (ether_fd >= 0 && FD_ISSET(ether_fd, &rfds)) { /* Raw ethernet (NIT) I/O happened, so handle it. */
@@ -360,134 +292,9 @@ getmore:
}
}
/* #endif */
} /* end getsignaldata */
#endif /* DOS */
} /* end process_io_events */
#ifdef SUNDISPLAY
/************************************************************************/
/* */
/* k b _ e v e n t */
/* */
/* Given an event from the kbd code, return 1 if a key transition */
/* occurred, 0 if one didn't occur. */
/* */
/************************************************************************/
extern int for_makeinit;
int kb_event(struct inputevent *event);
{
register u_int upflg;
int kn;
DLword w, r;
KBEVENT *kbevent;
#ifdef INIT
/* generate some code to check if we are running as an INIT. Don't
needlessly generate this code, and don't return if we aren't
running with the -INIT flag turned on. --was 2/7/89 */
if (for_makeinit) { return (0); };
#endif
upflg = event_is_up(event);
#ifdef SHOWKEYSTROKES
printf("Key # %d, upflg %d.\n", (unsigned short)event->ie_code, upflg);
#endif
switch (((unsigned short)event->ie_code)) {
case LOC_MOVE:
#ifndef OLD_CURSOR
if (!ScreenLocked)
#endif
{
ScreenLocked = T;
MouseMove(event->ie_locx, event->ie_locy);
TrackCursor(event->ie_locx, event->ie_locy);
ScreenLocked = NIL;
}
return (0);
case MS_LEFT: /*mouse_button( MOUSE_LEFT, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_LEFT, upflg);
break;
case MS_MIDDLE: /*mouse_button( MOUSE_MIDDLE, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_MIDDLE, upflg);
break;
case MS_RIGHT: /*mouse_button( MOUSE_RIGHT, upflg );*/
PUTBASEBIT68K(EmRealUtilin68K, MOUSE_RIGHT, upflg);
break;
default: /* keystroke */
if ((kn = SUNLispKeyMap[((unsigned short)event->ie_code)]) < 255)
kb_trans(kn, upflg);
else
printf("kb_event: unknown key number=%d\n", event->ie_code);
break;
};
{
do_ring:
/* Emxxx do not use GETWORD */
if (((*EmKbdAd268K) & 2113) == 0) { /*Ctrl-shift-NEXT*/
error("****** EMERGENCY Interrupt ******");
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
} else if (((*EmKbdAd268K) & 2114) == 0) { /* Ctrl-Shift-DEL */
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
URaid_req = T;
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
}
#ifdef OS4_TYPE4BUG
else if (((*EmKbdAd268K) & 2120) == 0) { /* Ctrl-Shift-Return */
error("****** EMERGENCY Interrupt ******");
(*EmKbdAd268K) = KB_ALLUP; /*reset*/
((RING *)CTopKeyevent)->read = 0; /* reset queue */
((RING *)CTopKeyevent)->write = MINKEYEVENT;
/*return(0);*/
}
#endif
r = RING_READ(CTopKeyevent);
w = RING_WRITE(CTopKeyevent);
if (r == w) goto KBnext; /* event queue FULL */
kbevent = (KBEVENT *)(CTopKeyevent + w);
/* RCLK(kbevent->time); */
kbevent->W0 = (*EmKbdAd068K); /* Emxxxx do not use GETWORD */
kbevent->W1 = (*EmKbdAd168K);
kbevent->W2 = (*EmKbdAd268K);
kbevent->W3 = (*EmKbdAd368K);
kbevent->W4 = (*EmKbdAd468K);
kbevent->W5 = (*EmKbdAd568K);
kbevent->WU = (*EmRealUtilin68K);
if (r == 0) /* Queue was empty */
((RING *)CTopKeyevent)->read = w;
if (w >= MAXKEYEVENT)
((RING *)CTopKeyevent)->write = MINKEYEVENT;
else
((RING *)CTopKeyevent)->write = w + KEYEVENTSIZE;
KBnext:
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
} /* if *EmRealUtilin68K end */
return (1);
}
#endif /* SUNDISPLAY */
/************************************************************************/
/* */
@@ -562,6 +369,9 @@ void taking_mouse_down() {
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;
#ifdef DOS
(currentdsp->mouse_invisible)(currentdsp, IOPage68K);
#else
if (!DisplayInitialized) return;
/* restore saved image */
@@ -578,6 +388,7 @@ void taking_mouse_down() {
#ifdef DISPLAYBUFFER
flush_display_region(dx, (LastCursorY), w, h);
#endif /* DISPLAYBUFFER */
#endif /* DOS */
}
#else
@@ -711,6 +522,9 @@ void copy_cursor(int newx, int newy)
/* I'll make it MACRO */
void taking_mouse_up(int newx, int newy)
{
#ifdef DOS
(currentdsp->mouse_visible)(newx, newy);
#else
if (!DisplayInitialized) return;
/* save hidden bitmap */
cursor_hidden_bitmap(newx, newy);
@@ -720,6 +534,7 @@ void taking_mouse_up(int newx, int newy)
#endif
LastCursorX = newx;
LastCursorY = newy;
#endif
}
/* store bitmap image inside rect. which specified by x,y */

358
src/launch.asm Normal file
View File

@@ -0,0 +1,358 @@
;; # @(#) launch.asm Version 1.1 (12/29/94). Copyright Venue #
;************************************************************************
;* *
;* l a u n c h . a s m *
;* *
;* This is the launcher for Medley on DOS. It: *
;* *
;* * Looks for and validates any -m memsize argument on the *
;* command line. Only values in the range 8 - 32 are allowed. *
;* *
;* * Loads the real Medley emulator, emul.exe, from the same *
;* directory that the launcher came from. *
;* *
;* * Sets the Intel DOS Extender's profile to the requested *
;* memory size + 3Mb (to allow for the emulator, internal *
;* data areas, etc.) *
;* *
;* * Set the termination address in the child process's PSP, *
;* so control returns to the launcher when Medley terminates. *
;* *
;* * Jumps to the emulator's start address. *
;* *
;* * Upon return, just terminates cleanly. *
;* *
;* [We could perhaps do some diagnosis here of error returns?] *
;* *
;* *
;* *
;************************************************************************
;************************************************************************/
;* */
;* (C) Copyright 1993, 1994 Venue. All Rights Reserved. */
;* Manufactured in the United States of America. */
;* */
;************************************************************************/
.model small
.386p
.stack 100h
.data
align 8
;********************************************************
;* Parameter block for INT 214B, that loads medley.exe *
;********************************************************
envseg DW 0 ; environment (0 = copy mine)
cmdip DW ? ; command-line-tail pointer
cmdcs DW ?
fcb1 DD ? ; dummy first FCB to fill in
fcb2 DD ? ; " 2nd FCB, not here in DOS 4.01???
stk DD ? ; SS:SP for emul.exe, filled in by loader
csip DD ? ; start addr for emul.exe, filled in by loader
retad DD FAR PTR myret ; cs:ip return address, to put in
; child PSP, so we get control back.
;* Error messages, misc strings, and work areas*
align 8
memval dd 0
errstg DB 'ERROR: Couldn''t free excess storage.',13,10,'$'
noload db 'ERROR: Loading emulator failed: $'
loaded db 'LOAD SUCCESSFUL.',13,10,'$'
nominfo db 'ERROR: -m must be followed by a number 8 - 64.',13,10,'$'
badexe db 'ERROR: emul.exe is corrupted.',13,10,'$'
emulpath DB 'emul.exe',0 ; name of the real emulator.
mflag db '-m' ; to search for -m/-M in cmd line
mmflag db '-M'
profile db 'PRO' ; to find the DOS extender profile
cmdline db 128 dup (?) ; hold the cmd line tail for real emulator
;* Error-message table for failures loading emul.exe
align 2
errtbl dw OFFSET ng0msg ; 0 = unknown failure
dw OFFSET ng1msg ; 1 = "invalid function"
dw OFFSET ng2msg ; 2 = file not found
dw OFFSET ng3msg ; 3 = path not found
dw OFFSET ng4msg ; 4 = too many open files
dw OFFSET ng5msg ; 5 = access denied
dw OFFSET ng0msg ; 6 = not possible error
dw OFFSET ng0msg ; 7 = not possible error
dw OFFSET ng8msg ; 8 = insufficient storage
dw OFFSET ng0msg ; 9 = not possible
dw OFFSET ngamsg ; A = bad environment
dw OFFSET ngbmsg ; B = bad format (corrupt .exe?)a
ng0msg db 'Unknown problem',13,10,'$'
ng1msg db 'Invalid Function',13,10
db 'Make sure you are running DOS 4.0 or later.',13,10,'$'
ng2msg db 'File not found.',13,10
db 'CD to proper directory, or set PATH.',13,10,'$'
ng3msg db 'Path not found.',13,10
db 'CD to proper directory, or set PATH.',13,10,'$'
ng4msg db 'Too many files open.',13,10
db 'Shut down some TSRs that have file open?',13,10,'$'
ng5msg db 'Access denied.',13,10
db 'Make sure of your access rights to emul.exe?',13,10,'$'
ng8msg db 'Not enough memory.',13,10
db 'Shut down some TSR applications?',13,10,'$'
ngamsg db 'Environment corrupt.',13,10
db 'Check using SET; You may need to re-boot.',13,10,'$'
ngbmsg db 'EXE file corrupted.',13,10,'$'
db 'You may need to restore from backup or re-install.',13,10,'$'
.code
;************************************************************************
;* *
;* M A C R O S *
;* *
;* prints Given a string ptr in DX, print it to the display. *
;* *
;* kill Exit cleanly, using INT 21/4C *
;* *
;************************************************************************
prints macro text
mov dx, OFFSET text
mov ah,9
int 21h
endm
kill macro
mov ah,4ch
int 21h
endm
;************************************************************************
;* *
;* M A I N E N T R Y *
;* *
;* *
;* *
;* *
;* *
;************************************************************************
PUBLIC main
main PROC NEAR
mov ax,ds ; Save memory-block start for freeing
mov es,ax ; excess memory in a bit.
mov ax,@data ; DS points to start of data segment
mov ds,ax
mov cmdcs, ax ; Copy the command line for the emulator
mov cmdip, OFFSET cmdline
mov di, OFFSET cmdline
mov cx,128
mov bx,es
mov dx,ds
mov es,dx
mov ds,bx
mov si,80h
rep
movsb
mov es,bx ; Free the excess memory that DOS gives
mov ds,dx ; us (we need it for the emulator)
mov ax,4a00h
mov bx,090h ; We only need 900h bytes for this program
int 21h
jnc freeok
prints errstg ; Couldn't free spare space; punt.
kill
;************************************************
;* Search the command line for -m or -M *
;************************************************
freeok:
mov di,81h ; start of command line tail
mov si, OFFSET mflag
mov cx, 2
mov bx,81h
add bl,es:[80h]
m1lp: call strcmp
je fndm
add di, 1
cmp di, bx
jl m1lp
mov di,81h ; start of command line tail
mov si, OFFSET mmflag
m2lp: call strcmp
je fndm
add di, 1
cmp di, bx
jl m2lp
mov memval,02400000h ; memory value not set--use 35MB total.
jmp doload
fndm: add di,2 ; Found "-m". Now look for a number
cmp di,bx ; (Make sure it's not end of line)
jnl nogoodm
ok1:
mov edx, 0 ; Holds the memory-requirement value
mov ax,0 ; holds characters as we read
;************************************************
;* Skip over spaces/tabs before any number *
;************************************************
skiplp:
mov al, es:[di]
inc di
cmp al, 20h ; spaces
je skiplp
cmp al, 09h ; tabs
je skiplp
cmp di,bx ; make sure we're still in the string
jle cnvst ; Yup, we've got the first char, so enter
; the conversion loop part-way down.
nogoodm:
prints nominfo ; no arg to -m, or it's bad; Punt.
kill
;********************************************************
; Convert the numeric argument to -m; result in edx. *
;********************************************************
cnvlp: mov al,es:[di]
add di, 1
cnvst: cmp al, 30h
jl endcnv
cmp al, 39h
jg endcnv
sub al, 30h
imul dx, 10
add dx, ax
jmp cnvlp
endcnv:
cmp edx,0 ; if still 0, no valid chars!
je nogoodm
cmp edx, 8 ; must be in the range [8, 32]
jl nogoodm
cmp edx,64
jg nogoodm
add edx, 3 ; add 3mb for data areas, etc, and
sal edx, 20 ; convert to megabytes
mov memval, edx ; save memory requested
;************************************************
;* Load the real emulator .EXE file, emul.exe *
;************************************************
doload: mov dx, OFFSET emulpath
mov ax, seg envseg
mov es, ax
mov bx, OFFSET envseg
mov ax,4b01h ; load-don't-start
int 21h
jnc loadok
add ax,ax
mov si,ax
prints noload
mov bx,OFFSET errtbl
mov dx,ds:[bx+si]
mov ah,9
int 21h
kill
loadok: ; Load succeeded.
mov ah,51h ; get PSP address for child
int 21h
mov es, bx ; get segment for DI addressing
; mov cx,128 ; copy the command line tail
; mov di,80h ; (which appears to be flaky in DOS 4)
; mov si, offset cmdline
; rep
; movsb
mov eax,retad
mov dword ptr es:[+0ah], eax ; set up return address.
cmp memval, 0 ; If no -m value given, just
je dorun ; go start the emulator.
mov di,0 ; Search for the Intel Extender's PROFILE
mov si, OFFSET profile ; (see extender.h)
mov cx, 3 ; (length is 3 bytes)
srchlp: call strcmp
je gotprof ; found the profile; fix it.
add di, 1
cmp di, 2048
jle srchlp
prints badexe ; No extender profile, so the emulator
kill ; EXE must be corrupt. Punt.
gotprof:
mov eax,memval ; Fill in the memory requirement.
mov es:[di+1bch], eax
;********************************************************
;* *
;* Set up the stack seg/pointer & start medley. *
;* *
;********************************************************
dorun: lss sp,stk ; load stack SS & SP regs
mov ax, es ; copy PSP ptr to ax & ds, since some
mov bx, ds ; code expects it in both places.
mov fs,bx ; Also, copy DS to FS, so we still have
mov ds,ax ; a base for the indirect jump . . .
jmp fs:[csip] ; to start-of-medley.
myret: kill ; we get back here, so quit gracefully.
main endp
;************************************************************************/
;* */
;* s t r c m p */
;* */
;* Compare [ds]di and es:[si] for (CX) characters. If the */
;* strings are equal, the Zero flag is set when this returns. */
;* */
;* All registers are preserved. */
;* */
;************************************************************************/
strcmp proc near
cld
push di
push si
push cx
repe
cmpsb
pop cx
pop si
pop di
ret
strcmp endp
END

View File

@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();

View File

@@ -30,9 +30,6 @@
#include "byteswapdefs.h"
#include "initdspdefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
#define IFPAGE_ADDRESS 512
#define DEFAULT_MAX_SYSOUTSIZE 64 /* in Mbyte */
@@ -50,10 +47,10 @@ int Storage_expanded; /* T or NIL */
/* Load the sysout file into memory. */
/* */
/************************************************************************/
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
/* sys_size is sysout size in megabytes */
int sysout_loader(const char *sysout_file_name, int sys_size) {
@@ -153,10 +150,16 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
"\nsysout loader: Error, secondary space in use. You can't specify size.\nProcess "
"size = %d\nSys size = %d\n",
ifpage.process_size, sys_size);
#ifdef DOS
/* Note that we have an initialized display by now. */
/* Hence we have to observe the display protocol. */
VESA_errorexit(tmp);
#else
fprintf(stderr, "sysout_loader: You can't specify the process size.\n");
fprintf(stderr, "Because, secondary space is already used.\n");
fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size);
exit(-1);
#endif /* DOS */
}
/*Can use this sys_size as the process size */
/* The sys_size should be same as the previous one */
@@ -273,6 +276,28 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
/* read sysout file to lispworld */
for (i = 0; i < (sysout_size / 2); i++) {
#ifdef DOS
/* Dial that floats from left to right on the top line of the */
/* displaty. Dial shows % of sysout loaded by digits and */
/* position. */
int columns;
switch (currentdsp->graphicsmode) {
case 0x104:
columns = 120; /* 131 - 10 */
break;
case 0x102:
columns = 69; /* 79 - 10 */
break;
default:
columns = 69; /* 79 - 10 */
break;
}
_settextposition((short)0, (short)0);
if ((i & 0xf) == 0) {
for (int j = 0; j < (columns * i) / (sysout_size >> 1); j++) putchar(' ');
printf("-=(%2d%%)=-\n", (100 * i) / (sysout_size >> 1));
}
#endif /* DOS */
if (GETPAGEOK(fptovp, i) != 0177777) {
if (lseek(sysout, i * BYTESPER_PAGE, SEEK_SET) == -1) {
perror("sysout_loader: can't seek sysout file");
@@ -299,11 +324,11 @@ int sysout_loader(const char *sysout_file_name, int sys_size) {
free(fptovp);
DBPRINT(("sysout file is read completely.\n"));
#if defined(DISPLAYBUFFER) || defined(XWINDOW)
#if (defined(DISPLAYBUFFER) || defined(XWINDOW) || defined(DOS))
TPRINT(("Flushing display buffer...\n"));
flush_display_buffer();
TPRINT(("After Flushing display buffer\n"));
#endif /* DISPLAYBUFFER || XWINDOW */
#endif /* DISPLAYBUFFER || XWINDOW || DOS */
close(sysout);
return (sys_size);

View File

@@ -12,15 +12,6 @@
#include <stdio.h>
#if defined(COLOR) && !defined(NOPIXRECT)
#include <sunwindow/window_hs.h>
#include <sunwindow/cms.h>
#include <sunwindow/win_ioctl.h>
#include <pixrect/pixrect_hs.h>
#include <sun/fbio.h>
#include <pixrect/pr_planegroups.h>
#include <sys/mman.h>
#endif /* COLOR && !NOPIXRECT */
#include <sys/ioctl.h>
#include <sys/types.h>

View File

@@ -482,9 +482,6 @@ extern struct cursor CurrentCursor;
void flip_cursorbar(int n)
{
GETWORD(EmCursorBitMap68K + n) = ~(GETWORD(EmCursorBitMap68K + n));
#ifdef SUNDISPLAY
win_setcursor(LispWindowFd, &CurrentCursor);
#endif /* SUNDISPLAY */
#ifdef XWINDOW
/* JDS 011213 When using current_hot_y, remember fn does 15-it! */

View File

@@ -16,8 +16,15 @@
#include "lispemul.h"
#ifdef DOS
#include "devif.h"
#endif /* DOS */
extern int KBDEventFlg;
extern int *KEYBUFFERING68k;
#ifdef DOS
extern MouseInterface currentmouse;
#endif /* DOS */
/* Globals used by solver */
short JustInverted;
@@ -935,6 +942,10 @@ int milpsolve(sstate *st, REAL *upbo, REAL *lowbo, short *sbasis, short *slower,
return (TIMEOUT); /* Time out every 100 LP solves */
else if ((KBDEventFlg > 0) && *KEYBUFFERING68k == ATOM_T)
return (TIMEOUT); /* Time out on key/mouse clicks */
#ifdef DOS
else if (currentmouse->Cursor.Moved)
return (TIMEOUT); /* Time out if mouse moves in DOS */
#endif /* DOS */
if (Break_bb) return (BREAK_BB);
Level++;

View File

@@ -25,9 +25,15 @@
#include <sys/types.h>
#include <time.h>
#ifndef DOS
#include <pwd.h>
#include <sys/param.h>
#include <unistd.h>
#else /* DOS */
#include <i32.h>
#define MAXPATHLEN 128
#define R_OK 04
#endif /* DOS */
#ifdef MAIKO_ENABLE_ETHERNET
#if defined(USE_NIT)
@@ -242,15 +248,38 @@ int sysout_size = 0; /* ditto */
int flushing = FALSE; /* see dbprint.h if set, all debug/trace printing will call fflush(stdout) after each printf */
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
extern time_t MDate;
extern int nokbdflag;
extern int nomouseflag;
#if XWINDOW
#ifdef DOS
extern void dispatch();
int dosdisplaymode = 0;
int twobuttonflag = FALSE;
int eurokbd = TRUE; /* Assume eurokbd by default. */
const char *helpstring =
"\n\
medley [sysout-name] [<options>] ...\n\
Where <options> are:\n\
sysout-name The filename of your sysout.(see manual.)\n\
-m <size> Virtual memory size in Mega Bytes(from 8 to 32)\n\
-vga Use standard VGA 640x480 screen resolution\n\
-vesa102 Use VESA 800x600 screen resolution\n\
-vesa104 Use VESA 1024x768 screen resolution\n\
-2button Force two button mouse handling\n\
-3button Force three button mouse handling\n\
-noeurokbd Force old style kbd handling (for 2.0 and earlier sysouts)\n\
-eurokbd Force new style kbd handling (for 2.01 and later sysouts)\n\
-nokbd Turn the kbd handling off (for debugging only)\n\
-nomouse Turn the mouse handling off (for debugging only)\n\
-info Print general info about the system\n\
-help Print this message\n";
#elif XWINDOW
const char *helpstring =
"\n\
either setenv LDESRCESYSOUT or do:\n\
@@ -261,14 +290,14 @@ const char *helpstring =
-bw <pixels> The Medley screen borderwidth\n\
-g[eometry] <geom>] The Medley screen geometry\n\
-sc[reen] <w>x<h>] The Medley screen geometry\n";
#else /* not XWINDOW */
#else /* not DOS, not XWINDOW */
const char *helpstring =
"\n\
either setenv LDESRCESYSOUT or do:\n\
lde[ether] [sysout-name] [<options>]\n\
-info Print general info about the system\n\
-help Print this message\n";
#endif /* XWINDOW */
#endif /* DOS */
/************************************************************************/
/* */
@@ -331,7 +360,11 @@ int main(int argc, char *argv[])
strncpy(sysout_name, envname, MAXPATHLEN);
} else if ((envname = getenv("LDESOURCESYSOUT")) != NULL)
strncpy(sysout_name, envname, MAXPATHLEN);
#ifdef DOS
else if (!makepathname("lisp.vm", sysout_name)
#else
else if (!makepathname("~/lisp.virtualmem", sysout_name)
#endif /* DOS */
|| access(sysout_name, R_OK)) {
fprintf(stderr, "Couldn't find a sysout to run;\n");
fprintf(stderr, "%s", helpstring);
@@ -368,6 +401,28 @@ int main(int argc, char *argv[])
else if (!strcmp(argv[i], "-INIT")) { /*** init sysout, no packaged */
for_makeinit = 1;
}
#ifdef DOS
else if ((strcmp(argv[i], "-vga") == 0) || (strcmp(argv[i], "-VGA") == 0)) {
dosdisplaymode = 1;
} else if ((strcmp(argv[i], "-vesa102") == 0) || (strcmp(argv[i], "-VESA102") == 0)) {
dosdisplaymode = 0x102;
} else if ((strcmp(argv[i], "-vesa104") == 0) || (strcmp(argv[i], "-VESA104") == 0)) {
dosdisplaymode = 0x104;
} else if ((strcmp(argv[i], "-2button") == 0) || (strcmp(argv[i], "-2BUTTON") == 0)) {
twobuttonflag = TRUE;
} else if ((strcmp(argv[i], "-3button") == 0) || (strcmp(argv[i], "-3BUTTON") == 0)) {
twobuttonflag = FALSE;
} else if ((strcmp(argv[i], "-noeurokbd") == 0) || (strcmp(argv[i], "-NOEUROKBD") == 0)) {
eurokbd = FALSE;
} else if ((strcmp(argv[i], "-eurokbd") == 0) || (strcmp(argv[i], "-EUROKBD") == 0)) {
eurokbd = TRUE;
} else if ((strcmp(argv[i], "-nokbd") == 0) || (strcmp(argv[i], "-NOKBD") == 0)) {
nokbdflag = TRUE;
} else if ((strcmp(argv[i], "-nomouse") == 0) || (strcmp(argv[i], "-NOMOUSE") == 0)) {
nomouseflag = TRUE;
}
#endif /* DOS */
/* Can only do this under SUNOs, for now */
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/
@@ -408,10 +463,14 @@ int main(int argc, char *argv[])
}
/* Sanity checks. */
#ifdef DOS
probemouse(); /* See if the mouse is connected. */
#else
if (getuid() != geteuid()) {
fprintf(stderr, "Effective user is not real user. Setting euid to uid.\n");
seteuid(getuid());
}
#endif /* DOS */
FD_ZERO(&LispReadFds);
@@ -419,6 +478,9 @@ int main(int argc, char *argv[])
init_ether(); /* modified by kiuchi Nov. 4 */
#endif /* MAIKO_ENABLE_ETHERNET */
#ifdef DOS
init_host_filesystem();
#else
/* Fork Unix was called in kickstarter; if we forked, look up the */
/* pipe handles to the subprocess and set them up. */
@@ -426,10 +488,11 @@ int main(int argc, char *argv[])
{ /* in case we're re-starting a savevm w/open ptys */
if (please_fork) fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n");
}
#endif /* DOS */
#if defined(XWINDOW)
#if defined(DOS) || defined(XWINDOW)
make_dsp_instance(currentdsp, 0, 0, 0, 1); /* All defaults the first time */
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
/* Load sysout to VM space and returns real sysout_size(not 0) */
sysout_size = sysout_loader(sysout_name, sysout_size);
@@ -454,9 +517,6 @@ int main(int argc, char *argv[])
/* Get OS message to ~/lisp.log and print the message to prompt window */
if (!for_makeinit) {
#ifdef SUNDISPLAY
mess_init();
#endif /* SUNDISPLAY */
init_keyboard(0); /* can't turn on the keyboard yet or you will die
in makeinit. Pilotbitblt will turn it on if
@@ -464,6 +524,13 @@ int main(int argc, char *argv[])
JDS -- 1/18/90 also BITBLTSUB does it now. */
}
#ifdef DOS
_setrealmode(0x3f); /* Don't interrupt on FP overflows */
_getrealerror();
tzset();
#endif
#ifdef OS5
tzset();
#endif /* OS5 */
@@ -519,6 +586,9 @@ void start_lisp() {
/* entering the bytecode dispatch loop; interrupts get */
/* unblocked here */
int_init();
#ifdef DOS
_dpmi_lockregion((void *)&dispatch, 32768);
#endif /* DOS */
dispatch();
}
@@ -565,12 +635,18 @@ int makepathname(char *src, char *dst)
ERRSETJMP(0);
if (*(base + 1) == '/') {
/* path is "~/foo" */
#ifdef DOS
pwd = 0;
#else
TIMEOUT(pwd = getpwuid(getuid()));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;
return (0);
}
#ifndef DOS
sprintf(dst, "%s%s", pwd->pw_dir, base + 1);
#endif
return (1);
} else {
/* path is "~foo/" */
@@ -580,12 +656,16 @@ int makepathname(char *src, char *dst)
len = (UNSIGNED)cp - (UNSIGNED)base - 1;
strncpy(name, base + 1, len);
name[len] = '\0';
#ifndef DOS
TIMEOUT(pwd = getpwnam(name));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;
return (0);
}
#ifndef DOS
sprintf(dst, "%s%s", pwd->pw_dir, cp);
#endif /* DOS */
return (1);
}
}

View File

@@ -12,7 +12,9 @@
/* misc7.c
*/
#include <stdio.h>
#ifndef DOS
#include <sys/ioctl.h>
#endif /* DOS */
#include "lispemul.h"
#include "lspglob.h"
#include "adr68k.h"
@@ -30,15 +32,6 @@
#include "bbtsubdefs.h"
#include "initdspdefs.h"
#ifdef SUNDISPLAY
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <suntool/sunview.h>
#include <signal.h>
#include <sunwindow/cms_mono.h>
#include <suntool/canvas.h>
#endif
/*************************************************/
/* Possible operation fields for FBITMAPBIT */
@@ -76,9 +69,6 @@ LispPTR N_OP_misc7(LispPTR arg1, LispPTR arg2, LispPTR arg3, LispPTR arg4, LispP
DBPRINT(("MISC7 args OK.\n"));
displayflg = n_new_cursorin(base, x, (heightminus1 - y), 1, 1);
#ifdef SUNDISPLAY
if (displayflg) HideCursor;
#endif /* SUNDISPLAY */
/* Bitmaps use a positive integer coordinate system with the lower left
corner pixel at coordinate (0, 0). Storage is allocated in 16-bit words
@@ -98,15 +88,6 @@ LispPTR N_OP_misc7(LispPTR arg1, LispPTR arg2, LispPTR arg3, LispPTR arg4, LispP
default: GETWORDBASEWORD(base, offset) = bmdata | bmmask;
};
#ifdef SUNDISPLAY
#ifdef DISPLAYBUFFER
if (in_display_segment(base)) {
/* NB: base + offset doesn't need WORDPTR() wrapper */
flush_display_ptrregion(base + offset, 0, 16, 1);
}
#endif
if (displayflg) ShowCursor;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
if (in_display_segment(base)) {

View File

@@ -41,6 +41,9 @@
#include "allocmdsdefs.h"
#include "commondefs.h"
#include "gchtfinddefs.h"
#ifdef DTDDEBUG
#include "testtooldefs.h"
#endif
static LispPTR oldoldfree;
static LispPTR oldfree;
@@ -155,45 +158,3 @@ retry:
}
} /* createcell68k end */
/**********************************************************/
/* Create a Cell of Specified Type & Set to given Value */
/* Works with 32 bit typed values only. */
/* (Initially used only by native code) */
/**********************************************************/
LispPTR Create_n_Set_Cell(unsigned int type, LispPTR value) {
register struct dtd *dtd68k;
register DLword *ptr, *lastptr;
register LispPTR newcell;
dtd68k = (struct dtd *)GetDTD(type);
if (dtd68k->dtd_size == 0) error("createcell : Attempt to create a cell not declared yet");
retry:
if ((newcell = (dtd68k->dtd_free & POINTERMASK)) != NIL) {
ptr = Addr68k_from_LADDR(newcell);
/* replace dtd_free with newcell's top DLword (it may keep next chain)*/
dtd68k->dtd_free = (*((LispPTR *)ptr)) & POINTERMASK;
dtd68k->dtd_oldcnt++;
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
/* clear 0 */
for (lastptr = ptr + dtd68k->dtd_size; ptr != lastptr; ptr++) { GETWORD(ptr) = 0; }
/* IncAllocCnt(1); */
GCLOOKUP(newcell, DELREF);
(*((LispPTR *)Addr68k_from_LADDR(newcell))) = value;
return (newcell);
} else {
dtd68k->dtd_free = initmdspage(alloc_mdspage(dtd68k->dtd_typeentry), dtd68k->dtd_size, NIL);
if (dtd68k->dtd_free & 0x8000000) error("bad entry on free chain.");
goto retry;
}
} /* createcell68k end */

View File

@@ -33,8 +33,18 @@
#include <stdio.h>
#include <time.h>
#ifndef DOS
#include <sys/time.h>
#endif /* DOS */
#ifdef DOS
int main(void) {
long dtime;
time(&dtime);
printf("long MDate= %ld;\n", dtime);
return (0);
}
#else
/* Version for every other Unix */
int main(void) {
struct timeval time;
@@ -50,3 +60,4 @@ int main(void) {
return (0);
}
#endif /* DOS */

121
src/mouseif.c Normal file
View File

@@ -0,0 +1,121 @@
/* $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;
#ifdef DOS
#include <dos.h>
int nomouseflag = FALSE;
extern DLword *Lisp_world;
extern LispPTR *LASTUSERACTION68k;
extern int twobuttonflag;
extern void EnterDosMouse();
extern void ExitDosMouse();
extern void DosMouseAfterRaid();
extern void DosMouseBeforeRaid();
extern unsigned long GenericReturnT();
extern void ThreeButtonHandler();
extern void TwoButtonHandler();
#endif /* DOS */
#ifdef DOS
/*****************************************************************/
/* p r o b e m o u s e */
/* */
/* Probe for mouse and return the number of buttons available. */
/*****************************************************************/
int probemouse() {
union REGS regs;
char c;
/***************************************************************************
* Reset mouse driver, exit if no mouse driver present
***************************************************************************/
/* int 33h, case 0000, ax = drive installed, bx = # of buttons. */
if (nomouseflag) {
return (666); /* return something, why not 666? */
} else {
regs.w.eax = 0; /* Func 0 = Reset mouse, ret. button info */
int86(0x33, &regs, &regs);
if (regs.x.ax == 0x0000) VESA_errorexit("No mouse driver found.", -1);
return (regs.x.bx);
}
}
#endif
void make_mouse_instance(MouseInterface mouse)
{
#ifdef DOS
int NumberOfButtons;
if (nomouseflag) {
mouse->device.enter = &GenericReturnT;
mouse->device.exit = &GenericReturnT;
mouse->device.before_raid = &GenericReturnT;
mouse->device.after_raid = &GenericReturnT;
mouse->device.active = FALSE;
NumberOfButtons = 3;
} else {
mouse->device.enter = &EnterDosMouse;
mouse->device.exit = &ExitDosMouse;
mouse->device.before_raid = &DosMouseBeforeRaid;
mouse->device.after_raid = &DosMouseAfterRaid;
mouse->device.active = FALSE;
NumberOfButtons = probemouse();
}
mouse->Button.StartTime = 2;
mouse->Cursor.Last.width = 16;
mouse->Cursor.Last.height = 16;
if (nomouseflag == FALSE) {
if (twobuttonflag) { /* We force two button handling. */
mouse->Handler = &TwoButtonHandler;
mouse->Button.TwoButtonP = TRUE;
} else /* Determine how many buttons we have. */
switch (NumberOfButtons) {
case 0x0000: /* Other than 2 buttons, assume three */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0x0002: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
case 0x0003: /* Three buttons. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0xffff: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
default: /* Strange case, assume three. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
}
}
/* mouse->timestamp = ((*LASTUSERACTION68k& 0xffffff) + Lisp_world); */
#elif XWINDOW
#endif /* DOS or XWINDOW */
}

View File

@@ -28,14 +28,12 @@
#include "lsptypes.h"
#include "opcodes.h"
#include "cell.h"
#include "byteswapdefs.h"
#include "mvsdefs.h"
#include "car-cdrdefs.h"
#include "conspagedefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif /* GCC386 */
/* to optionally swap the fnhead field of a frame */
#ifdef BIGVM

View File

@@ -168,7 +168,8 @@ void contextsw(register DLword fxnum, register DLword bytenum, register DLword f
CHECKFX;
if (EndSTKP < CurrentStackPTR) error("contextsw:Illegal ESP");
#endif
FastRetCALL return;
FastRetCALL;
return;
}
} /* end contextsw */

View File

@@ -18,6 +18,7 @@
/* */
/************************************************************************/
#ifndef DOS
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
@@ -29,6 +30,7 @@
#include <netdb.h>
#include <errno.h>
#include <string.h> /* for memset/memcpy */
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
#include "lsptypes.h"
@@ -46,6 +48,7 @@
LispPTR rpc(LispPTR *args)
{
#ifndef DOS
/* Arguments are:
args[0]:Destination Address; hostname or internet address are both supported.
args[1]:Remote port for this program.
@@ -191,4 +194,5 @@ getbuf:
*/
handle_error:
return (NIL_PTR);
#endif /* DOS */
}

View File

@@ -253,7 +253,7 @@ rs232c_read() {
}
} else {
/*
* SIGIO handler getsignaldata and the successive
* SIGIO handler, process_io_events, and the successive
* rs232c_read has been called before Lisp prepares
* the next buffer. Turn on RS232C_remain_data to
* specify to read the remaining data after.

View File

@@ -515,7 +515,9 @@ void OP_subrcall(int subr_no, int argnum) {
/* Communications with Unix Subprocess */
case sb_UNIX_HANDLECOMM: POP_SUBR_ARGS;
#ifndef DOS
TopOfStack = Unix_handlecomm(args);
#endif /* DOS */
break;
/*

View File

@@ -1241,8 +1241,6 @@ void dtd_chain(DLword type) {
} /* dtd_chain end **/
#ifdef DTDDEBUG
void check_dtd_chain(DLword type)
{
register LispPTR next, onext;
@@ -1270,8 +1268,6 @@ void check_dtd_chain(DLword type)
}
}
#endif
/************************************************************************/
/* */
/* T R A C E _ F N C A L L */

View File

@@ -28,8 +28,22 @@
#include <time.h>
#include <unistd.h>
#ifdef DOS
#include <dos.h>
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
/******************************************************************************
* Global variables
******************************************************************************/
void (*prev_int_1c)(); /* keeps address of previous 1c handlr*/
/* used for chaining & restore at exit*/
#pragma interrupt(DOStimer)
void DOStimer();
unsigned long tick_count = 0; /* approx 18 ticks per sec */
#else /* DOS */
#include <sys/resource.h>
#include <sys/time.h>
#endif /* DOS */
#if defined(USE_DLPI)
#include <stropts.h>
@@ -73,9 +87,7 @@ extern DspInterface currentdsp;
int TIMEOUT_TIME; /* For file system timeout */
#ifdef XWINDOW
volatile sig_atomic_t Event_Req = FALSE;
#endif /* XWINDOW */
volatile sig_atomic_t IO_Signalled = FALSE;
static int gettime(int casep);
@@ -90,6 +102,18 @@ static int gettime(int casep);
/************************************************************************/
void update_miscstats() {
#ifdef DOS
struct dostime_t dtm; /* holds DOS time, so we can get .01 secs */
_dos_gettime(&dtm);
MiscStats->totaltime = (time(0) * 1000) + (10 * dtm.hsecond);
MiscStats->swapwaittime = 0;
MiscStats->pagefaults = 0;
MiscStats->swapwrites = 0;
MiscStats->diskiotime = 0; /* ?? not available ?? */
MiscStats->diskops = 0;
MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF);
#else
struct timeval timev;
struct rusage ru;
@@ -106,6 +130,7 @@ void update_miscstats() {
;
gettimeofday(&timev, NULL);
MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
#endif /* DOS */
}
/************************************************************************/
@@ -170,11 +195,20 @@ LispPTR subr_gettime(LispPTR args[])
static int gettime(int casep)
{
#ifdef DOS
struct dostime_t dtm; /* for hundredths of secs */
#else
struct timeval timev;
#endif /* DOS */
switch (casep) {
case 0: /* elapsed time in alto milliseconds */
#ifdef DOS
_dos_gettime(&dtm);
return ((time(0) + UNIX_ALTO_TIME_DIFF) * 1000) + (10 * dtm.hsecond);
#else /* DOS */
gettimeofday(&timev, NULL);
return ((timev.tv_sec + UNIX_ALTO_TIME_DIFF) * 1000 + timev.tv_usec / 1000);
#endif /* DOS */
case 1: /* starting elapsed time in milliseconds */ return (MiscStats->starttime);
@@ -185,12 +219,20 @@ static int gettime(int casep)
case 3: /* total GC time in milliseconds */ return (MiscStats->gctime);
case 4: /* current time of day in Alto format */
#ifdef DOS
return (time(0) + UNIX_ALTO_TIME_DIFF);
#else
gettimeofday(&timev, NULL);
return (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
#endif
case 5: /* current time of day in Interlisp format */
#ifdef DOS
return (time(0) + LISP_UNIX_TIME_DIFF);
#else
gettimeofday(&timev, NULL);
return (timev.tv_sec + LISP_UNIX_TIME_DIFF);
#endif
case 6:
return (98); /* this is wrong, only works in PST */
@@ -229,10 +271,29 @@ static int gettime(int casep)
void subr_settime(LispPTR args[])
{
#ifdef DOS
struct dostime_t dostime;
struct dosdate_t dosday;
struct tm uxtime;
uxtime = *localtime((time_t *)(*((int *)Addr68k_from_LADDR(args[0])) - UNIX_ALTO_TIME_DIFF));
dostime.hsecond = 0;
dostime.second = uxtime.tm_sec;
dostime.minute = uxtime.tm_min;
dostime.hour = uxtime.tm_hour;
_dos_settime(&dostime);
dosday.day = uxtime.tm_mday;
dosday.month = uxtime.tm_mon;
dosday.year = uxtime.tm_year;
dosday.dayofweek = uxtime.tm_wday;
_dos_setdate(&dosday);
#else
struct timeval timev;
timev.tv_sec = *((int *)Addr68k_from_LADDR(args[0])) - UNIX_ALTO_TIME_DIFF;
timev.tv_usec = 0;
settimeofday(&timev, NULL);
#endif
} /* end subr_settime */
/************************************************************************/
@@ -269,11 +330,19 @@ void subr_copytimestats(LispPTR args[])
LispPTR N_OP_rclk(LispPTR tos)
{
unsigned int usec;
#ifdef DOS
struct dostime_t dtm;
#endif /* DOS */
#ifdef DOS
_dos_gettime(&dtm);
usec = (time(0) * 1000000) + (10000 * dtm.hsecond);
#else
struct timeval timev;
gettimeofday(&timev, NULL);
usec = (timev.tv_sec * 1000000UL) + timev.tv_usec;
#endif /* DOS */
*((unsigned int *)(Addr68k_from_LADDR(tos))) = usec;
return (tos);
} /* end N_OP_rclk */
@@ -293,9 +362,13 @@ LispPTR N_OP_rclk(LispPTR tos)
/************************************************************************/
void update_timer() {
#ifdef DOS
MiscStats->secondstmp = MiscStats->secondsclock = time(0) + UNIX_ALTO_TIME_DIFF;
#else
struct timeval timev;
gettimeofday(&timev, NIL);
MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
#endif /* DOS */
}
/************************************************************************/
@@ -328,7 +401,7 @@ void update_timer() {
/* TIMER_INTERVAL usec ~ 20 per second. This should live in some
machine-configuration
file somewhere - it can be changed as the -t parameter to lisp*/
int TIMER_INTERVAL = 25000;
int TIMER_INTERVAL = 10000;
extern int LispWindowFd;
@@ -348,10 +421,6 @@ static void int_timer_service(int sig)
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
#ifdef XWINDOW
Event_Req = TRUE;
#endif
}
/************************************************************************/
@@ -368,12 +437,30 @@ static void int_timer_service(int sig)
static void int_timer_init()
{
#ifdef DOS
/******************************************************************************
* All code and data touched during the processing of an interrupt should
* locked prior to receiving any interrupts. This prevents the Timer
* function from being swapped out during an interrupt.
******************************************************************************/
_dpmi_lockregion((void *)Irq_Stk_End, sizeof(Irq_Stk_End));
_dpmi_lockregion((void *)Irq_Stk_Check, sizeof(Irq_Stk_Check));
_dpmi_lockregion((void *)tick_count, sizeof(tick_count));
_dpmi_lockregion((void *)&DOStimer, 4096);
_dpmi_lockregion((void *)prev_int_1c, sizeof(prev_int_1c));
/* Set up the DOS time handler. */
prev_int_1c = _dos_getvect(0x1c); /* get addr of current 1c hndlr, */
/* if any*/
_dos_setvect(0x1c, DOStimer); /* hook our int handler to timer int */
#else
struct itimerval timert;
struct sigaction timer_action;
timer_action.sa_handler = int_timer_service;
sigemptyset(&timer_action.sa_mask);
timer_action.sa_flags = 0;
timer_action.sa_flags = SA_RESTART;
if (sigaction(SIGVTALRM, &timer_action, NULL) == -1) {
perror("sigaction: SIGVTALRM");
@@ -385,6 +472,7 @@ static void int_timer_init()
setitimer(ITIMER_VIRTUAL, &timert, NULL);
DBPRINT(("Timer interval set to %d usec\n", timert.it_value.tv_usec));
#endif /* DOS */
}
/************************************************************************/
@@ -400,25 +488,40 @@ static void int_timer_init()
void int_io_open(int fd)
{
#if KBINT
#ifdef DOS
/* would turn on DOS kbd signal handler here */
#elseif defined(O_ASYNC)
DBPRINT(("int_io_opening %d\n", fd));
if (fcntl(fd, F_SETOWN, getpid()) == -1) {
#ifdef DEBUG
perror("fcntl F_SETOWN ERROR");
#endif
};
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_ASYNC) == -1) perror("fcntl F_SETFL error");
if (fcntl(fd, F_SETOWN, getpid()) == -1) perror("fcntl F_SETOWN error");
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_ASYNC) == -1) perror("fcntl F_SETFL on error");
#endif
}
void int_io_close(int fd)
{
#if KBINT
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_ASYNC);
#ifdef DOS
/* Turn off signaller here */
#elseif defined(O_ASYNC)
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_ASYNC) == -1) perror("fcntl_F_SETFL off error");
#endif
}
/************************************************************************/
/* */
/* i n t _ i o _ s e r v i c e */
/* */
/* Handle SIGIO */
/* */
/* */
/************************************************************************/
static void int_io_service(int sig)
{
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
IO_Signalled = TRUE;
}
/************************************************************************/
/* */
/* i n t _ i o _ i n i t */
@@ -431,8 +534,9 @@ void int_io_close(int fd)
/************************************************************************/
static void int_io_init() {
#ifndef DOS
struct sigaction io_action;
io_action.sa_handler = getsignaldata;
io_action.sa_handler = int_io_service;
sigemptyset(&io_action.sa_mask);
io_action.sa_flags = 0;
@@ -442,11 +546,6 @@ static void int_io_init() {
DBPRINT(("I/O interrupts enabled\n"));
}
#if defined(XWINDOW) && defined(I_SETSIG)
if (ioctl(ConnectionNumber(currentdsp->display_id), I_SETSIG, S_INPUT) < 0)
perror("ioctl on X fd - SETSIG for input handling failed");
#endif
#if defined(USE_DLPI)
DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));
if (ether_fd > 0)
@@ -457,6 +556,7 @@ static void int_io_init() {
return;
}
#endif /* USE_DLPI */
#endif /* DOS */
}
/************************************************************************/
@@ -472,6 +572,9 @@ static void int_io_init() {
void int_block() {
/* temporarily turn off interrupts */
#ifdef DOS
_dos_setvect(0x1c, prev_int_1c);
#else /* DOS */
sigset_t signals;
sigemptyset(&signals);
sigaddset(&signals, SIGVTALRM);
@@ -482,6 +585,7 @@ void int_block() {
sigaddset(&signals, SIGFPE);
#endif
sigprocmask(SIG_BLOCK, &signals, NULL);
#endif /* DOS */
}
/************************************************************************/
@@ -496,6 +600,9 @@ void int_block() {
/************************************************************************/
void int_unblock() {
#ifdef DOS
_dos_setvect(0x1c, DOStimer);
#else /* DOS */
sigset_t signals;
sigemptyset(&signals);
sigaddset(&signals, SIGVTALRM);
@@ -506,6 +613,7 @@ void int_unblock() {
sigaddset(&signals, SIGFPE);
#endif
sigprocmask(SIG_UNBLOCK, &signals, NULL);
#endif /* DOS */
}
#ifdef FLTINT
@@ -665,6 +773,7 @@ and do a 'v' before trying anything else.";
/* */
/************************************************************************/
static void int_panic_init() {
#ifndef DOS
struct sigaction panic_action, ignore_action;
panic_action.sa_sigaction = panicuraid;
@@ -688,6 +797,7 @@ static void int_panic_init() {
/* Ignore SIGPIPE */
sigaction(SIGPIPE, &ignore_action, NULL);
#endif
DBPRINT(("Panic interrupts enabled\n"));
}
@@ -713,3 +823,41 @@ void int_init() {
int_unblock(); /* Turn on interrupts */
}
#ifdef DOS
/******************************************************************************
* DOStimer()
*
* The interrupt 0x1c handler. This routine must be declared using the
* '#pragma interrupt()' statement to ensure that all registers are preserved.
* It is also needed to ensure the proper functioning of '_chain_intr()'.
*
* The timer interrupt (normally) occurs 18.2 times per second. This routine
* waits one extra tick every 91 ticks (18.2*5).
*
* Before this interrupt was installed, 'prev_int_1c' was set to the current
* 0x1c interrupt. 'DOStimer()' chains to this interrupt using '_chain_intr()',
* rather than returning back to the caller.
*
* Note that as little as possible should be done within a timer interrupt,
* since further clock ticks are disabled until the interrupt returns.
******************************************************************************/
void DOStimer() {
/* if (--tick_count == 0) { */
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
/* _dos_setvect(0x1c, prev_int_1c);
} else if (tick_count <= 0) { */
/* I'm dead, uninstall me */
/* _dos_setvect(0x1c, prev_int_1c);
tick_count = 0;
} */
_chain_intr(prev_int_1c); /* call previous int 1c handlr, if any*/
/* (pts to 'ret' if no prev installed)*/
}
void alarm(unsigned long sec)
{
/* tick_count = sec * 18;
_dos_setvect(0x1c, DOStimer); */
}
#endif /* DOS */

193
src/ufs.c
View File

@@ -19,10 +19,21 @@
#include <sys/types.h>
#include <unistd.h>
#ifndef DOS
#include <dirent.h>
#include <pwd.h>
#include <sys/param.h>
#include <sys/time.h>
#else /* DOS */
#include <dos.h>
#include <i32.h> /* "#pragma interrupt" & '_chain_intr'*/
#include <io.h>
#include <stk.h> /* _XSTACK struct definition */
#define MAXPATHLEN _MAX_PATH
#define MAXNAMLEN _MAX_PATH
#define alarm(x) 1
#endif /* DOS */
#include "lispemul.h"
#include "lispmap.h"
@@ -48,9 +59,72 @@ int Dummy_errno; /* If errno cell is not provided by Lisp, dummy_errno is used.
/* Used to limit DOS filenames to 8.3 format */
#ifdef DOS
#define NameValid extensionp ? (extlen < 3) : (namelen < 8)
#define CountNameChars \
{ extensionp ? extlen++ : namelen++; }
#else
/* Other file systems don't care */
#define NameValid 1
#define CountNameChars
#endif /* DOS */
#ifdef DOS
void (*prev_int_24)(); /* keeps address of previous 24 handlr*/
#pragma interrupt(Int24)
/*
* Name: Int24
*
* Description: Bypass the "Abort, Retry, Fail?" message that
* DOS issues.
*
*/
void Int24(void) {
unsigned deverr, errcode;
union REGS regs;
_XSTACK *stk;
stk = (_XSTACK *)_get_stk_frame(); /* get ptr to the V86 _XSTACK frame */
deverr = stk->eax;
if ((deverr & 0x00008000) == 0) /* is a disk error */
{
stk->eax = _HARDERR_FAIL;
stk->opts |= _STK_NOINT; /* set _STK_NOINT to prevent V86 call */
_chain_intr(prev_int_24); /* call previous int 24 handlr, if any*/
/* (pts to 'ret' if no prev installed)*/
}
}
/*
* Name: init_host_filesystem
*
* Description: Initialize the hosts filesystem by installing
* the "critical error handler".
*/
init_host_filesystem() {
prev_int_24 = _dos_getvect(0x24); /* get addr of current handler, if any */
_dos_setvect(0x24, Int24); /* hook our int handler to interrupt */
_dpmi_lockregion((void *)prev_int_24, sizeof(prev_int_24));
_dpmi_lockregion((void *)&Int24, 4096);
}
/*
* Name: exit_host_filesystem
*
* Description: Cleanup the filesystem specific patches.
*
*/
exit_host_filesystem() {
_dos_setvect(0x24, prev_int_24); /* unhook our handlr, install previous*/
_dpmi_unlockregion((void *)prev_int_24, sizeof(prev_int_24));
_dpmi_unlockregion((void *)&Int24, 4096);
}
#endif /* DOS */
/*
* Name: UFS_getfilename
@@ -98,7 +172,11 @@ LispPTR UFS_getfilename(LispPTR *args)
* Thus we don't need to convert a version field. Third argument for
* unixpathname specifies it.
*/
#ifdef DOS
if (unixpathname(lfname, file, 0, 0, 0, 0, 0) == 0) return (NIL);
#else
if (unixpathname(lfname, file, 0, 0) == 0) return (NIL);
#endif /* DOS */
switch (args[1]) {
case RECOG_OLD:
@@ -176,7 +254,11 @@ LispPTR UFS_deletefile(LispPTR *args)
LispStringToCString(args[0], fbuf, MAXPATHLEN);
#ifdef DOS
if (unixpathname(fbuf, file, 0, 0, 0, 0, 0) == 0) return (NIL);
#else
if (unixpathname(fbuf, file, 0, 0) == 0) return (NIL);
#endif /* DOS */
/*
* On UNIX device, all we have to do is just to unlink the file.
@@ -230,9 +312,17 @@ LispPTR UFS_renamefile(LispPTR *args)
if (len > MAXPATHLEN) FileNameTooLong(NIL);
LispStringToCString(args[0], fbuf, MAXPATHLEN);
#ifdef DOS
if (unixpathname(fbuf, src, 0, 0, 0, 0, 0) == 0) return (NIL);
#else
if (unixpathname(fbuf, src, 0, 0) == 0) return (NIL);
#endif /* DOS */
LispStringToCString(args[1], fbuf, MAXPATHLEN);
#ifdef DOS
if (unixpathname(fbuf, dst, 0, 0, 0, 0, 0) == 0) return (NIL);
#else
if (unixpathname(fbuf, dst, 0, 0) == 0) return (NIL);
#endif /* DOS */
TIMEOUT(rval = rename(src, dst));
if (rval == -1) {
@@ -294,7 +384,11 @@ LispPTR UFS_directorynamep(LispPTR *args)
LispStringToCString(args[0], dirname, MAXPATHLEN);
/* Convert Xerox Lisp file naming convention to Unix one. */
#ifdef DOS
if (unixpathname(dirname, fullname, 0, 0, 0, 0, 0) == 0) return (NIL);
#else
if (unixpathname(dirname, fullname, 0, 0) == 0) return (NIL);
#endif /* DOS */
TIMEOUT(rval = stat(fullname, &sbuf));
if (rval == -1) {
@@ -353,7 +447,11 @@ LispPTR UFS_directorynamep(LispPTR *args)
* UNIX trail directory delimiter '/'.
*
*/
#ifdef DOS
int unixpathname(char *src, char *dst, int versionp, int genp, char *drive, int *extlenptr, char *rawname)
#else
int unixpathname(char *src, char *dst, int versionp, int genp)
#endif /* DOS */
{
register char *cp, *dp, *np;
register int newdirflg;
@@ -362,7 +460,20 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
char ver1[VERSIONLEN], ver2[VERSIONLEN];
struct passwd *pwd;
#ifdef DOS
char *rp;
int namelen = 0, extlen = 0; /* lengths of name & extension */
int extensionp = 0; /* T if we're in the extension */
int version = 1; /* version # for this file */
#endif /* DOS */
/* If there's a drive letter, it and a colon come first */
#ifdef DOS
if (drive && (*drive)) {
*dst++ = *drive;
*dst++ = DRIVESEP;
}
#endif /* DOS */
/*
* The UNIX root directory is represented as "<" in Xerox Lisp generic
@@ -381,7 +492,11 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
* because the quotation mark which quotes the semicolon might be lost
* in the course of the following conversion.
*/
#ifdef DOS
if (versionp) LispVersionToUnixVersion(lfname, version) else version = -1;
#else
if (versionp) LispVersionToUnixVersion(lfname);
#endif /* DOS */
cp = lfname;
dp = dst;
@@ -401,7 +516,11 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
* user's current working directory.
*/
if (getcwd(dst, MAXPATHLEN) == 0) return (0);
#ifdef DOS
dp = max(strrchr(dst, '/'), strrchr(dst, DIRSEP));
#else
dp = strrchr(dst, '/');
#endif /* DOS */
dp++;
if (*(cp + 2) == '\0')
@@ -413,6 +532,10 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
*dp++ = DIRSEP;
}
break;
#ifdef DOS
case '/':
case DIRSEP:
#endif
case '>':
/* ".>" means the user's current working directory. */
if (getcwd(dst, MAXPATHLEN) == 0) return (0);
@@ -437,6 +560,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
break;
}
break;
#ifndef DOS
case '~':
if (*(cp + 1) == '>' || *(cp + 1) == '\0') {
/* "~>" or "~" means the user's home directory. */
@@ -482,6 +606,30 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
}
break;
#else
/* For DOS, ignore ~> or ~/ or ~ */
case '~':
if (*(cp + 1) == '>' || *(cp + 1) == '\0') {
/* "~>" or "~" means the user's home directory. */
*dp++ = DIRSEP;
if (*(cp + 1) == '\0')
cp++;
else
cp += 2;
} else {
/*
* In this case, we assume some user's home directory
* is specified in the form "~username".
*/
for (++cp, np = name; *cp != '\0' && *cp != '>';) *np++ = *cp++;
*dp++ = DIRSEP;
if (*cp == '>') cp++;
}
break;
#endif /* DOS */
default:
*dp++ = '/'; /* Insert the initial directory delimiter. */
break;
@@ -577,6 +725,9 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
}
} else {
switch (*cp) {
#ifdef DOS
case '/': /* in DOS, must xlate / also. */
#endif /* DOS */
case '>':
/*
* Xerox Lisp directory delimiter '>' is translated into
@@ -586,6 +737,10 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
dp++;
cp++;
newdirflg = 1; /* Turn on the new directory flag. */
#ifdef DOS
namelen = extlen = 0;
rp = dp; /* remember where raw filename starts */
#endif /* DOS */
break;
case '\'':
@@ -596,8 +751,21 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
* So only we have to do is to skip the quotation mark
* and copy the next character.
*/
#ifdef DOS
if (NameValid) *dp++ = *(cp + 1);
CountNameChars;
#endif /* DOS */
cp += 2;
break;
#ifdef DOS
case '.': /* start of extension, if not already */
if (!extensionp)
*dp++ = *cp++;
else
cp++;
extensionp = 1;
break;
#endif /* DOS */
default:
if (NameValid)
*dp++ = *cp++;
@@ -640,6 +808,12 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
*(dp - 1) = '\0';
}
}
#ifdef DOS
if (version >= 0)
sprintf(ver2, "%d", version);
else
*ver2 = '\0';
#endif /* DOS */
ConcNameAndVersion(fbuf2, ver2, dst);
}
return (1);
@@ -693,6 +867,14 @@ int lisppathname(char *fullname, char *lispname, int dirp, int versionp)
return (1);
}
#ifdef DOS
/* Split off the drive, if there is one. */
if (fullname[1] == DRIVESEP) {
*lispname++ = *fullname++;
*lispname++ = *fullname++;
}
#endif
if (!dirp) {
/*
* The characters which are dealt with specially (i.e. are quoted)
@@ -763,11 +945,16 @@ int lisppathname(char *fullname, char *lispname, int dirp, int versionp)
switch (*cp) {
case '>':
case ';':
#ifndef DOS
case '\'':
#endif /* DOS */
*dp++ = '\'';
*dp++ = *cp++;
break;
#ifdef DOS
case '/':
#endif
case DIRSEP:
*dp++ = '>';
cp++;
@@ -809,6 +996,12 @@ int lisppathname(char *fullname, char *lispname, int dirp, int versionp)
i = 1;
while (*cp) {
switch (*cp) {
#ifdef DOS
case DIRSEP:
*dp++ = '/';
cp++;
break;
#endif
case '>':
case ';':
case '\'':

View File

@@ -6,6 +6,9 @@ Unix Interface Communications
*/
/* Don't compile this at all under DOS. */
#ifndef DOS
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* Needed for ptsname on glibc systems. */
#endif
@@ -926,3 +929,4 @@ void WriteLispStringToPipe(LispPTR lispstr) {
write(UnixPipeOut, shcom, len);
}
#endif /* DOS */

View File

@@ -27,26 +27,14 @@
#include <sys/types.h>
#include <unistd.h>
#ifndef DOS
#include <sys/file.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/select.h>
#endif /* DOS */
#ifdef SUNDISPLAY
#include <sundev/kbd.h>
#include <sundev/kbio.h>
#include <errno.h>
#ifndef NOPIXRECT
#include <sunwindow/window_hs.h>
#include <sunwindow/win_ioctl.h>
#include <pixrect/pixrect_hs.h>
#include <sunwindow/win_cursor.h>
#include <sunwindow/cms.h>
#include <sys/mman.h>
extern int Win_security_p;
#endif /* NOPIXRECT */
#endif /* SUNDISPLAY */
#ifdef OS5
#include <stropts.h>
@@ -87,10 +75,19 @@ extern int Win_security_p;
#include "etherdefs.h"
#endif
#if defined(XWINDOW)
#ifdef DOS
#define vfork() printf("No forking around here.\n")
#endif /* DOS */
#if defined(DOS) || defined(XWINDOW)
#include "devif.h"
extern DspInterface currentdsp;
#endif /* XWINDOW */
#endif /* DOS || XWINDOW */
#ifdef DOS
extern MouseInterface currentmouse;
extern KbdInterface currentkbd;
#endif /* DOS */
#ifdef COLOR
extern int MonoOrColor;
@@ -126,7 +123,7 @@ x Xaddress [xnum] Hex-Dump xnum word(16-bits) starting at Xaddress
@ litatom val Sets TOPVAL of litatom to Decimal-val
< Xaddress val Sets the word(16-bits) at the address to val
<<Return or Exit>>
e Exit to UNIX
e Exit to UNIX / DOS
h Context switch to HARDRESET
q Returns from URAID with NO-change
<<Misc>>
@@ -138,17 +135,10 @@ v filename Save the virtual memory on the filename(Not Bootable)
*/
/************************************************************************/
#ifndef NOPIXRECT
extern int black, white;
extern struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
#endif /* NOPIXRECT */
extern int DisplayRasterWidth;
extern unsigned int LispWindowFd, LispKbdFd;
extern fd_set LispReadFds;
#ifndef NOPIXRECT
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
#endif /* NOPIXRECT */
extern struct cursor CurrentCursor, InvisibleCursor;
extern struct screen LispScreen;
extern int displaywidth, displayheight;
@@ -164,6 +154,41 @@ DLword *HideColorDisp68k;
extern int Inited_Color;
#endif /* COLOR */
#ifdef DOS
char *URaid_summary1 =
"\n-- Stack display commands\n\
c\t\t\tChecks all user stack contents\n\
f number\t\tDisplays stack frame for that frame number (decimal)\n\
k type\t\t\tChanges the type of stack link following. (a|c)\n\
l [type]\t\tBack Trace for specified type stack. (k|m|r|g|p|u|<null>)\n\
<CR>\t\t\tDisplay next frame.\n";
char *URaid_summary2 =
"\n-- Memory display commands\n\
a litatom\t\tDisplays the top-level value of the litatom\n\
B Xaddress\t\tPrint the contents of the arrayblock at that address.\n\
d litatom\t\tDisplays the definition cell for the litatom\n\
M\t\t\tDisplays TOS,CSP,PVAR,IVAR,PC\n\
m func1 func2\t\tMOVD func1 to func2\n\
O Xaddress\t\tDisplays the object with that address\n\
t Xaddress\t\tDisplays the type of this object\n\
p litatom\t\tDisplays the property list of the litatom\n\
w\t\t\tDisplays the current function-name and PC\n\
x Xaddress [xnum]\tHex-Dump xnum (16-bit) words starting at Xaddress\n\
@ litatom val\t\tSets TOPVAL of litatom to Decimal-val\n\
< Xaddress Xval\t\tSets the (16-bit) word at the address to Xval\n";
char *URaid_summary3 =
"\n-- Continue or exit commands\n\
e\t\t\tExit to DOS\n\
h\t\t\tDo a HARDRESET\n\
q\t\t\tReturns from URAID with NO change\n\
<<Misc>>\ns\t\t\tInvoke Shell\n\
v filename\t\tSave the virtual memory on the filename(Not Bootable)\n\
( [num]\t\t\tSets Print level\n\
!\t\t\tPrints the error message passed from the emulator\n\
?\t\t\tDisplay this summary";
#else
char *URaid_summary =
"---URAID command summary---\n\
\n-- Stack display commands\n\
@@ -195,6 +220,7 @@ v filename\t\tSaves the virtual memory on the filename (Not Bootable)\n\
( [num]\t\t\tSets the print level\n\
!\t\t\tDisplays the error message passed from the emulator\n\
?\t\t\tDisplays this summary";
#endif /* DOS */
#define ADD_RANGEP(address) \
if (((address) < 0) || (POINTERMASK < (address))) { \
@@ -325,7 +351,9 @@ LispPTR uraid_commands() {
int num, address, val;
LispPTR index;
DefCell *defcell68k;
#ifndef DOS
int status;
#endif /* DOS */
if (URaid_argnum == -1) {
/* disp next FX */
@@ -339,6 +367,11 @@ LispPTR uraid_commands() {
}
switch (URaid_comm) {
/*** Displaying STACK stuff */
#ifdef DOS
case '1': printf("%s\n", URaid_summary1); break;
case '2': printf("%s\n", URaid_summary2); break;
case '3': printf("%s\n", URaid_summary3); break;
#endif /* DOS */
case 'c': stack_check(0); break;
case 'C': all_stack_dump(0, 0, T); break;
case 'f': /**if((URaid_arg1[0] < '0') || (URaid_arg1[0] > '9')){
@@ -712,7 +745,11 @@ LispPTR uraid_commands() {
fflush(stdin);
break;
case 'e': /* exit to UNIX */
#ifdef DOS
printf("Exit to DOS?[confirm](Y or N)<");
#else /* DOS */
printf("Exit to UNIX?[confirm](Y or N)<");
#endif /* DOS */
{
int c;
c = getchar();
@@ -729,8 +766,10 @@ LispPTR uraid_commands() {
default: break;
}
#ifndef DOS
(void)wait(&status);
/* system("/bin/sh -i"); */
#endif /* DOS */
return (T);
/* break; */
case 'v':
@@ -738,10 +777,6 @@ LispPTR uraid_commands() {
printf("VMEMSAVE: v filename (it's NOT bootable)\n");
return (T);
}
#ifndef DISPLAYBUFFER
copy_region(HideDisp68k, DisplayRegion68k, DisplayRasterWidth, displayheight);
#endif /* DISPLAYBUFFER */
if (vmem_save(URaid_arg1) != NIL) {
#ifndef DISPLAYBUFFER
clear_display();
@@ -767,7 +802,13 @@ LispPTR uraid_commands() {
printf("PrintLevel is set to %d.", num);
break;
case '?':
#ifdef DOS
printf(
" 1: <<Displaying the Stack>>\n 2: <<Displaying memory contents>>\n 3: <<Return or "
"Exit>>\n");
#else
printf("%s\n", URaid_summary);
#endif /* DOS */
break;
case '!': printf("Error message is: %s\n", URaid_errmess); break;
@@ -795,17 +836,8 @@ LispPTR uraid_commands() {
extern struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
#endif
#ifdef SUNDISPLAY
#define SV_ACQUIRE "/bin/sunview1/sv_acquire"
#define SV_RELEASE "/bin/sunview1/sv_release"
#endif /* SUNDISPLAY */
int device_before_raid() {
#ifdef SUNDISPLAY
int size;
int keytrans;
union wait status;
#endif /* SUNDISPLAY */
#ifdef XWINDOW
sigset_t signals;
#endif
@@ -819,12 +851,6 @@ int device_before_raid() {
sigprocmask(SIG_UNBLOCK, &signals, NULL);
#endif
#ifdef SUNDISPLAY
win_setcursor(LispWindowFd, &InvisibleCursor);
#ifdef KBINT
int_io_close(LispWindowFd);
#endif
#endif /* SUNDISPLAY */
#ifdef MAIKO_ENABLE_ETHERNET
#ifdef ETHERINT
@@ -837,101 +863,15 @@ int device_before_raid() {
int_io_close(RS232C_Fd);
#endif
#ifdef SUNDISPLAY
mess_reset(); /* turn off console-msg handling */
#ifdef FX_AR_124
/* For AR 124. Type4 driver bug?? by m.matsuda */
{
long i;
for (i = 0; i < 900000; i++)
;
}
#endif /* FX_AR_124 */
if ((LispKbdFd = open(LispScreen.scr_kbdname, O_RDWR)) == -1) {
fprintf(stderr, "can't open %s\n", LispScreen.scr_kbdname);
return (-1);
}
keytrans = TR_EVENT; /* keyboard encodes key */
if (ioctl(LispKbdFd, KIOCTRANS, &keytrans) == -1) {
fprintf(stderr, "Error at ioctl errno =%d\n", errno);
return (-1);
}
close(LispKbdFd);
close(LispWindowFd);
#ifdef TRUECOLOR
truecolor_before_raid();
#endif /* TRUECOLOR */
#ifndef DISPLAYBUFFER
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
if ((HideDisp68k = malloc(size)) == 0) {
printf("can't malloc hide space\n");
return (-1);
}
copy_region(DisplayRegion68k, HideDisp68k, DisplayRasterWidth, displayheight);
#endif /* DISPLAYBUFFER */
#ifdef COLOR
save_colormap();
#ifndef DISPLAYBUFFER
if (Inited_Color) {
#else
if (MonoOrColor == COLOR_SCREEN) {
#endif /* DISPLAYBUFFER */
/* save color image */
size =
((displaywidth * displayheight + (getpagesize() - 1)) & -getpagesize()); /* 8 bit depth */
if ((HideColorDisp68k = malloc(size)) == 0) {
printf("can't malloc hide space\n");
return (-1);
}
copy_region(ColorDisplayRegion68k, HideColorDisp68k, DisplayRasterWidth * 8, displayheight);
} /* end if(MonoOrColor) */
#endif /* COLOR */
clear_display();
#ifdef DISPLAYBUFFER
pr_close(ColorDisplayPixrect);
close(FrameBufferFd);
#endif
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "display_before_exit: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_RELEASE, "sv_release", NULL);
/* should not return */
(void)fprintf(stderr, "display_before_exit: exec for sv_release failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status); /* child dies after changing 16 */
if (status.w_retcode != 0) {
(void)fprintf(stderr, "device_before_raid: failed to set ownership of win devices\n");
exit(1);
}
}
#endif /* SUNDISPLAY */
#if defined(XWINDOW)
#if defined(XWINDOW) || defined(DOS)
(currentdsp->cleardisplay)(currentdsp);
(currentdsp->device.before_raid)(currentdsp);
#endif /* XWINDOW */
#ifdef DOS
(currentmouse->device.before_raid)(currentmouse);
(currentkbd->device.before_raid)(currentkbd);
#endif /* DOS */
#endif /* XWINDOW || DOS */
return (0);
}
@@ -1033,19 +973,21 @@ int device_after_raid() {
int_init();
#ifdef SUNDISPLAY
FD_SET(LispWindowFd, &LispReadFds);
#endif /* SUNDISPLAY */
#ifdef MAIKO_ENABLE_ETHERNET
FD_SET(ether_fd, &LispReadFds);
if (ether_fd > 0) FD_SET(ether_fd, &LispReadFds);
#endif /* MAIKO_ENABLE_ETHERNET */
#ifdef XWINDOW
(currentdsp->device.after_raid)(currentdsp);
FD_SET(ConnectionNumber(currentdsp->display_id), &LispReadFds);
flush_display_buffer();
#endif /* XWINDOW */
#elif DOS
(currentdsp->device.after_raid)(currentdsp);
(currentmouse->device.after_raid)(currentmouse, currentdsp);
(currentkbd->device.after_raid)(currentkbd);
flush_display_buffer();
#endif /* XWINDOW | DOS */
int_unblock();
*EmKbdAd068K = *EmRealUtilin68K = *EmKbdAd168K = *EmKbdAd268K = *EmKbdAd368K = *EmKbdAd468K =
@@ -1070,107 +1012,6 @@ int device_after_raid() {
static int re_init_display(int lisp_display_addr, int display_max)
{
#ifdef SUNDISPLAY
int mmapstat, size;
struct pixrect *ColorFb;
extern struct pixrect *ColorDisplayPixrect, *DisplayRegionPixrect;
extern int DisplayType;
union wait status;
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "re_init_display: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_ACQUIRE, "sv_acquire", "0", "256", "250", NULL);
/* should not return */
(void)fprintf(stderr, "re_init_display: exec for sv_acquire failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status); /* child dies after changing 6 */
if (status.w_retcode != 0) {
(void)fprintf(stderr, "re_init_display: failed to set ownership of win devices\n");
exit(1);
}
}
mess_init();
if ((LispWindowFd = win_screennew(&LispScreen)) == -1) {
fprintf(stderr, "init_display: can't create LispWindow\n");
return (-1);
} else {
#ifdef KBINT
int_io_open(LispWindowFd);
fcntl(LispWindowFd, F_SETFL, fcntl(LispWindowFd, F_GETFL, 0) | O_NONBLOCK);
#ifdef FX_AR_124
/* For AR 124. Type4 driver bug?? by m.matsuda */
{
long i;
for (i = 0; i < 900000; i++)
;
}
#endif /* FX_AR_124 */
#endif
}
#ifndef DISPLAYBUFFER
/* for CGFOUR dev */
if (DisplayType == SUN4COLOR) {
ColorFb = pr_open("/dev/fb");
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
#else /* DISPLAYBUFFER is T */
/* ColorDisplayPixrect = pr_open("/dev/fb");
pr_putcolormap(ColorDisplayPixrect, 1, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, 0, 1, &white, &white, &white);
pr_putcolormap(ColorDisplayPixrect, 255, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect,
(1<<ColorDisplayPixrect->pr_depth)-1, 1,
&black, &black, &black);
***/
#endif /* DISPLAYBUFFER */
init_cursor();
#ifndef DISPLAYBUFFER
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
mmapstat = (int)mmap(DisplayRegion68k, size, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif /* OS4 */
MAP_SHARED,
FrameBufferFd, 0);
if (mmapstat == -1) {
fprintf(stderr, "re_init_display: ERROR at mmap system call\n");
fprintf(stderr, "errno = %d\n\n", errno);
return (0);
}
copy_region(HideDisp68k, DisplayRegion68k, DisplayRasterWidth, displayheight);
free(HideDisp68k);
#endif /* DISPLAYBUFFER */
#ifdef DISPLAYBUFFER
ColorDisplayPixrect = pr_open("/dev/fb");
flush_display_buffer();
/* refresh_CG6; */
#endif /* DISPLAYBUFFER */
#endif /* SUNDISPLAY */
return (0);
}
@@ -1179,163 +1020,6 @@ static int re_init_display(int lisp_display_addr, int display_max)
static int re_init_display(int lisp_display_addr, int display_max)
{
#ifdef SUNDISPLAY
int mmapstat, size;
struct pixrect *ColorFb;
struct pixrect *color_source;
extern int DisplayType;
union wait status;
if (Win_security_p) {
switch (vfork()) {
case -1: /* Error */ (void)fprintf(stderr, "re_init_display: Fork failed.\n"); exit(1);
case 0: /* Child */
(void)execl(SV_ACQUIRE, "sv_acquire", "0", "256", "250", NULL);
/* should not return */
(void)fprintf(stderr, "re_init_display: exec for sv_acquire failed\n");
exit(1);
default: /* Parent */
/* do nothing */
break;
}
(void)wait(&status); /* child dies after changing 6 */
if (status.w_retcode != 0) {
(void)fprintf(stderr, "re_init_display: failed to set ownership of win devices\n");
exit(1);
}
}
mess_init();
if ((LispWindowFd = win_screennew(&LispScreen)) == -1) {
fprintf(stderr, "init_display: can't create LispWindow\n");
return (-1);
} else {
#ifdef KBINT
int_io_open(LispWindowFd);
fcntl(LispWindowFd, F_SETFL, fcntl(LispWindowFd, F_GETFL, 0) | O_NONBLOCK);
#endif
}
#ifdef DISPLAYBUFFER
if ((FrameBufferFd = open(LispScreen.scr_fbname, 2)) == -1) {
perror("init_display: can't open FrameBuffer\n");
exit(-1);
}
#endif /* DISPLAYBUFFER */
restore_colormap();
if (MonoOrColor == MONO_SCREEN) {
#ifndef DISPLAYBUFFER
/* for CGFOUR dev */
if (DisplayType == SUN4COLOR) {
ColorFb = pr_open("/dev/fb");
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_SET, 0, 0, 0);
pr_set_plane_group(ColorFb, PIXPG_OVERLAY);
}
#else /* DISPLAYBUFFER is T */
/* ColorDisplayPixrect = pr_open("/dev/fb");
pr_putcolormap(ColorDisplayPixrect, 1, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect, 0, 1, &white, &white, &white);
pr_putcolormap(ColorDisplayPixrect, 255, 1, &black, &black, &black);
pr_putcolormap(ColorDisplayPixrect,
(1<<ColorDisplayPixrect->pr_depth)-1, 1,
&black, &black, &black);
***/
#endif /* DISPLAYBUFFER */
init_cursor();
#ifndef DISPLAYBUFFER
size = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
mmapstat = (int)mmap(DisplayRegion68k, size, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif /* OS4 */
MAP_SHARED,
FrameBufferFd, 0);
if (Inited_Color)
mmapstat = (int)mmap(ColorDisplayRegion68k, Dispcolorsize, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif /* OS4 */
MAP_SHARED,
FrameBufferFd, 0x40000);
if (mmapstat == -1) {
fprintf(stderr, "re_init_display: ERROR at mmap system call\n");
fprintf(stderr, "errno = %d\n\n", errno);
return (0);
}
/* restore mono image */
copy_region(HideDisp68k, DisplayRegion68k, DisplayRasterWidth, displayheight);
free(HideDisp68k);
if (Inited_Color) { /* restore color image */
copy_region(HideColorDisp68k, ColorDisplayRegion68k, DisplayRasterWidth * 8, displayheight);
free(HideColorDisp68k);
} /* end if( Inited_Color ) */
#endif /* DISPLAYBUFFER */
#ifdef DISPLAYBUFFER
ColorDisplayPixrect = pr_open("/dev/fb");
flush_display_buffer();
/* refresh_CG6; */
#endif /* DISPLAYBUFFER */
} else { /* MonoOrColor is COLOR_SCREEN */
ColorFb = pr_open("/dev/fb");
#ifdef DISPLAYBUFFER
ColorDisplayPixrect = ColorFb;
#endif /* DISPLAYBUFFER */
color_source = mem_point(displaywidth, displayheight, 8, ColorDisplayRegion68k);
pr_rop(ColorFb, 0, 0, displaywidth, displayheight, PIX_SRC, color_source, 0, 0);
#ifndef DISPLAYBUFFER
pr_set_plane_group(ColorFb, PIXPG_OVERLAY_ENABLE);
pr_rop(ColorFb, 0, 0, ColorFb->pr_width, ColorFb->pr_height, PIX_CLR, 0, 0, 0);
#endif /* DISPLAYBUFFER */
pr_set_plane_group(ColorFb, PIXPG_8BIT_COLOR);
init_cursor();
mmapstat = (int)mmap(ColorDisplayRegion68k, Dispcolorsize, PROT_READ | PROT_WRITE,
#ifdef OS4
MAP_FIXED |
#endif
MAP_SHARED,
FrameBufferFd, 0x40000);
if (mmapstat == -1) {
perror("cgfour_init_color_display: ERROR at mmap system call\n");
error(
"cgfour_init_color_display: ERROR at mmap system call\n You may be able to continue by "
"typing 'q'");
/* printf("MMAP FAIL:BMBASE=0x%x\nNATIVE:= 0x%x\nLISPBASEN:= 0x%x\n",
color_bitmapbase,ColorDisplayRegion68k,Lisp_world);
*/
return (NIL);
} /* end if(mmapstat) */
#ifndef DISPLAYBUFFER
/* restore mono image */
copy_region(HideDisp68k, DisplayRegion68k, DisplayRasterWidth, displayheight);
free(HideDisp68k);
#endif /* DISPLAYBUFFER */
/* restore coloe image */
copy_region(HideColorDisp68k, ColorDisplayRegion68k, DisplayRasterWidth * 8, displayheight);
free(HideColorDisp68k);
} /* end if(MonoOrColor) */
#endif /* SUNDISPLAY */
return (0);
}

View File

@@ -25,7 +25,9 @@
#include <time.h>
#include <unistd.h>
#ifndef DOS
#include <pwd.h>
#endif
#include "lispemul.h"
#include "adr68k.h"
@@ -113,6 +115,9 @@ int c_string_to_lisp_string(char *C, LispPTR Lisp) {
register char *dp;
for (i = 0, dp = C; i < length + 1; i++) {
int ch = *dp++;
#ifdef DOS
if (ch == '\\') dp++; /* skip 2nd \ in \\ in C strings */
#endif /* DOS */
GETBYTE(base++) = ch;
}
}
@@ -144,10 +149,12 @@ LispPTR check_unix_password(LispPTR *args) {
/************************************************************************/
LispPTR unix_username(LispPTR *args) {
#ifndef DOS
struct passwd *pwd;
if ((pwd = getpwuid(getuid())) == NULL) return NIL;
if (c_string_to_lisp_string(pwd->pw_name, args[0])) return NIL;
#endif /* DOS */
return ATOM_T;
}
@@ -195,6 +202,8 @@ LispPTR unix_getparm(LispPTR *args) {
if (strcmp(envname, "MACH") == 0) {
#if defined(sparc)
envvalue = "sparc";
#elif defined(DOS)
envvalue = "386";
#elif defined(MAIKO_OS_MACOS)
envvalue = "i386";
#else
@@ -204,6 +213,8 @@ LispPTR unix_getparm(LispPTR *args) {
} else if (strcmp(envname, "ARCH") == 0) {
#if defined(sparc)
envvalue = "sun4";
#elif defined(DOS)
envvalue = "dos";
#elif defined(MAIKO_OS_MACOS)
envvalue = "i386";
#else
@@ -219,6 +230,7 @@ LispPTR unix_getparm(LispPTR *args) {
envvalue = "DIRECT";
#endif
}
#ifndef DOS
else if (strcmp(envname, "HOSTNAME") == 0) {
if (gethostname(result, sizeof result)) return NIL;
envvalue = result;
@@ -234,6 +246,7 @@ LispPTR unix_getparm(LispPTR *args) {
snprintf(result, sizeof(result), "%lx", gethostid());
envvalue = result;
}
#endif /* DOS */
else
return NIL;
@@ -267,10 +280,12 @@ LispPTR unix_getenv(LispPTR *args) {
/************************************************************************/
LispPTR unix_fullname(LispPTR *args) {
#ifndef DOS
struct passwd *pwd;
if ((pwd = getpwuid(getuid())) == NULL) return NIL;
if (c_string_to_lisp_string(pwd->pw_gecos, args[0])) return NIL;
#endif /* DOS */
return ATOM_T;
}
@@ -286,6 +301,7 @@ extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K, *EmUti
extern DLword *EmKbdAd168K, *EmKbdAd268K, *EmKbdAd368K, *EmKbdAd468K, *EmKbdAd568K;
LispPTR suspend_lisp(LispPTR *args) {
#ifndef DOS
extern DLword *CTopKeyevent;
extern LispPTR *KEYBUFFERING68k;
@@ -339,5 +355,6 @@ LispPTR suspend_lisp(LispPTR *args) {
((RING *)CTopKeyevent)->write = MINKEYEVENT;
else
((RING *)CTopKeyevent)->write = w + KEYEVENTSIZE;
#endif /* DOS, which doesn't support suspend-lisp */
return ATOM_T;
}

826
src/vesafns.asm Normal file
View File

@@ -0,0 +1,826 @@
;; # @(#) vesafns.asm Version 1.1 (12/29/94). Copyright Venue #
;************************************************************************/
;* */
;* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
;* All Rights Reserved. */
;* Manufactured in the United States of America. */
;* */
;************************************************************************/
.386P
DATA SEGMENT USE32
;;; ******************************
;;; DevRec is the ``SuperClass'' of devices.
;;; It is included at the top of all the device record.
;;; **IT IS IMPORTANT THAT YOU KEEP THIS RECORD IN SYNC
;;; WITH THE DspInterfaceRec DEFINED IN devif.h
;;; ******************************
DevRec STRUC
active DD ?
locked DD ?
deventer DD ?
devexit DD ?
before_raid DD ?
after_raid DD ?
sync_device DD ?
DevRec ENDS
;;; ******************************
;;; MRegion is the generic region record. It is used for geometry
;;; calculations.
;;; ******************************
MRegion STRUC
x DD ?
y DD ?
RegWidth DD ?
RegHeight DD ?
MRegion ENDS
;;; ******************************
;;; DspInterfaceRec is the record that represents the
;;; display interface.
;;; **IT IS IMPORTANT THAT YOU KEEP THIS RECORD IN SYNC
;;; WITH THE DspInterfaceRec DEFINED IN devif.h
;;; ******************************
DspInterfaceRec STRUC
device DevRec <>
drawline DD ?
cleardisplay DD ?
get_color_map_entry DD ?
set_color_map_entry DD ?
available_colors DD ?
possible_colors DD ?
;; get_color_map DD ?
;; set_color_map DD ?
;; make_color_map DD ?
medley_to_native_bm DD ?
native_to_mdley_bm DD ?
bitblit_to_screen DD ?
bitblit_from_screen DD ?
scroll_region DD ?
mouse_invisible DD ?
mouse_visible DD ?
Disp MRegion <>
bitsperpixel DD ?
colors DD ?
oldstate DD ?
graphicsstate DD ?
numberofbanks DD ?
BytesPerLine DD ?
DisplayStartAddr DD ?
DisplaySegSize DD ?
DisplaySegMagnitude DD ?
LinesPerBank DD ?
SwitchBank DD ?
DspInterfaceRec ENDS
;;; ******************************
;;; IOPAGE good old iopage from medley...
;;; **IT IS IMPORTANT THAT YOU KEEP THIS RECORD IN SYNC
;;; WITH THE DspInterfaceRec DEFINED IN C.
;;; ******************************
IOPAGE STRUC
dummy0 DW 22o DUP (?)
dlfloppycmd DW ?
dlmaintpanel DW ?
dlprocessorcmd DW ?
dlttyportcmd DW ?
dlbeepcmd DW ?
newmousestate DW ?
dlrs232cputflag DW ?
dlrs232cmisccommand DW ?
dummy1b DW ?
dlrs232cgetflag DW ?
dummy1 DW 4o DUP (?)
dlfloppy DW ?
dummy1a DW ?
dummy2 DW ?
dlttyout DW ?
dummy3 DW ?
dlttyin DW ?
dlprocessor1 DW ?
dlprocessor2 DW ?
newmousex DW ?
dlprocessor0 DW ?
dlbeepfreq DW ?
newmousey DW ?
dlrs232cparametercsbhi DW ?
dlrs232cparametercsblo DW ?
dlrs232csetrs366status DW 2o DUP (?)
dlrs232cputcsblo DW ?
dlrs232csetrs366statusa DW ?
dlrs232cgetcsblo DW ?
dlrs232cputcsbhi DW ?
dlrs232cdevicestatus DW ?
dlrs232cgetcsbhi DW ?
dltodvalid DW ?
dlrs232cparameteroutcome DW ?
dltodhi DW ?
dltodlo DW ?
dlmousex DW ?
dltodlo2 DW ?
dlutilin DW ?
dlmousey DW ?
dlkbdad1 DW ?
dlkbdad0 DW ?
dlkbdad3 DW ?
dlkbdad2 DW ?
dlkbdad5 DW ?
dlkbdad4 DW ?
dllsepimagecsb DW 40o DUP (?)
dummy4a DW ?
dliophardwareconfig DW ?
dummy4 DW 12o DUP (?)
dlrs232cparametercsbhi_11 DW ?
dlrs232cparametercsblo_11 DW ?
dlrs232csetrs366status_11 DW 16o DUP (?)
dummy5 DW 74o DUP (?)
dlmagtape DW 4o DUP (?)
dlethernet DW 14o DUP (?)
dummy6 DW 36o DUP (?)
dldispinterrupt DW ?
dummy6a DW ?
dldispborder DW ?
dldispcontrol DW ?
dlcursory DW ?
dlcursorx DW ?
dlcursorbitmap DW 20o DUP (?)
IOPAGE ENDS
DATA ENDS
CODE SEGMENT USE32
ASSUME DS:DATA
ASSUME CS:CODE
DOBANK MACRO NUMBER
push eax
mov ax, NUMBER
mov dx, 3cdh
out dx, ax
pop eax
ENDM
RET2C MACRO VALUE
mov eax,VALUE
leave
ret
ENDM
;; **************************************************
;; D o s c l e a r b a n k s
;; arg1: dsp (pointer to dsp struct)
;;
;; Fill banks with 0.
;; **************************************************
dsp = 8
bank = -8
PUBLIC Dosclearbanks
Dosclearbanks PROC NEAR
enter 16,0
push edx
push ecx
push edi
mov DWORD PTR bank[ebp], 0
mov edx, dsp[ebp]
mov ecx, [edx.numberofbanks]
clrbnk: push ecx
DOBANK bank[ebp]
add DWORD PTR bank[ebp], 1
mov eax, 0
mov edi, [edx.DisplayStartAddr]
mov ecx, [edx.DisplaySegSize]
rep stosd
pop ecx
loop clrbnk
pop edi
pop ecx
pop edx
RET2C 0
Dosclearbanks ENDP
;; **************************************************
;; D O S C u r s o r V i s s i b l e
;; arg1: dsp (pointer to dsp struct)
;; arg2: iop (pointer to IOPAGE struct
;; Medley's cursor has no meaningful mask. The mask
;; is just the invers of the map (sigh...). The function
;; f(bg, map, curs) = bg*mask + (not mask)*curs thus
;; collapses to bg*(not curs) + curs. Since the medley
;; bitmaps have the inverse meaning of the vesa bitmaps
;; (ie. they are pre inverted for your convenience!)
;; the expression turns out to be:
;; bg*curs + (not curs)
;;
;; The general idea here is that we blit the cursor
;; directly to the screen instead of to the displayregion.
;; this saves a whole bunch of time since taking the
;; mouse down is just a matter of updating the screen.
;; since this operation has to be done every charblt
;; we save bunches of time. /jarl
;;
;; Assumption: we can straddle at most two banks
;; **************************************************
dsp = 8
iop = 12
PUBLIC DOSCursorVisible
DOSCursorVisible PROC NEAR
enter 32,0
push edx
push esi
push edi
push ebx
push ecx
mov edx, dsp[ebp]
mov esi, iop[ebp]
;; find the destiniation byte index
movzx eax, [esi.dlcursory]
imul eax, [edx.BytesPerLine]
movzx ebx, [esi.dlcursorx]
sar ebx, 3 ; Make it a byte address
add eax, ebx
mov edi, eax
;; make the dest index be an address within bounds
and edi, [edx.DisplaySegSize]
or edi, [edx.DisplayStartAddr]
setbnk: mov dx, 3cdh ; Set the bank
mov ax, 0
out dx, ax
add esi, dlcursorbitmap
mov ecx, 16 ; The curs height
bltcur: lodsw ; cursorbitmap to ax
mov ax, 1010101010101010b
stosw
add edi, [edx.BytesPerLine]
loop bltcur
pop ecx
pop ebx
pop edi
pop esi
pop edx
RET2C 0
DOSCursorVisible ENDP
;; **************************************************
;; **************************************************
;; D o s b b t 1
;; arg1: dsp (pointer to a dsp struct)
;; arg2: buffer (pointer to array of word)
;; arg3: left (dword) (in pixels)
;; arg4: top (dword) (in pixels)
;; arg5: swidth (dword) (in pixels)
;; arg6: height (dword) (in pixels)
;;
;; Bitblits the image stored in buffer to the display
;; buffer. Assumption: buffer and the displaybuffer
;; are equally large and thus left, top etc. pertains
;; to the same offsets.
;;
;;
;; C-CALL: void Dosbbt1( ... );
;; RETURN: 0 in eax. should be ignored...
;; **************************************************
dsp = 8
buffer = 12
left = 16
top = 20
swidth = 24
height = 28
left32 = -8
width32 = -12
endptr = -16
desttop = -20
dstincr = -24
srcincr = -28
PUBLIC Dosbbt1
Dosbbt1 PROC NEAR
;;; *****************************
;;; Save the volatile environment
;;; *****************************
enter 32,0
push ebx
push ecx
push edx
push esi
push edi
mov edx, dsp[ebp]
;; Adjust the arguments to fit inside the display
;; if left > displaywidth then exit
mov eax, [edx.Disp.RegWidth]
cmp left[ebp], eax
jg alldone
;; if 0 > (width + left) then exit
mov eax, left[ebp]
add eax, swidth[ebp]
cmp eax, 0
jl alldone
;; if top > displayheight then exit
mov eax, [edx.Disp.RegHeight]
cmp top[ebp], eax
jg alldone
;; if 0 > (top + height) then exit
mov eax, top[ebp]
add eax, height[ebp]
cmp eax, 0
jl alldone
;; if 0 > left then clipleft
mov eax, left[ebp]
cmp eax, 0
jl clipleft
tstwdt: ;; if (left + swidth) > displaywidth then clipwidth
mov eax, left[ebp]
add eax, swidth[ebp]
cmp eax, [edx.Disp.RegWidth]
jg clipwidth
tsttop: ;; if 0 > top then cliptop
mov eax, top[ebp]
cmp eax, 0
jl cliptop
tsthit: ;; if (top + height) > displayheight then clipbottom
mov eax, top[ebp]
add eax, height[ebp]
cmp eax, [edx.Disp.RegHeight]
jg clipbtm
jmp startpoint
clipleft:
mov DWORD PTR left[ebp], 0
jmp tstwdt
clipwidth:
mov eax, [edx.Disp.RegWidth]
sub eax, left[ebp]
mov swidth[ebp], eax
jmp tsttop
cliptop:
mov DWORD PTR top[ebp], 0
jmp tsthit
clipbtm:
mov eax, [edx.Disp.RegHeight]
sub eax, top[ebp]
mov height[ebp], eax
;; Calculate byte offset into bitmap
startpoint:
mov eax, [edx.Disp.RegWidth]
imul eax, top[ebp]
add eax, left[ebp]
sar eax, 5 ; Make it a byte address on dword boundaries.
sal eax, 2
;; Set dst and src start
mov edi, eax
mov esi, eax
add edi, [edx.DisplayStartAddr]
add esi, buffer[ebp]
;; Set dst and src incr
mov eax, left[ebp]
add eax, swidth[ebp]
add eax, 1fh
sar eax, 5
mov ebx, left[ebp]
sar ebx, 5
sub eax, ebx
mov width32[ebp], eax ; width32 is width in dwords
sal eax, 2 ; Make width32 a byteadr on dword boundaries.
mov ebx, [edx.Disp.RegWidth]
sar ebx, 3
sub ebx, eax
;; {dst,src}incr is what to add to {esi,edi} to get to the new line
mov dstincr[ebp], ebx
mov srcincr[ebp], ebx
;;; ******************************
Newline1:
mov ecx, width32[ebp] ; swidth into ecx
Dumpline1:
lodsd ; Load eax and increment esi
xchg ah,al ; Swap low byte
rol eax,10h ; Get the high byte into position
xchg ah,al ; Swap again
not eax ; In medley 1=black 0=white, Hence invert.
stosd ; Store eax and increment edi
loop Dumpline1
;; calc vals for src and dest for the next line.
add edi, dstincr[ebp]
add esi, srcincr[ebp]
dec DWORD PTR height[ebp]
jg Newline1
alldone:
pop edi
pop esi
pop edx
pop ecx
pop ebx
RET2C 0
Dosbbt1 ENDP
;; **************************************************
;; **************************************************
;; D o s b b t 2
;; arg1: dsp (pointer to a dsp struct)
;; arg2: buffer (pointer to array of word)
;; arg3: left (dword) (in pixels)
;; arg4: top (dword) (in pixels)
;; arg5: swidth (dword) (in pixels)
;; arg6: height (dword) (in pixels)
;;
;; FUNCTION: Monocrome bbt to a 4-plane displaybuffer.
;;
;; Bitblits the image stored in buffer to the display
;; buffer. ASSUMPTION: buffer and the displaybuffer
;; are equally large and thus left, top etc. pertains
;; to the same offsets.
;;
;; Medley has a packed bitmap structure. Dosbbt2 assumes
;; that we are operating in 4-plane mode. The medley
;; bitmap is blitted to the first plane of the display.
;; Thus the bitmap appears black and white.
;;
;;
;; C-CALL: void Dosbbt2( ... );
;; RETURN: 0 in eax. should be ignored...
;; **************************************************
dsp = 8
buffer = 12
left = 16
top = 20
swidth = 24
height = 28
left32 = -8
width32 = -12
endptr = -16
desttop = -20
dstincr = -24
srcincr = -28
tmpheight = -32
switchr = -36
PUBLIC Dosbbt2
Dosbbt2 PROC NEAR
;;; *****************************
;;; Save the volatile environment
;;; *****************************
enter 36,0
push ebx
push ecx
push edx
push esi
push edi
mov edx, dsp[ebp]
;; Adjust the arguments to fit inside the display
;; if left > displaywidth then exit
mov eax, [edx.Disp.RegWidth]
cmp left[ebp], eax
jg allbye
;; if 0 > (width + left) then exit
mov eax, left[ebp]
add eax, swidth[ebp]
cmp eax, 0
jl allbye
;; if top > displayheight then exit
mov eax, [edx.Disp.RegHeight]
cmp top[ebp], eax
jg allbye
;; if 0 > (top + height) then exit
mov eax, top[ebp]
add eax, height[ebp]
cmp eax, 0
jl allbye
;; if 0 > left then clipleft
mov eax, left[ebp]
cmp eax, 0
jl clipleft2
tstwdt2: ;; if (left + swidth) > displaywidth then clipwidth
mov eax, left[ebp]
add eax, swidth[ebp]
cmp eax, [edx.Disp.RegWidth]
jg clipwidth2
tsttop2: ;; if 0 > top then cliptop
mov eax, top[ebp]
cmp eax, 0
jl cliptop2
tsthit2: ;; if (top + height) > displayheight then clipbottom
mov eax, top[ebp]
add eax, height[ebp]
cmp eax, [edx.Disp.RegHeight]
jg clipbtm2
jmp startpt
clipleft2:
mov DWORD PTR left[ebp], 0
jmp tstwdt2
clipwidth2:
mov eax, [edx.Disp.RegWidth]
sub eax, left[ebp]
mov swidth[ebp], eax
jmp tsttop2
cliptop2:
mov DWORD PTR top[ebp], 0
jmp tsthit2
clipbtm2:
mov eax, [edx.Disp.RegHeight]
sub eax, top[ebp]
mov height[ebp], eax
;; Calculate byte offset into bitmap
startpt:
mov eax, [edx.Disp.RegWidth]
imul eax, top[ebp]
add eax, left[ebp]
sar eax, 5 ; Make it a byte address on dword boundaries.
sal eax, 2
;; Calculate which bank to start in.
push eax
push ecx
mov ecx, [edx.DisplaySegMagnitude]
sar eax, cl
mov DWORD PTR bank[ebp], eax
pop ecx
pop eax
;; Set dst and src start
mov edi, eax
mov esi, eax
add esi, buffer[ebp]
;; Set dst and src incr
mov eax, left[ebp]
add eax, swidth[ebp]
add eax, 1fh
sar eax, 5
mov ebx, left[ebp]
sar ebx, 5
sub eax, ebx
mov width32[ebp], eax ; width32 is width in dwords
sal eax, 2 ; Make width32 a byteadr on dword boundaries.
mov ebx, [edx.Disp.RegWidth]
sar ebx, 3
sub ebx, eax
;; {dst,src}incr is what to add to {esi,edi} to get to the new line
mov dstincr[ebp], ebx
mov srcincr[ebp], ebx
;; Adjust top to be inside the startbank
push eax
mov eax, [edx.LinesPerBank]
dec eax
and DWORD PTR top[ebp], eax
pop eax
Newbank2:
;; Set the bank
;; Use VESA int procedure to do this.
mov edx, DWORD PTR bank[ebp]
mov bx, 0
mov ax,4f05h
int 10h
mov edx, dsp[ebp] ;Restore edx.
;; Adjust dst to be within axxxxh
push eax
mov eax, [edx.DisplaySegSize]
dec eax
and edi, eax
add edi, [edx.DisplayStartAddr]
pop eax
;; XX
mov ebx, height[ebp]
mov eax, top[ebp]
add eax, ebx
cmp eax, [edx.LinesPerBank]
jle doit
mov ebx, [edx.LinesPerBank]
sub ebx, top[ebp]
doit:
mov DWORD PTR top[ebp], 0
mov tmpheight[ebp], ebx
sub height[ebp], ebx
Newline2:
mov ecx, width32[ebp] ; swidth into ecx
Dumpline2:
lodsd ; Load eax and increment esi
xchg ah,al ; Swap low byte
rol eax,10h ; Get the high byte into position
xchg ah,al ; Swap again
not eax ; In medley 1=black 0=white, Hence invert.
stosd ; Store eax and increment edi
loop Dumpline2
;; calc vals for src and dest for the next line.
add edi, dstincr[ebp]
add esi, srcincr[ebp]
dec DWORD PTR tmpheight[ebp]
jg Newline2
inc DWORD PTR bank[ebp]
cmp DWORD PTR height[ebp], 0
jg Newbank2
allbye:
pop edi
pop esi
pop edx
pop ecx
pop ebx
RET2C 0
Dosbbt2 ENDP
;; **************************************************
;; **************************************************
;; D o s b b t 3
;; arg1: dsp (pointer to a dsp struct)
;; arg2: buffer (pointer to array of word)
;; arg3: left (dword) (in pixels)
;; arg4: top (dword) (in pixels)
;; arg5: swidth (dword) (in pixels)
;; arg6: height (dword) (in pixels)
;;
;; Bitblits the image stored in buffer to the display
;; buffer. ASSUMPTION: buffer and the displaybuffer
;; are equally large and thus left, top etc. pertains
;; to the same offsets.
;;
;; Medley has a packed bitmap structure. Dosbbt3 assumes
;; that we are operating in 4-plane mode. The medley
;; bitmap is blitted to the first plane of the display.
;; Thus the bitmap appears black and white.
;;
;;
;; C-CALL: void Dosbbt3( ... );
;; RETURN: 0 in eax. should be ignored...
;; **************************************************
dsp = 8
buffer = 12
left = 16
top = 20
swidth = 24
height = 28
srcend = -8
PUBLIC Dosbbt3
Dosbbt3 PROC NEAR
;;; *****************************
;;; Save the volatile environment
;;; *****************************
enter 32,0
push ebx
push ecx
push edx
push esi
push edi
;;; Set up the dsp in edx
mov edx, dsp[ebp]
;;; Adjust left to be a byte offset at a dword boundary
;;; - Not needed. We shove bytes at byte boundaries
;;; Adjust width to be a byte offset at a dword boundary
;;; - Not needed. We shove bytes at byte boundaries
;;; Calculate start index for src
mov eax, top[ebp]
imul eax, [edx.BytesPerLine]
add eax, left[ebp]
mov esi, eax
;;; Calculate start index for dst.
mov edi, eax
;;; Calculate end address for src
mov eax, top[ebp]
add eax, height[ebp]
imul eax, [edx.BytesPerLine]
add eax, buffer[ebp]
mov srcend[ebp], eax
;;; Calculate the dstincr, ie. what to add to dst to
;;; get to the next line
mov eax, [edx.BytesPerLine]
sub eax, swidth[ebp]
mov dstincr[ebp], eax
;;; Calculate the srcincr, ie. what to add to src to
;;; get to the next line
mov srcincr[ebp], eax
;;; Calculate the start address for the src
;; We already know the byte index. Easy calculat'n
add esi, buffer[ebp] ;esi now points to src
Newbank3:
;; Set the bank
mov eax, esi ; 1. Calculate the index.
sub eax, buffer[ebp]
sar eax, 10h ; 2. Divide by "bytes-per-buffer"
; WARNING! this implies buffersize.
mov dx, 3cdh
out dx, ax ; 3. Set the port.
mov edx, dsp[ebp] ; Reinstate edx
;; Adjust dst to be within the bank.
and edi, [edx.DisplaySegSize]
or edi, [edx.DisplayStartAddr]
Newline3:
mov ecx, swidth[ebp] ; width into ecx
rep movsb ; Dump a line to the display
;; calc vals for src and dest for the next line.
add edi, dstincr[ebp]
add esi, srcincr[ebp]
;; End of block?
cmp esi, srcend[ebp]
jge QuitThis ; Yes, scram.
;; End of bank ?
cmp ax, 0
jge Newline3 ; No. Blit a new line.
mov edi, esi ; Yes. Reload edi,
jmp Newbank3 ; and blit a new line.
QuitThis:
pop edi
pop esi
pop edx
pop ecx
pop ebx
RET2C 0
Dosbbt3 ENDP
CODE ENDS
END

452
src/vesainit.c Normal file
View File

@@ -0,0 +1,452 @@
/* $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 <i32.h> /* #pragma interrupt & _get_stk_frame */
#include <errno.h>
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h>
#include <stdio.h>
#include <string.h>
#include <graph.h>
#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(&currentdsp, 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(&currentdsp, 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"));
}

147
src/vgainit.c Normal file
View File

@@ -0,0 +1,147 @@
/* $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 <stdio.h>
#include <graph.h>
#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(&currentdsp, 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(&currentdsp, 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;
}

View File

@@ -22,15 +22,20 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef DOS
#include <dirent.h>
#include <string.h>
#include <sys/param.h>
#include <pwd.h>
#include <unistd.h>
#else
#include <direct.h>
#include <stdlib.h>
#define MAXPATHLEN _MAX_PATH
#define MAXNAMLEN _MAX_PATH
#define alarm(x) 1
#endif /* DOS */
#if defined(SUNDISPLAY) && defined(OLD_CURSOR)
#include <sunwindow/win_cursor.h>
#endif
#include "hdw_conf.h"
#include "lispemul.h"
@@ -53,9 +58,6 @@
#include "perrnodefs.h"
#include "ufsdefs.h"
#ifdef GCC386
#include "inlnPS2.h"
#endif
/* Error return values from VMEMSAVE */
#define COMPLETESYSOUT NIL
@@ -70,6 +72,10 @@ extern int LispWindowFd;
extern struct pixrect *CursorBitMap, *InvisibleCursorBitMap;
extern struct cursor CurrentCursor, InvisibleCursor;
extern IFPAGE *InterfacePage;
#ifdef DOS
extern IOPAGE *IOPage68K;
extern DspInterface currentdsp;
#endif /* DOS */
#undef roundup
#define roundup(a, b) ((((unsigned)(a) + (b)-1) / (b)) * (b))
@@ -139,7 +145,12 @@ LispPTR vmem_save0(LispPTR *args)
{
register char *def;
char pathname[MAXPATHLEN], sysout[MAXPATHLEN], host[MAXNAMLEN];
#ifdef DOS
char pwd[MAXNAMLEN];
char drive[1];
#else
struct passwd *pwd;
#endif /* DOS */
Lisp_errno = &Dummy_errno;
@@ -147,19 +158,34 @@ LispPTR vmem_save0(LispPTR *args)
/* Check of lispstringP is safer for LispStringToCString */
LispStringToCString(args[0], pathname, MAXPATHLEN);
separate_host(pathname, host);
#ifdef DOS
if (!unixpathname(pathname, sysout, 0, 0, drive, 0, 0)) return (BADFILENAME);
#else
if (!unixpathname(pathname, sysout, 0, 0)) return (BADFILENAME);
#endif /* DOS */
return (vmem_save(sysout));
} else {
if ((def = getenv("LDEDESTSYSOUT")) == 0) {
#ifdef DOS
if (getcwd(pwd, MAXNAMLEN) == NULL) return (FILETIMEOUT);
strcpy(sysout, pwd);
strcat(sysout, "/lisp.vm");
#else
pwd = getpwuid(getuid()); /* NEED TIMEOUT */
if (pwd == (struct passwd *)NULL) return (FILETIMEOUT);
strcpy(sysout, pwd->pw_dir);
strcat(sysout, "/lisp.virtualmem");
#endif /* DOS */
} else {
if (*def == '~' && (*(def + 1) == '/' || *(def + 1) == '\0')) {
#ifdef DOS
if (getcwd(pwd, MAXNAMLEN) == NULL) return (FILETIMEOUT);
strcpy(sysout, pwd);
#else
pwd = getpwuid(getuid()); /* NEED TIMEOUT */
if (pwd == (struct passwd *)NULL) return (FILETIMEOUT);
strcpy(sysout, pwd->pw_dir);
#endif /* DOS */
strcat(sysout, def + 1);
} else {
strcpy(sysout, def);
@@ -287,28 +313,22 @@ LispPTR vmem_save(char *sysout_file_name)
register int i;
char tempname[MAXPATHLEN];
register int rval;
#ifdef SUNDISPLAY
/* DLword *bmptr; */
#endif
#ifndef DOS
extern int ScreenLocked;
extern DLword *EmCursorX68K;
extern DLword *EmCursorY68K;
extern DLword NullCursor[];
extern DLword *EmCursorBitMap68K;
#endif /* DOS */
/* remove cursor image from screen */
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &InvisibleCursor);
#else
ScreenLocked = T;
taking_mouse_down();
/* bmptr = EmCursorBitMap68K;
EmCursorBitMap68K= NullCursor;*/
#endif /* OLD_CURSOR */
#endif /* SUNDISPLAY */
#if DOS
/* For DOS, must also take the mouse cursor away (it's */
/* written into the display-region bitmap). */
currentdsp->device.locked++;
(currentdsp->mouse_invisible)(currentdsp, IOPage68K);
#endif /* SUNDISPLAY || DOS */
/* set FPTOVP */
fptovp = FPtoVP + 1;
@@ -324,7 +344,12 @@ LispPTR vmem_save(char *sysout_file_name)
*/
SETJMP(FILETIMEOUT);
#ifdef DOS
/* Bloddy 8 char filenames in dos ... /jarl */
make_old_version(tempname, sysout_file_name);
#else /* DOS */
sprintf(tempname, "%s-temp", sysout_file_name);
#endif /* DOS */
/* Confirm protection of specified file by open/close */
@@ -471,15 +496,10 @@ LispPTR vmem_save(char *sysout_file_name)
}
/* restore cursor image to screen */
#ifdef SUNDISPLAY
#ifdef OLD_CURSOR
win_setcursor(LispWindowFd, &CurrentCursor);
#else
ScreenLocked = T;
/*EmCursorBitMap68K = bmptr ;*/
taking_mouse_up(*EmCursorX68K, *EmCursorY68K);
ScreenLocked = NIL;
#endif /* OLD_CURSOR */
#if DOS
/* Must also put the mouse back. */
(currentdsp->mouse_visible)(IOPage68K->dlmousex, IOPage68K->dlmousey);
currentdsp->device.locked--;
#endif /* SUNDISPLAY */
@@ -514,5 +534,8 @@ void lisp_finish() {
/* if (UnixPID >= 0) kill(UnixPID, SIGKILL);*/ /* Then kill fork_Unix itself */
}
device_before_exit();
#ifdef DOS
exit_host_filesystem();
#endif /* DOS */
exit(1);
}

View File

@@ -53,7 +53,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
return (1);
}
@@ -80,7 +80,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
}
return (1);

View File

@@ -20,11 +20,18 @@
/* */
/************************************************************************/
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef DOS
#include <i32.h> /* Defines "#pragma interrupt" */
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h> /* Defines REGS & other structs */
#else /* DOS */
#include <sys/time.h>
#endif /* DOS */
#include "lispemul.h"
#include "emlglob.h"
@@ -92,17 +99,29 @@
#include "ubf3defs.h"
#include "unwinddefs.h"
#include "vars3defs.h"
#include "xwinmandefs.h"
#include "z2defs.h"
#ifdef DOS
#include "iopage.h"
extern IOPAGE *IOPage68K;
#include "devif.h"
extern KbdInterface currentkbd;
extern DspInterface currentdsp;
extern MouseInterface currentmouse;
#else
extern DspInterface currentdsp;
#endif /* DOS */
typedef struct conspage ConsPage;
typedef ByteCode *InstPtr;
#ifdef GCC386
#if (DOS && OPDISP)
#include "inlndos.h"
register InstPtr pccache asm("si");
register LispPTR *cspcache asm("di");
register LispPTR tscache asm("bx");
#include "inlnPS2.h"
#endif /* GCC386 */
#endif /* DOS */
/* This used to be here for including optimized dispatch
* for SPARC, but it has some other things in it, so we
@@ -125,11 +144,8 @@ register LispPTR tscache asm("bx");
#define PVARL PVar
#define IVARL IVar
#ifdef XWINDOW
extern int Event_Req; /* != 0 when it's time to check X events
on machines that don't get them reliably
(e.g. Suns running OpenWindows) */
#endif /* XWINDOW */
/* used by SIGIO signal handler to indicate I/O may be possible */
extern volatile sig_atomic_t IO_Signalled;
#ifdef PCTRACE
/* For keeping a trace table (ring buffer) of 100 last PCs */
@@ -190,8 +206,11 @@ void dispatch(void) {
};
#endif
#if (DOS && OPDISP)
#else
register LispPTR *cspcache;
register LispPTR tscache;
#endif
/* OP_FN_COMMON arguments */
@@ -1093,17 +1112,22 @@ check_interrupt:
Irq_Stk_End = (UNSIGNED)EndSTKP;
}
/* Check for an IRQ request */
/* This is a good time to process keyboard/mouse and ethernet I/O
* X events are not managed in the async/SIGIO code while
* raw ethernet, serial port, and socket connections are.
* If the system is configured with SIGIO handling we have a hint
* that allows us to cheaply skip if there's nothing to do
*/
process_Xevents(currentdsp);
if (IO_Signalled) {
IO_Signalled = FALSE;
process_io_events();
}
if ((Irq_Stk_End <= 0) || (Irq_Stk_Check <= 0) || need_irq) {
if (StkOffset_from_68K(CSTKPTR) > InterfacePage->stackbase) {
/* Interrupts not Disabled */
/* XXX: what on earth is this code trying to accomplish by calling
getsignaldata
*/
#if !defined(KBINT) || defined(OS4)
getsignaldata(0);
#endif
EXT;
update_timer();
@@ -1128,10 +1152,49 @@ check_interrupt:
}
}
#ifdef DOS
if (currentkbd->URaid == TRUE) {
currentkbd->URaid = NIL;
(currentkbd->device.exit)(currentkbd); /* Install the original handler */
error("Call URaid by User Interrupt");
} else if (currentmouse->Cursor.Moved) {
union REGS regs;
currentdsp->device.locked++;
/* Remove the mouse from the old place on the screen */
(currentdsp->mouse_invisible)(currentdsp, IOPage68K);
/* Find the new delta */
regs.w.eax = 0x000B; /* Function 0xB = get delta mickeys */
int86(0x33, &regs, &regs);
currentmouse->Cursor.New.x += (short)regs.w.ecx;
currentmouse->Cursor.New.y += (short)regs.w.edx;
if (currentmouse->Cursor.New.x < 0)
currentmouse->Cursor.New.x = 0;
else if (currentmouse->Cursor.New.x > (currentdsp->Display.width - 1))
currentmouse->Cursor.New.x = currentdsp->Display.width - 1;
if (currentmouse->Cursor.New.y < 0)
currentmouse->Cursor.New.y = 0;
else if (currentmouse->Cursor.New.y > (currentdsp->Display.height - 1))
currentmouse->Cursor.New.y = currentdsp->Display.height - 1;
IOPage68K->dlmousex = IOPage68K->dlcursorx = currentmouse->Cursor.New.x;
IOPage68K->dlmousey = IOPage68K->dlcursory = currentmouse->Cursor.New.y;
/* Paint the mouse back up on the screen on the new place */
(currentdsp->mouse_visible)(currentmouse->Cursor.New.x, currentmouse->Cursor.New.y);
currentmouse->Cursor.Moved = FALSE;
currentdsp->device.locked--;
}
#else
if (URaid_req == T) {
URaid_req = NIL;
error("Call URaid by User Interrupt");
}
#endif /* DOS */
else if ((KBDEventFlg > 0) && (*KEYBUFFERING68k == ATOM_T)) {
*KEYBUFFERING68k = ATOM_STARTED;
cause_interruptcall(DOBUFFEREDTRANSITION_index);

View File

@@ -66,7 +66,7 @@ void Init_XCursor() {
cursorlist->next = NULL;
for (i = 0; i < CURSORHEIGHT; i++) cursorlist->bitmap[i] = newbm[i];
set_Xcursor(currentdsp, (uint8_t *)newbm, 0, 0, &(cursorlist->Xid), 1);
DefineCursor(currentdsp->display_id, currentdsp->DisplayWindow, &(cursorlist->Xid));
DefineCursor(currentdsp, currentdsp->DisplayWindow, &(cursorlist->Xid));
} /* end Init_XCursor */
/************************************************************************/
@@ -120,8 +120,8 @@ void Set_XCursor(int x, int y)
clp->next = cursorlist;
cursorlist = clp;
}
DefineCursor(currentdsp->display_id, currentdsp->DisplayWindow, &(clp->Xid));
XUNLOCK; /* Signals OK now */
DefineCursor(currentdsp, currentdsp->DisplayWindow, &(clp->Xid));
XUNLOCK(currentdsp); /* Signals OK now */
#ifdef NEWXCURSOR
/* Save the hotspot for later position reporting/setting */
@@ -140,16 +140,16 @@ void Set_XCursor(int x, int y)
/* */
/************************************************************************/
void init_Xcursor(Display *display, Window window)
void init_Xcursor(DspInterface dsp)
{
TPRINT(("TRACE: init_Xcursor()\n"));
XLOCK; /* Take no X signals during this activity (ISC 386) */
XAllocNamedColor(display, Colors, "black", &cursor_fore_xcsd, &xced);
XAllocNamedColor(display, Colors, "white", &cursor_back_xcsd, &xced);
XAllocNamedColor(dsp->display_id, Colors, "black", &cursor_fore_xcsd, &xced);
XAllocNamedColor(dsp->display_id, Colors, "white", &cursor_back_xcsd, &xced);
XUNLOCK; /* OK to take signals again */
XUNLOCK(dsp); /* OK to take signals again */
} /* end init_Xcursor */
@@ -190,6 +190,6 @@ void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hot
XFreePixmap(dsp->display_id, Cursor_msk);
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
} /* end set_Xcursor */

View File

@@ -11,6 +11,7 @@
#include "version.h"
#include <assert.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
@@ -29,6 +30,7 @@
#include "adr68k.h"
#include "xinitdefs.h"
#include "dspifdefs.h"
#include "timerdefs.h"
#include "xbbtdefs.h"
#include "xlspwindefs.h"
#include "xwinmandefs.h"
@@ -62,8 +64,8 @@ unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight;
Colormap Colors;
int XLocked = 0; /* non-zero while doing X ops, to avoid signals */
extern fd_set LispReadFds;
volatile sig_atomic_t XLocked = 0; /* non-zero while doing X ops, to avoid signals */
volatile sig_atomic_t XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
/************************************************************************/
/* */
@@ -106,13 +108,11 @@ void lisp_Xexit(DspInterface dsp)
{
assert(Lisp_Xinitialized);
#if defined(OS5) && defined(I_SETSIG)
ioctl(ConnectionNumber(dsp->display_id), I_SETSIG, 0); /* so no interrupts happen during */
#endif
XLOCK;
XDestroySubwindows(dsp->display_id, dsp->LispWindow);
XDestroyWindow(dsp->display_id, dsp->LispWindow);
XCloseDisplay(dsp->display_id);
XUNLOCK(dsp);
Lisp_Xinitialized = false;
} /* end lisp_Xexit */
@@ -140,7 +140,7 @@ void Xevent_before_raid(DspInterface dsp)
XLOCK;
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
} /* end Xevent_before_raid */
/************************************************************************/
@@ -158,7 +158,7 @@ void Xevent_after_raid(DspInterface dsp)
dsp->Visible.height);
XLOCK;
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
} /* end Xevent_after_raid */
@@ -176,9 +176,6 @@ void Open_Display(DspInterface dsp)
{
assert(Lisp_Xinitialized == false);
FD_SET(ConnectionNumber(dsp->display_id), &LispReadFds);
fcntl(ConnectionNumber(dsp->display_id), F_SETOWN, getpid());
/****************************************************/
/* If debugging, set the X connection so that */
/* we run synchronized--so a debugger can */
@@ -196,7 +193,7 @@ void Open_Display(DspInterface dsp)
Create_LispWindow(dsp); /* Make the main window */
Lisp_Xinitialized = true;
init_Xevent(dsp); /* Turn on the intrpts. */
init_Xevent(dsp); /* Turn on the event reporting */
} /* end OpenDisplay */
/*********************************************************************/
@@ -322,9 +319,11 @@ DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int heig
dsp->ScreenBitmap.bitmap_bit_order = MSBFirst;
dsp->ScreenBitmap.bitmap_pad = 32;
dsp->ScreenBitmap.depth = 1;
dsp->ScreenBitmap.bits_per_pixel = 1;
dsp->ScreenBitmap.bytes_per_line =
((dsp->Display.width + (BITSPER_DLWORD - 1)) / BITSPER_DLWORD) * (BITSPER_DLWORD / 8);
break;
}
XInitImage(&dsp->ScreenBitmap);
return (dsp);
}

View File

@@ -140,7 +140,7 @@ void Create_LispWindow(DspInterface dsp)
save_argc, &szhint, &Lisp_WMhints, &xclasshint);
XSelectInput(dsp->display_id, dsp->LispWindow, dsp->EnableEventMask);
init_Xcursor(dsp->display_id, dsp->LispWindow);
init_Xcursor(dsp);
dsp->DisplayWindow = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, 0, 0,
dsp->Visible.width, dsp->Visible.height, 0,
@@ -195,7 +195,7 @@ void Create_LispWindow(DspInterface dsp)
dsp->ScrollBarWidth, /* width */
dsp->Visible.height, dsp->InternalBorderWidth,
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
DefineCursor(dsp->display_id, dsp->VerScrollBar, &VertScrollCursor);
DefineCursor(dsp, dsp->VerScrollBar, &VertScrollCursor);
XMapWindow(dsp->display_id, dsp->VerScrollBar);
dsp->HorScrollBar = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow,
@@ -203,7 +203,7 @@ void Create_LispWindow(DspInterface dsp)
dsp->Visible.width, /* width */
dsp->ScrollBarWidth, dsp->InternalBorderWidth,
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
DefineCursor(dsp->display_id, dsp->HorScrollBar, &HorizScrollCursor);
DefineCursor(dsp, dsp->HorScrollBar, &HorizScrollCursor);
XChangeWindowAttributes(dsp->display_id, dsp->HorScrollBar, CWOverrideRedirect,
&Lisp_SetWinAttributes);
XMapWindow(dsp->display_id, dsp->HorScrollBar);
@@ -237,7 +237,7 @@ void Create_LispWindow(DspInterface dsp)
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NWGrav, dsp->GravityOnPixmap);
DefineCursor(dsp->display_id, dsp->NWGrav, &DefaultCursor);
DefineCursor(dsp, dsp->NWGrav, &DefaultCursor);
XChangeWindowAttributes(dsp->display_id, dsp->NWGrav, CWOverrideRedirect, &Lisp_SetWinAttributes);
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->NWGrav);
@@ -246,7 +246,7 @@ void Create_LispWindow(DspInterface dsp)
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SEGrav, dsp->GravityOffPixmap);
DefineCursor(dsp->display_id, dsp->SEGrav, &DefaultCursor);
DefineCursor(dsp, dsp->SEGrav, &DefaultCursor);
XChangeWindowAttributes(dsp->display_id, dsp->SEGrav, CWOverrideRedirect, &Lisp_SetWinAttributes);
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->SEGrav);
@@ -255,7 +255,7 @@ void Create_LispWindow(DspInterface dsp)
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SWGrav, dsp->GravityOffPixmap);
DefineCursor(dsp->display_id, dsp->SWGrav, &DefaultCursor);
DefineCursor(dsp, dsp->SWGrav, &DefaultCursor);
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->SWGrav);
@@ -263,16 +263,16 @@ void Create_LispWindow(DspInterface dsp)
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NEGrav, dsp->GravityOffPixmap);
DefineCursor(dsp->display_id, dsp->NEGrav, &DefaultCursor);
DefineCursor(dsp, dsp->NEGrav, &DefaultCursor);
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->NEGrav);
/* DefineCursor( dsp->display_id, dsp->DisplayWindow, &WaitCursor ); */
/* DefineCursor( dsp, dsp->DisplayWindow, &WaitCursor ); */
XLOCK;
XMapWindow(dsp->display_id, dsp->LispWindow);
XFlush(dsp->display_id);
XUNLOCK;
XUNLOCK(dsp);
}
void lisp_Xvideocolor(int flag)
@@ -303,7 +303,7 @@ void lisp_Xvideocolor(int flag)
}
XFlush(currentdsp->display_id);
XUNLOCK;
XUNLOCK(currentdsp);
} /* end lisp_Xvideocolor */
@@ -322,7 +322,7 @@ void set_Xmouseposition(int x, int y)
XWarpPointer(currentdsp->display_id, (Window)NULL, currentdsp->DisplayWindow, 0, 0, 0, 0,
dest_x, dest_y);
XFlush(currentdsp->display_id);
XUNLOCK;
XUNLOCK(currentdsp);
}
} /* end set_Xmouseposition */
@@ -340,8 +340,8 @@ void DoRing() {
KBEVENT *kbevent;
TPRINT(("TRACE: DoRing()\n"));
do_ring:
/* DEL is not generally present on a Mac X keyboard, Ctrl-shift-ESC would be 18496 */
if (((*EmKbdAd268K) & 2113) == 0) { /*Ctrl-shift-NEXT*/
error("****** EMERGENCY Interrupt ******");
*EmKbdAd268K = KB_ALLUP; /*reset*/

Some files were not shown because too many files have changed in this diff Show More