skx / cpmulator

Golang CP/M emulator for zork, Microsoft BASIC, Turbo Pascal, Wordstar, lighthouse-of-doom, etc
MIT License
98 stars 3 forks source link

Add full I/O options for embedded files #142

Closed skx closed 1 month ago

skx commented 2 months ago

We embed the contents of static/A within our binary, such that binaries are always present at run-time.

(e.g. "A:!CCP", or "A:!DEBUG").

This is useful because it ensures that users don't need to hunt down binaries, and things are always present.

However it isn't possible to import arbitrary files - you cannot build a version of cpmulator by just adding "static/A/ZORK1.COM" and "static/A/ZORK1.DAT" because I only implemented a couple of the I/O options which are required for the CCP to load & execute them.

Add missing primitives for static files:

Looks like I just need to add:

Of these adding only the last one would let us embed zork1 - which calls a lot of ReadRand against the associated data-file ZORK1.DAT:

A>!debug 1
031 RESERVE1
009 C_WRITESTRING
debug mode is on.
000 P_TERMCPM
032 F_USERNUM
013 DRV_ALLRESET
014 DRV_SET
..
A:>G:
G:>ZORK1
026 F_DMAOFF
025 DRV_GET
015 F_OPEN
026 F_DMAOFF
020 F_READ
026 F_DMAOFF
020 F_READ
..
033 F_READRAND
033 F_READRAND
033 F_READRAND
ZORK I: The Great Underground Empire
Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights
reserved.
ZORK is a registered trademark of Infocom, Inc.
Revision 88 / Serial number 840726

033 F_READRAND
033 F_READRAND
033 F_READRAND
033 F_READRAND
033 F_READRAND
033 F_READRAND
033 F_READRAND
033 F_READRAND
West of House
You are standing in an open field west of a white house, with
a boarded front door.
033 F_READRAND