2014-11-24 10:44:16 -07:00
### Description
2014-11-26 09:14:47 -07:00
`c2d` is a small utility that will read Apple II binary and monitor text files and output a DOS ordered diskette image that will boot your code quickly.
2014-11-24 10:44:16 -07:00
> Based on work by:
2017-04-02 10:59:16 -06:00
>
2023-05-10 17:24:58 -06:00
> Weishaar, Tom. *Running without filenames*. Open-Apple Jan. 1985 Vol. 1, No. 0: p. 7 (<https://web.archive.org/web/20150325102420/http://apple2online.com/web_documents/Open%20Apple%20Vol1No00.pdf>)
2014-11-24 10:44:16 -07:00
2017-05-06 12:22:59 -06:00
`c2d` early history: http://macgui.com/usenet/?group=1& id=254902#msg
2014-11-24 10:44:16 -07:00
### Features
2017-05-06 12:22:59 -06:00
* `$800-$B6FF` available for binary code.
2017-05-06 12:24:37 -06:00
* `$B700-$BFFF` free after load.
2014-11-24 10:44:16 -07:00
* Platforms tested:
2017-05-11 16:11:02 -06:00
* 32-bit/64-bit x86 MacOS|OS/X.
2014-11-24 10:44:16 -07:00
* 32-bit x86 Windows/MinGW.
### Download
```
git clone https://github.com/datajerk/c2d.git
```
*or*
Download < https: / / github . com / datajerk / c2d / archive / master . zip > and extract.
2023-05-10 17:37:01 -06:00
### No Build Notes
Just get the files from [`bin` ](https://github.com/datajerk/c2d/tree/master/bin ). 32-bit Windows and MacOS (universal x86_64/arm64) included.
2014-11-24 10:44:16 -07:00
### Build Notes
2017-04-02 11:01:46 -06:00
Unix/Linux:
make
*or*
2017-05-11 16:11:02 -06:00
MacOS|OS/X, Linux, Cygwin:
2014-11-24 10:44:16 -07:00
2017-04-08 21:16:48 -06:00
gcc -Wall -Wno-missing-braces -I. -O3 -o c2d c2d.c -lm
gcc -Wall -O3 -o bin/text2page text2page.c -lm
2017-04-15 21:39:00 -06:00
gcc -Wall -O3 -o bin/page2text page2text.c -lm
2014-11-24 10:44:16 -07:00
Windows/MinGW:
PATH=C:\MinGW\bin;%PATH%
2017-04-08 21:16:48 -06:00
gcc -Wall -Wno-missing-braces -static -I. -O3 -o c2d c2d.c -lm
gcc -Wall -O3 --static -o bin/text2page text2page.c -lm
2017-04-15 21:39:00 -06:00
gcc -Wall -O3 --static -o bin/page2text page2text.c -lm
2017-04-08 21:16:48 -06:00
2014-11-24 10:44:16 -07:00
2017-04-08 21:16:48 -06:00
### c2d Usage/Examples
2014-11-24 10:44:16 -07:00
```
usage: c2d [-vh?]
2017-05-03 11:37:16 -06:00
c2d [-bgm] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk
2014-11-24 10:44:16 -07:00
-h|? this help
-m jump to monitor after booting
2017-04-01 20:04:06 -06:00
-s XXXX jump to XXXX after booting
2017-04-22 10:33:53 -06:00
-t filename, where filename is a 1K $400-$7FF text page splash screen
The splash screen will display while the binary is loading
2017-05-03 11:37:16 -06:00
-b animated loading bar
-g splash page is mixed mode GR
2017-04-22 20:36:47 -06:00
-r override row default of 19 with 'row'
2014-11-24 10:44:16 -07:00
-v print version number and exit
2017-04-08 21:16:48 -06:00
Input without a .mon extension is assumed to be a binary with a 4 byte header.
2014-11-24 10:44:16 -07:00
If the header is missing then you must append ,load_address to the binary input
filename, e.g. filename,800. The load address will be read as hex.
input with a .mon extension expected input format:
0800: A2 FF 9A 20 8C 02 20 4F
0808: 03 4C 00 FF 20 9E 02 A9
Examples:
c2d hello hello.dsk
c2d hello.mon hello.dsk
c2d hello,800 hello.dsk
c2d -m test,300 test.dsk
2017-04-02 10:59:16 -06:00
c2d -s 7300 alpha4,400 alpha4.dsk
2017-04-08 21:16:48 -06:00
c2d -t gameserverclient.textpage gameserverclient,800 gameserverclient.dsk
```
2017-05-03 11:37:16 -06:00
### Splash Page Examples
2017-05-03 11:43:15 -06:00
*Click on image to see video.*
2019-06-23 09:54:29 -06:00
> Splash pages are the exact bytes the Apple II expects in memory range $400-$7FF. Your splash screen should be exactly 1024 bytes (do not worry, the `c2d` loader will not overwrite the Peripheral Slot Scratchpad RAM).
2017-05-03 11:37:16 -06:00
```
c2d -t gameserverclient.textpage gameserverclient,800 gameserverclient.dsk
```
2017-05-05 07:40:00 -06:00
`-t gameserverclient.textpage` instructs `c2d` to put up a text splash page while the binary is loading.
2017-05-03 11:37:16 -06:00
[](https://www.youtube.com/watch?v=9EPy0JnnJyA "splash")
2017-05-05 07:40:00 -06:00
-----
2017-05-03 11:37:16 -06:00
```
c2d -b -t barloader.textpage gameserverclient,800 gameserverclientbar.dsk
```
`-b` adds an animated bar on line 19.
[](https://www.youtube.com/watch?v=D3SaHlw4fgM "splashbar")
2017-05-05 07:40:00 -06:00
-----
2017-05-03 11:37:16 -06:00
```
c2d -b -g -r 23 -t bargrloader.textpage gameserverclient,800 gameserverclientbargr.dsk
```
`-r 23` moves the animated bar to line 23, and `-g` indicates the splash page is mixed mode text/gr.
[](https://www.youtube.com/watch?v=4Ik1eraAM6c "splashbargr")
2017-04-08 21:16:48 -06:00
### text2page Example
2017-04-22 20:16:01 -06:00
Input is expected to be ASCII text (LF or CRLF line terminated). Only the first 40 characters/line and the first 24 lines are read. See `gameserverclient.text` and `barloader.text` examples.
2017-04-08 21:16:48 -06:00
```
text2page < gameserverclient.text > gameserverclient.textpage
2014-11-24 10:44:16 -07:00
```
2017-04-15 21:39:00 -06:00
### page2text Example
Input is expected to be an Apple II binary from $400-$7FF. Exactly 1024 bytes. See `gameserverclient.textpage` example.
2017-04-16 14:13:53 -06:00
> Text output lines are newline (LF) terminated. Windows users may need to convert LF to CRLF (editor dependent).
2017-04-15 21:39:00 -06:00
```
page2text < gameserverclient.textpage > gameserverclient.text
```
2017-04-23 11:13:10 -06:00
### Testing
2017-05-11 16:11:02 -06:00
Automated testing is only supported on MacOS|OS/X and requires the following:
2017-04-23 11:13:10 -06:00
* Virtual ][ (< http: // http: // www . virtualii . com /> )
2023-05-10 17:24:58 -06:00
* Windows cross-compiling tools < https: // web . archive . org / web / 20151009134313 / http: // crossgcc . rts-software . org / download / gcc-4 . 8 . 0-qt-4 . 8 . 4-win32 / gcc-4 . 8 . 0-qt-4 . 8 . 4-for-mingw32 . dmg >
* Docker required for Windows binary testing; run this once first `docker build --no-cache -t wine32 -f Dockerfile.wine32 .`
NOTE: Windows binary testing only supported on MacOS x86_64 machines.
2017-04-23 11:13:10 -06:00
To test, type:
```
2017-05-11 16:11:02 -06:00
make test # MacOS|OS/X only
make disttest # MacOS|OS/X and Windows
make fulltest # MacOS|OS/X, Windows, and Virtual ][
2017-04-23 11:13:10 -06:00
```
2017-04-02 11:08:03 -06:00
### Bugs
Yes. No input checking. Big Endian untested.
2014-11-24 10:44:16 -07:00
### The Ugly Stuff
2017-05-03 11:37:16 -06:00
c2d, Code to Disk, Version 0.57
2014-11-24 10:44:16 -07:00
2017-04-01 19:09:16 -06:00
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense .net)
2014-11-24 10:44:16 -07:00
2017-04-01 19:09:16 -06:00
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
2014-11-24 10:44:16 -07:00
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
2017-04-02 10:59:16 -06:00
License: Do what you like, remember to credit all sources when using.
2014-11-24 10:44:16 -07:00