90 lines
2.8 KiB
Makefile
90 lines
2.8 KiB
Makefile
# Part of KPCOMM, Copyright (c) 2026 Scott Duensing, under the MIT License.
|
|
# See LICENSE.md for license information.
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# makefile - High-speed COMM.DRV replacement for MSVC 1.52
|
|
#
|
|
# Build: nmake
|
|
# Clean: nmake clean
|
|
#
|
|
# Prerequisites:
|
|
# - MSVC 1.52 (cl, link in PATH)
|
|
#
|
|
# Output is KPCOMM.DRV -- drop-in replacement for the stock Windows 3.1 driver.
|
|
# Full documentation: README.md (features, settings, API) and ring0.md.
|
|
#
|
|
# Install:
|
|
# 1. Copy KPCOMM.DRV to \WINDOWS\SYSTEM
|
|
# 2. Edit SYSTEM.INI [boot] section: comm.drv=kpcomm.drv
|
|
# 3. Restart Windows
|
|
#
|
|
# Optional SYSTEM.INI [386Enh] settings (n = port number):
|
|
# COMnFIFO=0 Disable the 16550A FIFOs (default: enabled)
|
|
# COMnRxTRIGGER=x RX FIFO trigger level 1, 4, 8, or 14 bytes (default 4)
|
|
# COMnBuffer=x Minimum queue size in bytes, applied to every open
|
|
# COMnBase=x Hex base address, used when the BIOS has no entry
|
|
# COMnIRQ=x IRQ 2(=9), 3, 4, 5, 7, 9, 10, 11, 12, or 15
|
|
# COMnKeepDTR=1 CloseComm (and Windows exit) leaves DTR up (default: drop it)
|
|
#
|
|
# Key improvements over stock COMM.DRV:
|
|
# - Both RX and TX FIFOs enabled (stock: RX only)
|
|
# - RX trigger level configurable, default 4 (stock: 14 -- only 2 bytes headroom)
|
|
# - TX burst writes up to 16 bytes per THRE interrupt (stock: 1 byte)
|
|
|
|
CC = cl
|
|
LINK = link
|
|
|
|
# Compiler flags:
|
|
# -c Compile only
|
|
# -W3 Warning level 3
|
|
# -ASw Small model, SS!=DS (Windows DLL)
|
|
# -G2 80286 instructions (Windows 3.1 requires at least a 286)
|
|
# -Gsw No stack probes, Windows prolog/epilog
|
|
# -Ow Safe optimizations for Windows
|
|
# -Zp2 Pack structures on 2-byte boundaries (matches Windows SDK)
|
|
# -Ze Enable Microsoft extensions
|
|
# Port I/O, CLI/STI, and far memory helpers are made intrinsic with
|
|
# #pragma intrinsic in commdrv.h.
|
|
CFLAGS = -c -W3 -ASw -G2 -Gsw -Ow -Zp2 -Ze
|
|
|
|
# Linker flags:
|
|
# /NOD No default libraries
|
|
# /NOE No extended dictionary search
|
|
# /AL:16 Segment alignment 16
|
|
LFLAGS = /NOD /NOE /AL:16
|
|
|
|
# Libraries
|
|
# sdllcew Small model DLL C runtime (emulated math, Windows)
|
|
# libw Windows API import library
|
|
LIBS = sdllcew libw
|
|
|
|
# Output
|
|
TARGET = kpcomm.drv
|
|
|
|
# Objects
|
|
OBJS = commdrv.obj isr.obj lpt.obj
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Build rules
|
|
# -----------------------------------------------------------------------
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): $(OBJS) commdrv.def
|
|
$(LINK) $(LFLAGS) $(OBJS), $(TARGET),,$(LIBS), commdrv.def
|
|
|
|
commdrv.obj: commdrv.c commdrv.h
|
|
$(CC) $(CFLAGS) commdrv.c
|
|
|
|
isr.obj: isr.c commdrv.h
|
|
$(CC) $(CFLAGS) isr.c
|
|
|
|
lpt.obj: lpt.c commdrv.h
|
|
$(CC) $(CFLAGS) lpt.c
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Clean
|
|
# -----------------------------------------------------------------------
|
|
clean:
|
|
-del *.obj
|
|
-del *.drv
|
|
-del *.map
|