You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+26-21Lines changed: 26 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Over time this project has become more complete, and I've now implemented enough
13
13
* BBC and Microsoft BASIC.
14
14
* Wordstar.
15
15
16
-
As things stand this project is "complete". I'd like to increase the test-coverage for my own reassurance, but I've now reached a point where all the binaries I've tried to execute work as expected. If you find a program that _doesn't_ work please [open an issue](https://github.com/skx/cpmulator/issues), beyond that I think this project is "complete" and future development will be minimal, and sporadic.
16
+
As things stand this project is "complete". I'd like to increase the test-coverage for my own reassurance, but I've now reached a point where all the binaries I've tried to execute work as expected. If you find a program that _doesn't_ work please [open an issue](https://github.com/skx/cpmulator/issues), otherwise I suspect ongoing development will be minimal, and sporadic.
17
17
18
18
> **NOTE** I've not implemented any notion of disk-support. This means that opening, reading/writing, and closing files is absolutely fine, but any API call that refers to tracks, sectors, or disks will fail (with an "unimplemented syscall" error).
19
19
@@ -62,22 +62,6 @@ Releases will be made as/when features seem to justify it, but it should be note
62
62
63
63
64
64
65
-
# Portability
66
-
67
-
The CP/M input handlers need to disable echoing when reading (single) characters from STDIN. There isn't a simple and portable solution for this in golang, although the appropriate primitives exist so building such support isn't impossible.
*[ReadPassword](https://pkg.go.dev/golang.org/x/term#ReadPassword) - ReadPassword reads a line of input from a terminal without local echo.
73
-
74
-
Unfortunately there is no code there for reading only a _single character_, rather than a complete line. In the interest of expediency I resort to executing the `stty` binary, rather than attempting to use the `x/term` package to manage echo/noecho state myself, and this means the code in this repository isn't 100% portable; it will work on Linux and MacOS hosts, but not Windows.
75
-
76
-
I've got an open bug about fixing the console (input), [#65](https://github.com/skx/cpmulator/issues/65).
77
-
78
-
79
-
80
-
81
65
# Usage
82
66
83
67
If you launch `cpmulator` with no arguments then the default CCP ("console command processor") will be launched, dropping you into a familiar shell:
There are several command-line options which are shown in the output of `cpmulator -help`, but the following summary shows the most important/useful options:
126
+
There are many available command-line options, which are shown in the output of `cpmulator -help`, but the following summary shows the most important/useful options:
143
127
144
128
*`-cd /path/to/directory`
145
129
* Change to the given directory before running.
@@ -152,6 +136,7 @@ There are several command-line options which are shown in the output of `cpmulat
152
136
* All output which CP/M sends to the "printer" will be written to the given file.
153
137
*`-list-syscalls`
154
138
* Dump the list of implemented BDOS and BIOS syscalls.
139
+
*`-list-input-drivers` and `-list-output-drivers` to see the available I/O driver-names, which may then be selected via the `-input` and `-output` flags.
155
140
*`-version`
156
141
* Show the version number of the emulator, and exit.
157
142
@@ -171,9 +156,9 @@ This allows you to customize the emulator, or perform other "one-time" setup via
171
156
172
157
## Runtime Behaviour Changes
173
158
174
-
There are a small number of [extensions](EXTENSIONS.md) added to the BIOS functionality we provide, and these extensions allow changing the behaviour of the emulator at runtime.
159
+
There are a small number of [extensions](EXTENSIONS.md) added to the BIOS functionality we provide, and these extensions allow changing some aspects of the emulator at runtime.
175
160
176
-
The behaviour changing is achieved by having a small number of .COM files invoke the extension functions, and these binaries are embedded within our emulator to improve ease of use, via the [static/](static/) directory in our source-tree - This means no matter what you'll always find some binaries installed on A:, despite not being present in reality.
161
+
The behaviour changing is achieved by having a small number of .COM files invoke the extension functions, and these binaries are embedded within our emulator to improve ease of use, via the [static/](static/) directory in our source-tree. This means no matter what you'll always find some binaries installed on A:, despite not being present in reality.
177
162
178
163
> **NOTE** To avoid naming collisions all our embedded binaries are named with a `!` prefix, except for `#.COM` which is designed to be used as a comment-binary.
179
164
@@ -192,12 +177,14 @@ The binary `A:!CTRLC.COM` which lets you change this at runtime. Run `A:!CTRLC
192
177
193
178
### Console Output
194
179
195
-
We default to pretending our output device is an ADM-3A terminal, this can be changed via the `-console` command-line flag at startup. Additionally it can be changed at runtime via `A:!CONSOLE.COM`.
180
+
We default to pretending our output device is an ADM-3A terminal, this can be changed via the `-output` command-line flag (previously `-console`) at startup. Additionally it can be changed at runtime via `A:!CONSOLE.COM`.
196
181
197
182
Run `A:!CONSOLE ansi` to disable the output emulation, or `A:!CONSOLE adm-3a` to restore it.
198
183
199
184
You'll see that the [cpm-dist](https://github.com/skx/cpm-dist) repository contains a version of Wordstar, and that behaves differently depending on the selected output handler. Changing the handler at run-time is a neat bit of behaviour.
200
185
186
+
You'll note it is **not** possible to change the console _input_ driver at runtime, I think once you know which works best upon your system it doesn't make sense to change this interactively.
187
+
201
188
202
189
### Debug Handling
203
190
@@ -207,6 +194,8 @@ runtime.
207
194
208
195
`A:!DEBUG.COM` will show the state of the flag, and it can be enabled with `A:!DEBUG 1` or disabled with `!DEBUG 0`.
209
196
197
+
Finally `A:!VERSION.COM` will show you the version of the emulator you're running.
198
+
210
199
211
200
212
201
@@ -326,6 +315,22 @@ The implementation of the syscalls is the core of our emulator, and they can be
326
315
327
316
328
317
318
+
# Portability
319
+
320
+
The CP/M input handlers need to disable echoing when reading (single) characters from STDIN. There isn't a simple and portable solution for this in golang, although the appropriate primitives exist so building such support isn't impossible, it just relies upon writing per-environment support, using something like the [ReadPassword](https://pkg.go.dev/golang.org/x/term#ReadPassword) function from the standard-library.
321
+
322
+
I sidestepped this whole problem initially, just invoking the `stty` binary to enable/disable the echoing of characters on-demand, but that only works on Linux, BSD, and Mac hosts. To be properly portable I had to use the [termbox](https://github.com/nsf/termbox-go) library for all input, but that means we get no scrollback/history so there's a tradeoff to be made.
323
+
324
+
By default input will be read via `termbox` but you may you specify a different driver via the CLI arguments:
325
+
326
+
*`cpmulator -input xxx`
327
+
* Use the input-driver named `xxx`.
328
+
*`cpmulator -list-input-drivers`
329
+
* List all available input-drivers.
330
+
331
+
332
+
333
+
329
334
# Debugging Failures & Tweaking Behaviour
330
335
331
336
When an unimplemented BIOS call is attempted the program it will abort with a fatal error, for example:
0 commit comments