WinComm/vbx/makefile
Scott Duensing d68405550d Fix COMM.DRV calling conventions and add ComDEB compatibility
Resolve GPFs in both USER.EXE and COMMTASK.DLL by correcting RETF
sizes for SETCOM and GETDCB, confirmed by disassembling CyberCom.DRV.
Add stock-compatible ComDEB structure so third-party code (ProComm
COMMTASK.DLL) can safely access internal fields at known offsets per
Microsoft KB Q101417.

COMM.DRV changes:
- SETCOM (ord 2): RETF 4, takes DCB FAR * only (not commId + DCB*)
- GETDCB (ord 15): RETF 2, takes commId, returns DCB FAR * in DX:AX
- Add 40-byte ComDebT matching stock COMM.DRV internal layout
  (evtWord at +0, MSR shadow at +35, queue counts at +8/+18)
- cevt returns pointer to ComDebT for third-party compatibility
- Sync ComDEB fields in ISR dispatch, reccom, sndcom, cflush, setque
- Move WEP to ordinal 16, add ordinal 101 stub (match stock/CyberCom)
- Default DBG_ENABLED to 0 (set to 1 to re-enable debug logging)

VBX control fixes:
- Fix SETBREAK/CLRBREAK constants (use numeric 8/9, not undefined macros)
- Fix serialEnableNotify return type (BOOL, not int16_t)
- Fix mscomm.h to work with RC compiler (#ifndef RC_INVOKED)
- Fix vbapi.h USHORT typedef and MODEL.flWndStyle type
- Add vbapi.lib dependency to makefile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 20:03:34 -06:00

90 lines
2.8 KiB
Makefile

# makefile - MSComm VBX control for MSVC 1.52
#
# Build: nmake
# Clean: nmake clean
#
# Prerequisites:
# - MSVC 1.52 (cl, link, rc in PATH)
# - VBAPI.LIB (from VBX CDK, or generate with: implib vbapi.lib vbapi.def)
#
# High-speed serial note:
# The stock Windows 3.1 COMM.DRV enables the 16550 FIFO for receive only,
# with a trigger level of 14 (leaving only 2 bytes of headroom). This causes
# overruns at baud rates above 9600 under load. For reliable operation at
# 57600 or 115200, install CyberCom V1.1.0.0P -- a freeware drop-in
# replacement included in ..\drivers\CYBERCOM.DRV. It enables both RX and TX
# FIFOs with a trigger level of 8, dramatically reducing interrupt overhead.
#
# Install:
# 1. Copy ..\drivers\CYBERCOM.DRV to \WINDOWS\SYSTEM
# 2. Edit SYSTEM.INI [boot] section: comm.drv=cybercom.drv
# 3. Add to [386Enh] section: COM1FIFO=1 (for each port in use)
# 4. Restart Windows
#
# CyberCom is free for non-commercial use. (C) CyberSoft Corp 1993
CC = cl
LINK = link
RC = rc
# Compiler flags:
# -c Compile only
# -W3 Warning level 3
# -ASw Small model, SS!=DS (Windows DLL)
# -Gsw No stack probes, Windows prolog/epilog
# -Ow Safe optimizations for Windows
# -Zp2 Pack structures on 2-byte boundaries
# -Ze Enable Microsoft extensions
CFLAGS = -c -W3 -ASw -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
# commdlg Common dialog import library
# vbapi VB API import library
LIBS = sdllcew libw commdlg vbapi
# Output
TARGET = mscomm.vbx
# Objects
OBJS = mscomm.obj serial.obj
# -----------------------------------------------------------------------
# Build rules
# -----------------------------------------------------------------------
all: $(TARGET)
$(TARGET): $(OBJS) mscomm.def mscomm.res vbapi.lib
$(LINK) $(LFLAGS) $(OBJS), $(TARGET),,$(LIBS), mscomm.def
$(RC) mscomm.res $(TARGET)
mscomm.obj: mscomm.c mscomm.h vbapi.h serial.h
$(CC) $(CFLAGS) mscomm.c
serial.obj: serial.c serial.h
$(CC) $(CFLAGS) serial.c
mscomm.res: mscomm.rc mscomm.h mscomm.bmp
$(RC) -r mscomm.rc
# -----------------------------------------------------------------------
# Generate VBAPI.LIB from vbapi.def if not present
# -----------------------------------------------------------------------
vbapi.lib: vbapi.def
implib vbapi.lib vbapi.def
# -----------------------------------------------------------------------
# Clean
# -----------------------------------------------------------------------
clean:
-del *.obj
-del *.res
-del *.vbx
-del *.map