mirror of
https://github.com/datajerk/c2d.git
synced 2024-06-28 01:29:43 +00:00
Compare commits
80 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9af2b2d8fd | ||
|
f3991f4cd1 | ||
|
d74542dd56 | ||
|
11281905bd | ||
|
a54024f82a | ||
|
e4815fe220 | ||
|
9b1b8c423c | ||
|
6105800884 | ||
|
a64e5a176b | ||
|
ced20889ab | ||
|
e6e2c9b15a | ||
|
51933f3223 | ||
|
163d8a9661 | ||
|
e0d9e2a3ca | ||
|
e690a1c022 | ||
|
ecd49dd0bf | ||
|
0a4199ed9c | ||
|
6db80b8ae5 | ||
|
ebf2cfc94d | ||
|
5e85697fe4 | ||
|
7e03db4b42 | ||
|
e3a17ab29b | ||
|
a3721ecb54 | ||
|
8498a0ef05 | ||
|
249e6c2600 | ||
|
a191c5cd81 | ||
|
4c9315f2ef | ||
|
0c5f9bdae0 | ||
|
7b7ab6627d | ||
|
0e25155cf6 | ||
|
7f0c603000 | ||
|
f72e99fd34 | ||
|
3731f93a92 | ||
|
62fc5ab66b | ||
|
cc8d40c802 | ||
|
695afe66cc | ||
|
5e83553858 | ||
|
d00cb0a0ef | ||
|
081a78b10f | ||
|
f56cd484e6 | ||
|
7e5d0c1a23 | ||
|
080865007d | ||
|
186b015657 | ||
|
b12fa7e132 | ||
|
63be2912f3 | ||
|
72e8d00b8b | ||
|
d06d05565c | ||
|
12ea7313bd | ||
|
aea92e1415 | ||
|
ae3876a8f7 | ||
|
e841deb38e | ||
|
faaebeca7c | ||
|
7675e83b82 | ||
|
458dc9c6ff | ||
|
b5b24d2486 | ||
|
52db29a758 | ||
|
baedd4edd8 | ||
|
373c4ea6c6 | ||
|
f3b1afb67b | ||
|
459acf0fb7 | ||
|
64c48974d4 | ||
|
6f38a3d75f | ||
|
2bc0752f9d | ||
|
b41676bab8 | ||
|
68a976c7e6 | ||
|
412c1d2c74 | ||
|
2cd4829302 | ||
|
8e2ed42e0d | ||
|
bf8d9d465e | ||
|
9a39b98b35 | ||
|
169fa95e50 | ||
|
ee289c7d79 | ||
|
e1a469cf72 | ||
|
368161abc7 | ||
|
617d504af5 | ||
|
5a246f205b | ||
|
90a86105a7 | ||
|
00609d4106 | ||
|
35da6e5d99 | ||
|
686ac49d04 |
12
Dockerfile.wine32
Normal file
12
Dockerfile.wine32
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# docker build --no-cache -t wine32 -f Dockerfile.wine32 .
|
||||||
|
FROM ubuntu:19.10
|
||||||
|
|
||||||
|
ENV LC_CTYPE C.UTF-8
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
RUN dpkg --add-architecture i386
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get -qy install wine32
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
RUN wine foobar || true
|
116
Makefile
116
Makefile
|
@ -1,34 +1,124 @@
|
||||||
|
|
||||||
WIN32GCC = /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin/i586-mingw32-gcc
|
WIN32GCC = /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin/i586-mingw32-gcc
|
||||||
|
C2T = c2t
|
||||||
|
|
||||||
all: bin/c2d bin/text2page
|
all: bin/c2d bin/text2page bin/page2text
|
||||||
|
|
||||||
windows: bin/c2d.exe bin/text2page.exe
|
windows: bin/c2d.exe bin/text2page.exe bin/page2text.exe
|
||||||
|
|
||||||
dist: all windows
|
dist: all windows
|
||||||
|
|
||||||
c2d.h: c2d.h.0 asm/loader.s makeheader
|
cc65-sources-2.13.3.tar.bz2:
|
||||||
|
curl -sLO https://github.com/mrdudz/cc65-old/raw/master/cc65-sources-2.13.3.tar.bz2
|
||||||
|
|
||||||
|
cc65-2.13.3/bin/cl65: cc65-sources-2.13.3.tar.bz2
|
||||||
|
tar zxf cc65-sources-2.13.3.tar.bz2
|
||||||
|
(cd cc65-2.13.3; /usr/bin/sed 's!/usr/local!'${PWD}'/cc65-2.13.3!' <make/gcc.mak >Makefile; make -j4 bins || make bins && make install || true)
|
||||||
|
|
||||||
|
c2d.h: c2d.h.0 asm/loader.s asm/bar.s makeheader cc65-2.13.3/bin/cl65
|
||||||
./makeheader
|
./makeheader
|
||||||
|
|
||||||
bin/c2d: c2d.c c2d.h
|
bin/c2d_arm: c2d.c c2d.h
|
||||||
gcc -Wall -Wno-missing-braces -I. -O3 -o $@ $< -lm
|
$(CC) -Wall -Wno-missing-braces -I. -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/text2page_arm: text2page.c
|
||||||
|
$(CC) -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/page2text_arm: page2text.c
|
||||||
|
$(CC) -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/mandelbrotgr_arm: mandelbrotgr.c
|
||||||
|
$(CC) -Wall -O3 -target arm64-apple-macos11 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/c2d_x86: c2d.c c2d.h
|
||||||
|
$(CC) -Wall -Wno-missing-braces -I. -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/text2page_x86: text2page.c
|
||||||
|
$(CC) -Wall -O3 -target -x86_64-apple-macos10.12 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/page2text_x86: page2text.c
|
||||||
|
$(CC) -Wall -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/mandelbrotgr_x86: mandelbrotgr.c
|
||||||
|
$(CC) -Wall -O3 -target x86_64-apple-macos10.12 -o $@ $< -lm
|
||||||
|
|
||||||
|
bin/c2d: bin/c2d_x86 bin/c2d_arm
|
||||||
|
lipo -create -output $@ $<
|
||||||
|
|
||||||
|
bin/text2page: bin/text2page_x86 bin/text2page_arm
|
||||||
|
lipo -create -output $@ $<
|
||||||
|
|
||||||
|
bin/page2text: bin/page2text_x86 bin/page2text_arm
|
||||||
|
lipo -create -output $@ $<
|
||||||
|
|
||||||
|
bin/mandelbrotgr: bin/mandelbrotgr_x86 bin/mandelbrotgr_arm
|
||||||
|
lipo -create -output $@ $<
|
||||||
|
|
||||||
bin/c2d.exe: c2d.c c2d.h
|
bin/c2d.exe: c2d.c c2d.h
|
||||||
$(WIN32GCC) -Wall -Wno-missing-braces -I. -O3 -o $@ $<
|
$(WIN32GCC) -Wall -Wno-missing-braces -I. -O3 -o $@ $<
|
||||||
|
|
||||||
bin/text2page: text2page.c
|
|
||||||
gcc -Wall -O3 -o $@ $< -lm
|
|
||||||
|
|
||||||
bin/text2page.exe: text2page.c
|
bin/text2page.exe: text2page.c
|
||||||
$(WIN32GCC) -Wall -O3 -o $@ $<
|
$(WIN32GCC) -Wall -O3 -o $@ $<
|
||||||
|
|
||||||
|
bin/page2text.exe: page2text.c
|
||||||
|
$(WIN32GCC) -Wall -O3 -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f bin/* *.dsk c2d.h c2d.h.1
|
rm -rf bin/* *.dsk c2d.h c2d.h.1 cc65-sources-2.13.3.tar.bz2 cc65-2.13.3
|
||||||
(cd asm; make clean)
|
(cd asm; make clean)
|
||||||
|
|
||||||
gameserverclient.text:
|
gameserverclient.text: Makefile
|
||||||
figlet -c -w 40 -f slant "Game Server Client Online" >$@
|
( \
|
||||||
|
figlet -c -w 40 -f slant "Apple ][ Game Server Online!" | \
|
||||||
|
perl -p -e 's/^ +\n$$//' | \
|
||||||
|
sed '1,6s/^/ /'; \
|
||||||
|
echo; \
|
||||||
|
text="THE APPLE ][ AE WARESHOLE IS BACK!"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
text="CASSETTE PORT FTW! ---- ASCIIEXPRESS.NET"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
) | tail -24 >$@
|
||||||
|
|
||||||
test: gameserverclient gameserverclient.text dist
|
barloader.text: Makefile
|
||||||
./test.sh
|
( \
|
||||||
|
echo; \
|
||||||
|
figlet -c -w 40 -f poison "c2d"; \
|
||||||
|
echo; \
|
||||||
|
text="C2D (CODE TO DISK) BUILT-IN LOADER"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
echo; \
|
||||||
|
text="LOADING GAME SERVER CLIENT ..."; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
echo; \
|
||||||
|
text="________________________________________"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
text="________________________________________"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
echo; \
|
||||||
|
echo; \
|
||||||
|
text="HTTP://GITHUB.COM/DATAJERK/C2D"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||||
|
) | tail -24 >$@
|
||||||
|
|
||||||
|
barloader.textpage: barloader.text bin/text2page
|
||||||
|
bin/text2page <$< >$@
|
||||||
|
|
||||||
|
gameserverclientbar.dsk: barloader.textpage gameserverclient bin/c2d Makefile
|
||||||
|
bin/c2d -b -t $< gameserverclient,800 $@
|
||||||
|
|
||||||
|
bargrloader.textpage: bin/mandelbrotgr
|
||||||
|
bin/mandelbrotgr >$@
|
||||||
|
|
||||||
|
gameserverclientbargr.dsk: bargrloader.textpage gameserverclient bin/c2d Makefile
|
||||||
|
bin/c2d -b -g -r 23 -t $< gameserverclient,800 $@
|
||||||
|
|
||||||
|
gameserverclient.dsk: gameserverclient bin/c2d Makefile
|
||||||
|
bin/c2d gameserverclient,800 $@
|
||||||
|
|
||||||
|
dsk: gameserverclient.dsk gameserverclientbar.dsk gameserverclientbargr.dsk
|
||||||
|
|
||||||
|
gameserverclient.mon: gameserverclient
|
||||||
|
$(C2T) gameserverclient,800 gameserverclient.mon
|
||||||
|
|
||||||
|
fulltest: gameserverclient gameserverclient.mon gameserverclient.text gameserverclient.tiff gameserverclientsplash.tiff test.sh test.scrp dist
|
||||||
|
EMU=1 WIN=1 ./test.sh
|
||||||
|
|
||||||
|
disttest: gameserverclient gameserverclient.mon gameserverclient.text test.sh dist
|
||||||
|
EMU=0 WIN=1 ./test.sh
|
||||||
|
|
||||||
|
test: gameserverclient gameserverclient.mon gameserverclient.text test.sh all
|
||||||
|
EMU=0 WIN=0 ./test.sh
|
||||||
|
|
||||||
|
|
111
README.md
111
README.md
|
@ -4,36 +4,20 @@
|
||||||
|
|
||||||
> Based on work by:
|
> Based on work by:
|
||||||
>
|
>
|
||||||
> Weishaar, Tom. *Running without filenames*. Open-Apple Jan. 1985 Vol. 1, No. 0: p. 7 (<http://apple2online.com/web_documents/Open%20Apple%20Vol1No00.pdf>)
|
> 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>)
|
||||||
|
|
||||||
|
`c2d` early history: http://macgui.com/usenet/?group=1&id=254902#msg
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
|
* `$800-$B6FF` available for binary code.
|
||||||
|
* `$B700-$BFFF` free after load.
|
||||||
* Platforms tested:
|
* Platforms tested:
|
||||||
* 32-bit/64-bit x86 OS/X.
|
* 32-bit/64-bit x86 MacOS|OS/X.
|
||||||
* 32-bit x86 Windows/MinGW.
|
* 32-bit x86 Windows/MinGW.
|
||||||
|
|
||||||
|
|
||||||
### Distribution Files
|
|
||||||
|
|
||||||
| Filename | Description |
|
|
||||||
|-------------------|----------------------|
|
|
||||||
| README.md | This File |
|
|
||||||
| c2d.c | Source File |
|
|
||||||
| c2d.h.0 | Source File |
|
|
||||||
| makeheader | c2d.h build script |
|
|
||||||
| text2page.c | Source File |
|
|
||||||
| Makefile | c2d Makefile |
|
|
||||||
| asm/loader.s | c2d loader source |
|
|
||||||
| asm/Makefile | c2d loader Makefile |
|
|
||||||
| bin/c2d | OS/X x86 Binary |
|
|
||||||
| bin/c2d.exe | Windows Binary |
|
|
||||||
| bin/text2page | OS/X x86 Binary |
|
|
||||||
| bin/text2page.exe | Windows Binary |
|
|
||||||
| gameserverclient* | Test Apple II Binary |
|
|
||||||
| test.sh | test script |
|
|
||||||
|
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -45,6 +29,11 @@ git clone https://github.com/datajerk/c2d.git
|
||||||
Download <https://github.com/datajerk/c2d/archive/master.zip> and extract.
|
Download <https://github.com/datajerk/c2d/archive/master.zip> and extract.
|
||||||
|
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
|
||||||
### Build Notes
|
### Build Notes
|
||||||
|
|
||||||
Unix/Linux:
|
Unix/Linux:
|
||||||
|
@ -53,29 +42,34 @@ Unix/Linux:
|
||||||
|
|
||||||
*or*
|
*or*
|
||||||
|
|
||||||
OS/X, Linux, Cygwin:
|
MacOS|OS/X, Linux, Cygwin:
|
||||||
|
|
||||||
gcc -Wall -Wno-missing-braces -I. -O3 -o c2d c2d.c -lm
|
gcc -Wall -Wno-missing-braces -I. -O3 -o c2d c2d.c -lm
|
||||||
gcc -Wall -O3 -o bin/text2page text2page.c -lm
|
gcc -Wall -O3 -o bin/text2page text2page.c -lm
|
||||||
|
gcc -Wall -O3 -o bin/page2text page2text.c -lm
|
||||||
|
|
||||||
Windows/MinGW:
|
Windows/MinGW:
|
||||||
|
|
||||||
PATH=C:\MinGW\bin;%PATH%
|
PATH=C:\MinGW\bin;%PATH%
|
||||||
gcc -Wall -Wno-missing-braces -static -I. -O3 -o c2d c2d.c -lm
|
gcc -Wall -Wno-missing-braces -static -I. -O3 -o c2d c2d.c -lm
|
||||||
gcc -Wall -O3 --static -o bin/text2page text2page.c -lm
|
gcc -Wall -O3 --static -o bin/text2page text2page.c -lm
|
||||||
|
gcc -Wall -O3 --static -o bin/page2text page2text.c -lm
|
||||||
|
|
||||||
|
|
||||||
### c2d Usage/Examples
|
### c2d Usage/Examples
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: c2d [-vh?]
|
usage: c2d [-vh?]
|
||||||
c2d [-m] [-s start address override] input[.mon],[load_address] output.dsk
|
c2d [-bgm] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk
|
||||||
|
|
||||||
-h|? this help
|
-h|? this help
|
||||||
-m jump to monitor after booting
|
-m jump to monitor after booting
|
||||||
-s XXXX jump to XXXX after booting
|
-s XXXX jump to XXXX after booting
|
||||||
-t filename where filename is a 1K $400-$7FF text page splash screen.
|
-t filename, where filename is a 1K $400-$7FF text page splash screen
|
||||||
The splash screen will display while the binary is loading.
|
The splash screen will display while the binary is loading
|
||||||
|
-b animated loading bar
|
||||||
|
-g splash page is mixed mode GR
|
||||||
|
-r override row default of 19 with 'row'
|
||||||
-v print version number and exit
|
-v print version number and exit
|
||||||
|
|
||||||
Input without a .mon extension is assumed to be a binary with a 4 byte header.
|
Input without a .mon extension is assumed to be a binary with a 4 byte header.
|
||||||
|
@ -97,14 +91,75 @@ Examples:
|
||||||
c2d -t gameserverclient.textpage gameserverclient,800 gameserverclient.dsk
|
c2d -t gameserverclient.textpage gameserverclient,800 gameserverclient.dsk
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Splash Page Examples
|
||||||
|
|
||||||
|
*Click on image to see video.*
|
||||||
|
|
||||||
|
> 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).
|
||||||
|
|
||||||
|
```
|
||||||
|
c2d -t gameserverclient.textpage gameserverclient,800 gameserverclient.dsk
|
||||||
|
```
|
||||||
|
|
||||||
|
`-t gameserverclient.textpage` instructs `c2d` to put up a text splash page while the binary is loading.
|
||||||
|
|
||||||
|
[![splash](https://img.youtube.com/vi/9EPy0JnnJyA/0.jpg)](https://www.youtube.com/watch?v=9EPy0JnnJyA "splash")
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
```
|
||||||
|
c2d -b -t barloader.textpage gameserverclient,800 gameserverclientbar.dsk
|
||||||
|
```
|
||||||
|
|
||||||
|
`-b` adds an animated bar on line 19.
|
||||||
|
|
||||||
|
[![splash](https://img.youtube.com/vi/D3SaHlw4fgM/0.jpg)](https://www.youtube.com/watch?v=D3SaHlw4fgM "splashbar")
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
```
|
||||||
|
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.
|
||||||
|
|
||||||
|
[![splashbargr](https://img.youtube.com/vi/4Ik1eraAM6c/0.jpg)](https://www.youtube.com/watch?v=4Ik1eraAM6c "splashbargr")
|
||||||
|
|
||||||
### text2page Example
|
### text2page Example
|
||||||
|
|
||||||
Input is expected to be ASCII text. Only the first 40 characters/line and the first 24 lines are read. See `gameserverclient.text` example.
|
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.
|
||||||
|
|
||||||
```
|
```
|
||||||
text2page <gameserverclient.text >gameserverclient.textpage
|
text2page <gameserverclient.text >gameserverclient.textpage
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### page2text Example
|
||||||
|
|
||||||
|
Input is expected to be an Apple II binary from $400-$7FF. Exactly 1024 bytes. See `gameserverclient.textpage` example.
|
||||||
|
> Text output lines are newline (LF) terminated. Windows users may need to convert LF to CRLF (editor dependent).
|
||||||
|
|
||||||
|
```
|
||||||
|
page2text <gameserverclient.textpage >gameserverclient.text
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Automated testing is only supported on MacOS|OS/X and requires the following:
|
||||||
|
|
||||||
|
* Virtual ][ (<http://http://www.virtualii.com/>)
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
To test, type:
|
||||||
|
```
|
||||||
|
make test # MacOS|OS/X only
|
||||||
|
make disttest # MacOS|OS/X and Windows
|
||||||
|
make fulltest # MacOS|OS/X, Windows, and Virtual ][
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Bugs
|
### Bugs
|
||||||
|
|
||||||
Yes. No input checking. Big Endian untested.
|
Yes. No input checking. Big Endian untested.
|
||||||
|
@ -112,7 +167,7 @@ Yes. No input checking. Big Endian untested.
|
||||||
|
|
||||||
### The Ugly Stuff
|
### The Ugly Stuff
|
||||||
|
|
||||||
c2d, Code to Disk, Version 0.4, Sun Apr 9 03:16:22 UTC 2017
|
c2d, Code to Disk, Version 0.57
|
||||||
|
|
||||||
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
||||||
|
|
||||||
|
|
12
asm/Makefile
12
asm/Makefile
|
@ -1,9 +1,6 @@
|
||||||
|
|
||||||
CL = cl65
|
CL = cl65
|
||||||
CL_FLAGS = -t none --listing --list-bytes 100
|
CL_FLAGS = -t none --listing --list-bytes 100
|
||||||
#CL_FLAGS = -t apple1 -C apple1-16k.cfg --listing --list-bytes 100
|
|
||||||
CC = cl65
|
|
||||||
CC_FLAGS = --static-locals -t apple1 -C apple1-16k.cfg
|
|
||||||
C2T = c2t
|
|
||||||
|
|
||||||
ASRC = $(shell echo *.s)
|
ASRC = $(shell echo *.s)
|
||||||
AOBJ = $(ASRC:%.s=%.o)
|
AOBJ = $(ASRC:%.s=%.o)
|
||||||
|
@ -18,10 +15,3 @@ clean:
|
||||||
|
|
||||||
%: %.s
|
%: %.s
|
||||||
$(CL) $(CL_FLAGS) $<
|
$(CL) $(CL_FLAGS) $<
|
||||||
|
|
||||||
%: %.c
|
|
||||||
$(CC) $(CC_FLAGS) $<
|
|
||||||
|
|
||||||
%.mon: %
|
|
||||||
$(C2T) $< $@
|
|
||||||
|
|
||||||
|
|
206
asm/bar.s
Normal file
206
asm/bar.s
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
;bar.s
|
||||||
|
;
|
||||||
|
; moves itself to another page memory,
|
||||||
|
; then reads binary from disk using params at end,
|
||||||
|
; then jumps to binary
|
||||||
|
;
|
||||||
|
|
||||||
|
; apple params/vectors
|
||||||
|
|
||||||
|
warm = $FF69 ; back to monitor
|
||||||
|
bell = $FBDD ; ding
|
||||||
|
preg = $48 ; mon p reg
|
||||||
|
ch = $24 ; cursor horizontal
|
||||||
|
movecur = $FB5B ; move cursor to ch,a
|
||||||
|
cout = $FDED ; character out sub
|
||||||
|
|
||||||
|
; dos params/vectors
|
||||||
|
|
||||||
|
rwtsprm = $B7E8 ; looked at dos 3.3 disk, not using $3E3 to find
|
||||||
|
rwts = $B7B5 ; rwts jsr
|
||||||
|
|
||||||
|
; vars
|
||||||
|
|
||||||
|
stage1 = $C00
|
||||||
|
stage2 = $300 ; $300 looks open
|
||||||
|
invsp = $20 ; inverse space for draw
|
||||||
|
trkcnt = $00 ; track counter
|
||||||
|
segcnt = $01 ; loop var
|
||||||
|
buffer = $02 ; MSB of RWTS buffer
|
||||||
|
secnum = $03 ; loop var
|
||||||
|
trknum = $04 ; loop var
|
||||||
|
barcnt = $05 ; bar counter
|
||||||
|
barptr = $06 ; bar pointer
|
||||||
|
|
||||||
|
|
||||||
|
.org stage1
|
||||||
|
|
||||||
|
grcheck:
|
||||||
|
lda *+(gr-loader)+(moved-grcheck)
|
||||||
|
beq movetext
|
||||||
|
lda #0 ; GR mode
|
||||||
|
sta $C050
|
||||||
|
sta $C053
|
||||||
|
movetext:
|
||||||
|
ldx #0
|
||||||
|
movetx:
|
||||||
|
lda $800,x
|
||||||
|
sta $400,x
|
||||||
|
lda $880,x
|
||||||
|
sta $480,x
|
||||||
|
lda $900,x
|
||||||
|
sta $500,x
|
||||||
|
lda $980,x
|
||||||
|
sta $580,x
|
||||||
|
lda $A00,x
|
||||||
|
sta $600,x
|
||||||
|
lda $A80,x
|
||||||
|
sta $680,x
|
||||||
|
lda $B00,x
|
||||||
|
sta $700,x
|
||||||
|
lda $B80,x
|
||||||
|
sta $780,x
|
||||||
|
inx
|
||||||
|
cpx #120
|
||||||
|
bne movetx ; move 120 bytes
|
||||||
|
init:
|
||||||
|
lda #0 ; reset pointer and counter
|
||||||
|
sta barcnt
|
||||||
|
sta barptr
|
||||||
|
|
||||||
|
lda #1 ; read(1)/write(2) command
|
||||||
|
ldy #$0C ; offset in RWTS
|
||||||
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
lda #0 ; buffer LSB
|
||||||
|
ldy #8 ; offset in RWTS
|
||||||
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
lda #2
|
||||||
|
sta trknum ; start with track 2
|
||||||
|
|
||||||
|
start:
|
||||||
|
ldx #0 ; move code to stage2
|
||||||
|
move:
|
||||||
|
lda moved,x
|
||||||
|
sta loader,x
|
||||||
|
inx
|
||||||
|
cpx #$D0
|
||||||
|
bne move ; move 208 bytes
|
||||||
|
jmp loader
|
||||||
|
|
||||||
|
moved:
|
||||||
|
.org stage2
|
||||||
|
|
||||||
|
loader:
|
||||||
|
lda loadpage ; where to dump the tracks
|
||||||
|
sta buffer
|
||||||
|
|
||||||
|
ldx lasttrack
|
||||||
|
dex ; because data starts at track 2
|
||||||
|
dex
|
||||||
|
stx trkcnt ; number of complete and partial tracks
|
||||||
|
|
||||||
|
;;;begin track loop
|
||||||
|
trkloop:
|
||||||
|
lda trknum ; track number
|
||||||
|
ldy #4 ; offset in RWTS
|
||||||
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
;;;begin sector loop (16), backwards is faster, much faster
|
||||||
|
lda trkcnt ; check if last track
|
||||||
|
bne fulltrack ; if not then full track
|
||||||
|
lda lastsector ; if so, get last sector number
|
||||||
|
bpl subtrack
|
||||||
|
fulltrack:
|
||||||
|
lda #$F
|
||||||
|
subtrack:
|
||||||
|
sta secnum
|
||||||
|
secloop:
|
||||||
|
lda secnum ; sector number
|
||||||
|
ldy #5 ; offset in RWTS
|
||||||
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
lda buffer ; buffer MSB
|
||||||
|
clc
|
||||||
|
adc secnum ; compute page load address
|
||||||
|
ldy #9 ; offset in RWTS
|
||||||
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
ldy #<rwtsprm ; load rwts paramlist B7E8
|
||||||
|
lda #>rwtsprm
|
||||||
|
jsr rwts ; do it!
|
||||||
|
bcs diskerror
|
||||||
|
lda #0
|
||||||
|
sta preg ; fix p reg so mon is happy
|
||||||
|
|
||||||
|
;;;draw code
|
||||||
|
inc barcnt ; sectors read
|
||||||
|
ldx barptr ; get current pointer value
|
||||||
|
lda bar,x
|
||||||
|
cmp barcnt ; is bar,x = barcnt?
|
||||||
|
bne nodraw ; if bar,x = barcnt draw bar
|
||||||
|
lda barptr ; get position
|
||||||
|
;clc
|
||||||
|
;adc #5 ; indent
|
||||||
|
|
||||||
|
; new version, no rom calls, just poke to screen
|
||||||
|
clc ; clear carry
|
||||||
|
adc rowlsb ; add the text page row lsb
|
||||||
|
sta screen+1 ; store that in self mod code
|
||||||
|
lda rowmsb ; get text page row msb
|
||||||
|
sta screen+2 ; store that in self mod code
|
||||||
|
lda #invsp ; load block char
|
||||||
|
screen:
|
||||||
|
sta $400 ; write out char
|
||||||
|
|
||||||
|
; old version, rom calls, cout will scroll windows on 40x24
|
||||||
|
;sta ch
|
||||||
|
;lda row ; row 19
|
||||||
|
;jsr movecur
|
||||||
|
;lda #invsp
|
||||||
|
;jsr cout
|
||||||
|
|
||||||
|
inc barptr ; move pointer to next bar position
|
||||||
|
nodraw:
|
||||||
|
;;;end draw code
|
||||||
|
|
||||||
|
dec secnum
|
||||||
|
bpl secloop
|
||||||
|
;;;end sector loop
|
||||||
|
|
||||||
|
lda buffer ; buffer += $10
|
||||||
|
clc
|
||||||
|
adc #$10
|
||||||
|
sta buffer
|
||||||
|
|
||||||
|
inc trknum ; next track
|
||||||
|
dec trkcnt ;
|
||||||
|
bpl trkloop ; 0, all done with tracks
|
||||||
|
;;;end track loop
|
||||||
|
|
||||||
|
done:
|
||||||
|
jmp (nextjump) ; down with load, run it
|
||||||
|
|
||||||
|
diskerror:
|
||||||
|
jmp warm
|
||||||
|
|
||||||
|
lasttrack:
|
||||||
|
.org *+1
|
||||||
|
lastsector:
|
||||||
|
.org *+1
|
||||||
|
loadpage:
|
||||||
|
.org *+1
|
||||||
|
nextjump:
|
||||||
|
.org *+2
|
||||||
|
gr:
|
||||||
|
.org *+1
|
||||||
|
row:
|
||||||
|
.org *+1
|
||||||
|
rowlsb:
|
||||||
|
.org *+1
|
||||||
|
rowmsb:
|
||||||
|
.org *+1
|
||||||
|
bar:
|
||||||
|
.org *+40
|
||||||
|
end:
|
110
asm/loader.s
110
asm/loader.s
|
@ -1,39 +1,65 @@
|
||||||
;diskload2.s
|
;loader.s
|
||||||
|
;
|
||||||
|
; moves itself to another page memory,
|
||||||
|
; then reads binary from disk using params at end,
|
||||||
|
; then jumps to binary
|
||||||
|
;
|
||||||
|
|
||||||
; apple vectors
|
; apple params/vectors
|
||||||
|
|
||||||
warm = $FF69 ; back to monitor
|
warm = $FF69 ; back to monitor
|
||||||
bell = $FBDD ; ding
|
bell = $FBDD ; ding
|
||||||
|
preg = $48 ; mon p reg
|
||||||
|
|
||||||
|
; dos params/vectors
|
||||||
|
|
||||||
|
rwtsprm = $B7E8 ; looked at dos 3.3 disk, not using $3E3 to find
|
||||||
|
rwts = $B7B5 ; rwts jsr
|
||||||
|
|
||||||
; vars
|
; vars
|
||||||
|
|
||||||
lopage = $0800
|
stage1 = $C00
|
||||||
hipage = $B500
|
stage2 = $300 ; $300 looks open
|
||||||
rwtsprm = $B7E8 ; looked at dos 3.3 disk, not using $3E3 to find
|
;;;run time
|
||||||
rwts = $B7B5
|
trkcnt = $00 ; track counter
|
||||||
preg = $48 ; mon p reg
|
segcnt = $01 ; loop var
|
||||||
;trkcnt = $00 ; track counter
|
buffer = $02 ; MSB of RWTS buffer
|
||||||
;segcnt = $01 ; loop var
|
secnum = $03 ; loop var
|
||||||
;buffer = $02 ; MSB of RWTS buffer
|
trknum = $04 ; loop var
|
||||||
;secnum = $03 ; loop var
|
|
||||||
;trknum = $04 ; loop var
|
|
||||||
|
|
||||||
|
|
||||||
start:
|
start:
|
||||||
.org lopage
|
.org stage1
|
||||||
|
|
||||||
ldx #0 ; move code to hi memory
|
grcheck:
|
||||||
move:
|
lda *+(gr-loader)+(moved-grcheck)
|
||||||
lda moved,x
|
beq movetext
|
||||||
sta loader,x
|
lda #0 ; GR mode
|
||||||
|
sta $C050
|
||||||
|
sta $C053
|
||||||
|
movetext:
|
||||||
|
ldx #0
|
||||||
|
movetx:
|
||||||
|
lda $800,x
|
||||||
|
sta $400,x
|
||||||
|
lda $880,x
|
||||||
|
sta $480,x
|
||||||
|
lda $900,x
|
||||||
|
sta $500,x
|
||||||
|
lda $980,x
|
||||||
|
sta $580,x
|
||||||
|
lda $A00,x
|
||||||
|
sta $600,x
|
||||||
|
lda $A80,x
|
||||||
|
sta $680,x
|
||||||
|
lda $B00,x
|
||||||
|
sta $700,x
|
||||||
|
lda $B80,x
|
||||||
|
sta $780,x
|
||||||
inx
|
inx
|
||||||
bne move ; move 256 bytes
|
cpx #120
|
||||||
jmp loader
|
bne movetx ; move 120 bytes
|
||||||
|
init:
|
||||||
moved:
|
|
||||||
.org hipage
|
|
||||||
|
|
||||||
loader:
|
|
||||||
lda #1 ; read(1)/write(2) command
|
lda #1 ; read(1)/write(2) command
|
||||||
ldy #$0C ; offset in RWTS
|
ldy #$0C ; offset in RWTS
|
||||||
sta rwtsprm,y ; write it to RWTS
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
@ -45,6 +71,19 @@ loader:
|
||||||
lda #2
|
lda #2
|
||||||
sta trknum ; start with track 2
|
sta trknum ; start with track 2
|
||||||
|
|
||||||
|
ldx #0 ; move code to stage2
|
||||||
|
move:
|
||||||
|
lda moved,x
|
||||||
|
sta loader,x
|
||||||
|
inx
|
||||||
|
;bne move ; move 256 bytes
|
||||||
|
bpl move ; move 128 bytes
|
||||||
|
jmp loader
|
||||||
|
|
||||||
|
moved:
|
||||||
|
.org stage2
|
||||||
|
|
||||||
|
loader:
|
||||||
lda loadpage ; where to dump the tracks
|
lda loadpage ; where to dump the tracks
|
||||||
sta buffer
|
sta buffer
|
||||||
|
|
||||||
|
@ -60,10 +99,10 @@ trkloop:
|
||||||
sta rwtsprm,y ; write it to RWTS
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
;;;begin sector loop (16), backwards is faster, much faster
|
;;;begin sector loop (16), backwards is faster, much faster
|
||||||
lda trkcnt
|
lda trkcnt ; check if last track
|
||||||
bne fulltrack
|
bne fulltrack ; if not then full track
|
||||||
lda lastsector
|
lda lastsector ; if so, get last sector number
|
||||||
jmp subtrack
|
bpl subtrack
|
||||||
fulltrack:
|
fulltrack:
|
||||||
lda #$F
|
lda #$F
|
||||||
subtrack:
|
subtrack:
|
||||||
|
@ -75,7 +114,7 @@ secloop:
|
||||||
|
|
||||||
lda buffer ; buffer MSB
|
lda buffer ; buffer MSB
|
||||||
clc
|
clc
|
||||||
adc secnum
|
adc secnum ; compute page load address
|
||||||
ldy #9 ; offset in RWTS
|
ldy #9 ; offset in RWTS
|
||||||
sta rwtsprm,y ; write it to RWTS
|
sta rwtsprm,y ; write it to RWTS
|
||||||
|
|
||||||
|
@ -101,7 +140,7 @@ secloop:
|
||||||
;;;end track loop
|
;;;end track loop
|
||||||
|
|
||||||
done:
|
done:
|
||||||
jmp (nextjump)
|
jmp (nextjump) ; down with load, run it
|
||||||
|
|
||||||
diskerror:
|
diskerror:
|
||||||
jmp warm
|
jmp warm
|
||||||
|
@ -114,13 +153,6 @@ loadpage:
|
||||||
.org *+1
|
.org *+1
|
||||||
nextjump:
|
nextjump:
|
||||||
.org *+2
|
.org *+2
|
||||||
trkcnt:
|
gr:
|
||||||
.org *+1
|
|
||||||
segcnt:
|
|
||||||
.org *+1
|
|
||||||
buffer:
|
|
||||||
.org *+1
|
|
||||||
secnum:
|
|
||||||
.org *+1
|
|
||||||
trknum:
|
|
||||||
.org *+1
|
.org *+1
|
||||||
|
end:
|
||||||
|
|
BIN
bargrloader.textpage
Normal file
BIN
bargrloader.textpage
Normal file
Binary file not shown.
23
barloader.text
Normal file
23
barloader.text
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
|
||||||
|
@@@@@@@ @@@@@@ @@@@@@@
|
||||||
|
@@@@@@@@ @@@@@@@@ @@@@@@@@
|
||||||
|
!@@ @@@ @@! @@@
|
||||||
|
!@! @!@ !@! @!@
|
||||||
|
!@! !!@ @!@ !@!
|
||||||
|
!!! !!: !@! !!!
|
||||||
|
:!! !:! !!: !!!
|
||||||
|
:!: :!: :!: !:!
|
||||||
|
::: ::: :: ::::: :::: ::
|
||||||
|
:: :: : :: : ::: :: : :
|
||||||
|
|
||||||
|
|
||||||
|
C2D (CODE TO DISK) BUILT-IN LOADER
|
||||||
|
|
||||||
|
LOADING GAME SERVER CLIENT ...
|
||||||
|
|
||||||
|
________________________________________
|
||||||
|
________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
HTTP://GITHUB.COM/DATAJERK/C2D
|
BIN
barloader.textpage
Normal file
BIN
barloader.textpage
Normal file
Binary file not shown.
BIN
bin/c2d.exe
BIN
bin/c2d.exe
Binary file not shown.
BIN
bin/page2text
Executable file
BIN
bin/page2text
Executable file
Binary file not shown.
BIN
bin/page2text.exe
Executable file
BIN
bin/page2text.exe
Executable file
Binary file not shown.
BIN
bin/text2page
BIN
bin/text2page
Binary file not shown.
Binary file not shown.
250
c2d.c
250
c2d.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
c2d, Code to Disk, Version 0.4, Sun Apr 9 03:16:22 UTC 2017
|
c2d, Code to Disk, Version 0.57
|
||||||
|
|
||||||
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
||||||
|
|
||||||
|
@ -28,19 +28,8 @@ Features:
|
||||||
o 32-bit/64-bit x86 OS/X.
|
o 32-bit/64-bit x86 OS/X.
|
||||||
o 32-bit x86 Windows/MinGW.
|
o 32-bit x86 Windows/MinGW.
|
||||||
|
|
||||||
Compile:
|
|
||||||
OS/X:
|
|
||||||
gcc -Wall -O -o c2d c2d.c
|
|
||||||
Linux:
|
|
||||||
gcc -Wall -O -o c2d c2d.c -lm
|
|
||||||
Windows/Cygwin:
|
|
||||||
gcc -Wall -O -o c2d c2d.c
|
|
||||||
Windows/MinGW:
|
|
||||||
PATH=C:\MinGW\bin;%PATH%
|
|
||||||
gcc -Wall -O -static -o c2d c2d.c
|
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
* Probably
|
* Yes (input checking)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -53,42 +42,54 @@ Bugs:
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "c2d.h"
|
#include "c2d.h"
|
||||||
|
|
||||||
#define VERSION "Version 0.4"
|
#define VERSION "Version 0.57"
|
||||||
#define INFILE argv[argc-2]
|
#define INFILE argv[argc-2]
|
||||||
#define OUTFILE argv[argc-1]
|
#define OUTFILE argv[argc-1]
|
||||||
#define BINARY 0
|
#define BINARY 0
|
||||||
#define MONITOR 1
|
#define MONITOR 1
|
||||||
#define LOADER "loader"
|
#define LOADER "loader"
|
||||||
|
|
||||||
void usage();
|
void usage(void);
|
||||||
char *getext(char *filename);
|
char *getext(char *filename);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
FILE *ifp, *ofp;
|
FILE *ifp, *ofp;
|
||||||
int c, i, j, k, start = 0, loadaddress, inputtype, warm = 0, filesize = 0;
|
int c, i, j, k, start = 0, loadaddress, inputtype, warm = 0, filesize = 0;
|
||||||
int loaderstart, loader = 0, loadersize = 0, textpagesize = 0;
|
int loaderstart, loader = 0, loadersize = 0, loaderbasesize = 0, textpagesize = 0;
|
||||||
|
int bar = 0, row = 19, gr = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *filetypes[] = {"BINARY","MONITOR"};
|
char *filetypes[] = { "BINARY", "MONITOR" };
|
||||||
char *ext, filename[256], load_address[10], *textpage=NULL;
|
char *ext, filename[256], load_address[10], *textpage = NULL;
|
||||||
|
|
||||||
opterr = 1;
|
opterr = 1;
|
||||||
while((c = getopt(argc, argv, "t:vmh?s:")) != -1)
|
while ((c = getopt(argc, argv, "gr:t:vmh?s:b")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 't':
|
case 't': // load a splash page while loading binary
|
||||||
loader=1;
|
loader = 1;
|
||||||
textpage=optarg;
|
textpage = optarg;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm': // boot to monitor
|
||||||
warm = 1;
|
warm = 1;
|
||||||
break;
|
break;
|
||||||
case 'v': // version
|
case 'v': // version
|
||||||
fprintf(stderr,"\n%s\n\n",VERSION);
|
fprintf(stderr, "\n%s\n\n", VERSION);
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case 's': // override rate for -1/-2 only
|
case 's': // start here instead of load address
|
||||||
warm = 0;
|
warm = 0;
|
||||||
start = (int)strtol(optarg, (char **)NULL, 16); // todo: input check
|
start = (int) strtol(optarg, (char **) NULL, 16); // todo: input check
|
||||||
|
break;
|
||||||
|
case 'r': // bar row
|
||||||
|
row = (int) strtol(optarg, (char **) NULL, 10); // todo: input check
|
||||||
|
if (row > 23)
|
||||||
|
row = 23;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
bar = 1;
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
gr = 1;
|
||||||
break;
|
break;
|
||||||
case 'h': // help
|
case 'h': // help
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -96,50 +97,51 @@ int main(int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc - optind < 2) {
|
if (argc - optind < 2) {
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
inputtype=BINARY;
|
inputtype = BINARY;
|
||||||
|
|
||||||
k=0;
|
k = 0;
|
||||||
for(j=0;j<strlen(INFILE);j++) {
|
for (j = 0; j < strlen(INFILE); j++) {
|
||||||
if(INFILE[j] == ',')
|
if (INFILE[j] == ',')
|
||||||
break;
|
break;
|
||||||
filename[k++]=INFILE[j];
|
filename[k++] = INFILE[j];
|
||||||
}
|
}
|
||||||
filename[k] = '\0';
|
filename[k] = '\0';
|
||||||
|
|
||||||
k=0;j++;
|
k = 0;
|
||||||
for(;j<strlen(INFILE);j++)
|
j++;
|
||||||
load_address[k++]=INFILE[j];
|
for (; j < strlen(INFILE); j++)
|
||||||
|
load_address[k++] = INFILE[j];
|
||||||
load_address[k] = '\0';
|
load_address[k] = '\0';
|
||||||
if(k == 0)
|
if (k == 0)
|
||||||
loadaddress = -1;
|
loadaddress = -1;
|
||||||
else
|
else
|
||||||
loadaddress = (int)strtol(load_address, (char **)NULL, 16); // todo: input check
|
loadaddress = (int) strtol(load_address, (char **) NULL, 16); // todo: input check
|
||||||
|
|
||||||
if((ext = getext(filename)) != NULL)
|
if ((ext = getext(filename)) != NULL)
|
||||||
if(strcmp(ext,"mon") == 0 || strcmp(ext,"MON") == 0)
|
if (strcmp(ext, "mon") == 0 || strcmp(ext, "MON") == 0)
|
||||||
inputtype = MONITOR;
|
inputtype = MONITOR;
|
||||||
|
|
||||||
if ((ifp = fopen(filename, "rb")) == NULL) {
|
if ((ifp = fopen(filename, "rb")) == NULL) {
|
||||||
fprintf(stderr,"Cannot read: %s\n\n",filename);
|
fprintf(stderr, "Cannot read: %s\n\n", filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"Reading %s, type %s, load address: $",filename,filetypes[inputtype]);
|
fprintf(stderr, "Reading %s, type %s, load address: $", filename, filetypes[inputtype]);
|
||||||
|
|
||||||
if(inputtype == BINARY) {
|
if (inputtype == BINARY) {
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
|
|
||||||
stat(filename,&st);
|
stat(filename, &st);
|
||||||
filesize = st.st_size;
|
filesize = st.st_size;
|
||||||
|
|
||||||
if(loadaddress == - 1) {
|
if (loadaddress == -1) {
|
||||||
fread(&b, 1, 1, ifp);
|
fread(&b, 1, 1, ifp);
|
||||||
loadaddress = b;
|
loadaddress = b;
|
||||||
fread(&b, 1, 1, ifp);
|
fread(&b, 1, 1, ifp);
|
||||||
|
@ -149,13 +151,12 @@ int main(int argc, char **argv)
|
||||||
fread(&b, 1, 1, ifp);
|
fread(&b, 1, 1, ifp);
|
||||||
filesize |= b << 8;
|
filesize |= b << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for errors
|
//check for errors
|
||||||
fread(&blank.track[1+loader].sector[0].byte[loadaddress & 0xFF], filesize, 1, ifp);
|
fread(&blank.track[1 + loader].sector[0].byte[loadaddress & 0xFF], filesize, 1, ifp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: lots of input checking
|
// todo: lots of input checking
|
||||||
if(inputtype == MONITOR) {
|
if (inputtype == MONITOR) {
|
||||||
int byte, naddr;
|
int byte, naddr;
|
||||||
char addrs[8], s;
|
char addrs[8], s;
|
||||||
unsigned char *p = NULL;
|
unsigned char *p = NULL;
|
||||||
|
@ -163,11 +164,11 @@ int main(int argc, char **argv)
|
||||||
loadaddress = -1;
|
loadaddress = -1;
|
||||||
filesize = 0;
|
filesize = 0;
|
||||||
|
|
||||||
while(fscanf(ifp,"%s ",addrs) != EOF) {
|
while (fscanf(ifp, "%s ", addrs) != EOF) {
|
||||||
naddr = (int)strtol(addrs, (char **)NULL, 16);
|
naddr = (int) strtol(addrs, (char **) NULL, 16);
|
||||||
if(loadaddress == -1) {
|
if (loadaddress == -1) {
|
||||||
loadaddress = naddr;
|
loadaddress = naddr;
|
||||||
p = &blank.track[1+loader].sector[0].byte[loadaddress & 0xFF];
|
p = &blank.track[1 + loader].sector[0].byte[loadaddress & 0xFF];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fscanf(ifp, "%x%c", &byte, &s) != EOF) {
|
while (fscanf(ifp, "%x%c", &byte, &s) != EOF) {
|
||||||
|
@ -182,100 +183,136 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
fclose(ifp);
|
fclose(ifp);
|
||||||
|
|
||||||
fprintf(stderr,"%04X, length: %d\n",loadaddress,filesize);
|
fprintf(stderr, "%04X, length: %d\n", loadaddress, filesize);
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if(!start)
|
if (!start)
|
||||||
start = loadaddress;
|
start = loadaddress;
|
||||||
if(warm)
|
if (warm)
|
||||||
start = 0xFF69;
|
start = 0xFF69;
|
||||||
|
|
||||||
if(!loader) {
|
if (!loader) {
|
||||||
blank.track[0].sector[1].byte[0xE0] = ceil((filesize + (loadaddress & 0xFF)) / 256.0);
|
blank.track[0].sector[1].byte[0xE0] = ceil((filesize + (loadaddress & 0xFF)) / 256.0);
|
||||||
blank.track[0].sector[1].byte[0xE7] = ((loadaddress + filesize - 1) >> 8) + 1;
|
blank.track[0].sector[1].byte[0xE7] = ((loadaddress + filesize - 1) >> 8) + 1;
|
||||||
blank.track[0].sector[1].byte[0x15] = ceil((filesize + (loadaddress & 0xFF))/ 4096.0);
|
blank.track[0].sector[1].byte[0x15] = ceil((filesize + (loadaddress & 0xFF)) / 4096.0);
|
||||||
blank.track[0].sector[1].byte[0x1A] = ceil((filesize + (loadaddress & 0xFF))/ 256.0) - 16*(ceil((filesize + (loadaddress & 0xFF)) / 4096.0) - 1) - 1;
|
blank.track[0].sector[1].byte[0x1A] = ceil((filesize + (loadaddress & 0xFF)) / 256.0) - 16 * (ceil((filesize + (loadaddress & 0xFF)) / 4096.0) - 1) - 1;
|
||||||
|
|
||||||
fprintf(stderr,"Number of sectors: %d\n",(int)ceil((filesize + (loadaddress & 0xFF)) / 256.0));
|
fprintf(stderr, "Number of sectors: %d\n", (int) ceil((filesize + (loadaddress & 0xFF)) / 256.0));
|
||||||
fprintf(stderr,"Memory page range: $%02X - $%02X\n",loadaddress >> 8,(loadaddress + filesize - 1) >> 8);
|
fprintf(stderr, "Memory page range: $%02X - $%02X\n", loadaddress >> 8, (loadaddress + filesize - 1) >> 8);
|
||||||
|
|
||||||
blank.track[0].sector[1].byte[0x3B] = 0x4C;
|
blank.track[0].sector[1].byte[0x3B] = 0x4C;
|
||||||
blank.track[0].sector[1].byte[0x3C] = start & 0xFF;
|
blank.track[0].sector[1].byte[0x3C] = start & 0xFF;
|
||||||
blank.track[0].sector[1].byte[0x3D] = start >> 8;
|
blank.track[0].sector[1].byte[0x3D] = start >> 8;
|
||||||
|
|
||||||
fprintf(stderr,"After boot, jump to: $%04X\n\n",start);
|
fprintf(stderr, "After boot, jump to: $%04X\n\n", start);
|
||||||
|
|
||||||
fprintf(stderr,"Writing %s to T:01/S:00 - T:%02d/S:%02d on %s\n\n",filename,blank.track[0].sector[1].byte[0x15],blank.track[0].sector[1].byte[0x1A],OUTFILE);
|
fprintf(stderr, "Writing %s to T:01/S:00 - T:%02d/S:%02d on %s\n\n", filename, blank.track[0].sector[1].byte[0x15], blank.track[0].sector[1].byte[0x1A], OUTFILE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ((ifp = fopen(textpage, "rb")) == NULL) {
|
if ((ifp = fopen(textpage, "rb")) == NULL) {
|
||||||
fprintf(stderr,"Cannot read: %s\n\n",textpage);
|
fprintf(stderr, "Cannot read: %s\n\n", textpage);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat(textpage,&st);
|
stat(textpage, &st);
|
||||||
textpagesize = st.st_size;
|
textpagesize = st.st_size;
|
||||||
|
|
||||||
if(textpagesize != 1024) {
|
if (textpagesize != 1024) {
|
||||||
fprintf(stderr,"textpage %s size %d != 1024\n\n",textpage,textpagesize);
|
fprintf(stderr, "textpage %s size %d != 1024\n\n", textpage, textpagesize);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for errors
|
||||||
fread(&blank.track[1].sector[0].byte[0], textpagesize, 1, ifp);
|
fread(&blank.track[1].sector[0].byte[0], textpagesize, 1, ifp);
|
||||||
fclose(ifp);
|
fclose(ifp);
|
||||||
|
|
||||||
if((loadersize = sizeof(loadercode)) > 256) {
|
if(!bar) {
|
||||||
fprintf(stderr,"Loader code size %d > 256\n\n",loadersize);
|
loaderbasesize = sizeof(loadercode);
|
||||||
|
if ((loadersize = sizeof(loadercode)) > 256) {
|
||||||
|
fprintf(stderr, "Loader code size %d > 256\n\n", loadersize);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<loadersize;i++)
|
for (i = 0; i < loadersize; i++)
|
||||||
blank.track[1].sector[4].byte[i]=loadercode[i];
|
blank.track[1].sector[4].byte[i] = loadercode[i];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loaderbasesize = sizeof(barcode);
|
||||||
|
if ((loadersize = sizeof(barcode)) > 256) {
|
||||||
|
fprintf(stderr, "Loader code size %d > 256\n\n", loadersize);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < loadersize; i++)
|
||||||
|
blank.track[1].sector[4].byte[i] = barcode[i];
|
||||||
|
}
|
||||||
|
|
||||||
// loader args
|
// loader args
|
||||||
// lasttrack
|
// lasttrack
|
||||||
blank.track[1].sector[4].byte[loadersize]=1 + (int)ceil(filesize / 4096.0);
|
blank.track[1].sector[4].byte[loadersize] = 1 + (int) ceil(filesize / 4096.0);
|
||||||
// lastsector (unused)
|
// lastsector
|
||||||
blank.track[1].sector[4].byte[loadersize+1]= ceil((filesize % 4096) / 256.0) - 1;
|
blank.track[1].sector[4].byte[loadersize + 1] = ceil((filesize % 4096) / 256.0) - 1;
|
||||||
// loadpage
|
// loadpage
|
||||||
blank.track[1].sector[4].byte[loadersize+2]= loadaddress >> 8;
|
blank.track[1].sector[4].byte[loadersize + 2] = loadaddress >> 8;
|
||||||
// program start LSB
|
// program start LSB
|
||||||
blank.track[1].sector[4].byte[loadersize+3]= start & 0xFF;
|
blank.track[1].sector[4].byte[loadersize + 3] = start & 0xFF;
|
||||||
// program start MSB
|
// program start MSB
|
||||||
blank.track[1].sector[4].byte[loadersize+4]= start >> 8;
|
blank.track[1].sector[4].byte[loadersize + 4] = start >> 8;
|
||||||
|
// gr mode
|
||||||
|
blank.track[1].sector[4].byte[loadersize + 5] = gr;
|
||||||
|
|
||||||
loaderstart=0x400;
|
//bar code, pre compute status bar table
|
||||||
loadersize += (1024 + 5); // textpage + loader + loader args
|
if(bar) {
|
||||||
|
int num_sectors = (int) ceil((filesize + (loadaddress & 0xFF)) / 256.0);
|
||||||
|
int bar_length = 40;
|
||||||
|
int i, rowaddr;
|
||||||
|
|
||||||
|
// bar row
|
||||||
|
blank.track[1].sector[4].byte[loadersize + 6] = row;
|
||||||
|
|
||||||
|
rowaddr = 0x400+(row/8)*0x28+((row%8)*0x80);
|
||||||
|
|
||||||
|
// program start LSB
|
||||||
|
blank.track[1].sector[4].byte[loadersize + 7] = rowaddr & 0xFF;
|
||||||
|
// program start MSB
|
||||||
|
blank.track[1].sector[4].byte[loadersize + 8] = rowaddr >> 8;
|
||||||
|
|
||||||
|
for(i = 1; i <= bar_length; i++)
|
||||||
|
blank.track[1].sector[4].byte[loadersize + 8 + i] = i * num_sectors / bar_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
loaderstart = 0x800;
|
||||||
|
|
||||||
|
// temp hack to effect the sound of the drive, i.e. to make consistent
|
||||||
|
// longer term put binary payload at end of loader
|
||||||
|
// loadersize += (1024 + 5); // textpage + loader + loader args
|
||||||
|
loadersize = 4096;
|
||||||
|
|
||||||
blank.track[0].sector[1].byte[0xE0] = ceil((loadersize + (loaderstart & 0xFF)) / 256.0);
|
blank.track[0].sector[1].byte[0xE0] = ceil((loadersize + (loaderstart & 0xFF)) / 256.0);
|
||||||
blank.track[0].sector[1].byte[0xE7] = ((loaderstart + loadersize - 1) >> 8) + 1;
|
blank.track[0].sector[1].byte[0xE7] = ((loaderstart + loadersize - 1) >> 8) + 1;
|
||||||
blank.track[0].sector[1].byte[0x15] = ceil((loadersize + (loaderstart & 0xFF))/ 4096.0);
|
blank.track[0].sector[1].byte[0x15] = ceil((loadersize + (loaderstart & 0xFF)) / 4096.0);
|
||||||
blank.track[0].sector[1].byte[0x1A] = ceil((loadersize + (loaderstart & 0xFF))/ 256.0) - 16*(ceil((loadersize + (loaderstart & 0xFF)) / 4096.0) - 1) - 1;
|
blank.track[0].sector[1].byte[0x1A] = ceil((loadersize + (loaderstart & 0xFF)) / 256.0) - 16 * (ceil((loadersize + (loaderstart & 0xFF)) / 4096.0) - 1) - 1;
|
||||||
|
|
||||||
fprintf(stderr,"Loader number of sectors: %d\n",(int)ceil((loadersize + (loaderstart & 0xFF)) / 256.0));
|
fprintf(stderr, "Loader number of sectors: %d\n", (int) ceil((loadersize + (loaderstart & 0xFF)) / 256.0));
|
||||||
fprintf(stderr,"Loader memory page range: $%02X - $%02X\n",loaderstart >> 8,(loaderstart + loadersize - 1) >> 8);
|
fprintf(stderr, "Loader memory page range: $%02X - $%02X\n", loaderstart >> 8, (loaderstart + loadersize - 1) >> 8);
|
||||||
fprintf(stderr,"Binary Number of sectors: %d\n",(int)ceil((filesize + (loadaddress & 0xFF)) / 256.0));
|
fprintf(stderr, "After loader, jump to: $%04X\n", start);
|
||||||
fprintf(stderr,"Binary Memory page range: $%02X - $%02X\n",loadaddress >> 8,(loadaddress + filesize - 1) >> 8);
|
fprintf(stderr, "Binary Number of sectors: %d\n", (int) ceil((filesize + (loadaddress & 0xFF)) / 256.0));
|
||||||
|
fprintf(stderr, "Binary Memory page range: $%02X - $%02X\n", loadaddress >> 8, (loadaddress + filesize - 1) >> 8);
|
||||||
|
|
||||||
loaderstart = 0x800;
|
loaderstart = 0xC00;
|
||||||
//if(warm)
|
|
||||||
// loaderstart = 0xFF69;
|
|
||||||
|
|
||||||
blank.track[0].sector[1].byte[0x3B] = 0x4C;
|
blank.track[0].sector[1].byte[0x3B] = 0x4C;
|
||||||
blank.track[0].sector[1].byte[0x3C] = loaderstart & 0xFF;
|
blank.track[0].sector[1].byte[0x3C] = loaderstart & 0xFF;
|
||||||
blank.track[0].sector[1].byte[0x3D] = loaderstart >> 8;
|
blank.track[0].sector[1].byte[0x3D] = loaderstart >> 8;
|
||||||
|
|
||||||
fprintf(stderr,"After boot, jump to: $%04X\n",loaderstart);
|
fprintf(stderr, "After boot, jump to: $%04X\n", loaderstart);
|
||||||
fprintf(stderr,"After loader, jump to: $%04X\n",start);
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr, "Writing %s to T:02/S:00 - T:%02d/S:%02d on %s\n\n", filename, blank.track[1].sector[4].byte[sizeof(loadercode)], blank.track[1].sector[4].byte[loaderbasesize + 1], OUTFILE);
|
||||||
fprintf(stderr,"Writing %s to T:02/S:00 - T:%02d/S:%02d on %s\n\n",filename,blank.track[1].sector[4].byte[sizeof(loadercode)],blank.track[1].sector[4].byte[sizeof(loadercode)+1],OUTFILE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ofp = fopen(OUTFILE, "wb")) == NULL) {
|
if ((ofp = fopen(OUTFILE, "wb")) == NULL) {
|
||||||
fprintf(stderr,"Cannot write: %s\n\n",OUTFILE);
|
fprintf(stderr, "Cannot write: %s\n\n", OUTFILE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for errors
|
// check for errors
|
||||||
fwrite(&blank, 143360, 1, ofp);
|
fwrite(&blank, 143360, 1, ofp);
|
||||||
|
|
||||||
|
@ -289,28 +326,27 @@ char *getext(char *filename)
|
||||||
char stack[256], *rval;
|
char stack[256], *rval;
|
||||||
int i, sp = 0;
|
int i, sp = 0;
|
||||||
|
|
||||||
for(i=strlen(filename)-1;i>=0;i--) {
|
for (i = strlen(filename) - 1; i >= 0; i--) {
|
||||||
if(filename[i] == '.')
|
if (filename[i] == '.')
|
||||||
break;
|
break;
|
||||||
stack[sp++] = filename[i];
|
stack[sp++] = filename[i];
|
||||||
}
|
}
|
||||||
stack[sp] = '\0';
|
stack[sp] = '\0';
|
||||||
|
|
||||||
if(sp == strlen(filename) || sp == 0)
|
if (sp == strlen(filename) || sp == 0)
|
||||||
return(NULL);
|
return (NULL);
|
||||||
|
|
||||||
if((rval = (char *)malloc(sp * sizeof(char))) == NULL)
|
if ((rval = (char *) malloc(sp * sizeof(char))) == NULL)
|
||||||
; //do error code
|
; //do error code
|
||||||
|
|
||||||
rval[sp] = '\0';
|
rval[sp] = '\0';
|
||||||
for(i=0;i<sp+i;i++)
|
for (i = 0; i < sp + i; i++)
|
||||||
rval[i] = stack[--sp];
|
rval[i] = stack[--sp];
|
||||||
|
|
||||||
return(rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage()
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s",usagetext);
|
fprintf(stderr, "%s", usagetext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
c2d.h.0
13
c2d.h.0
|
@ -13,13 +13,16 @@ typedef struct d {
|
||||||
|
|
||||||
const char *usagetext="\n\
|
const char *usagetext="\n\
|
||||||
usage: c2d [-vh?]\n\
|
usage: c2d [-vh?]\n\
|
||||||
c2d [-m] [-s start address override] input[.mon],[load_address] output.dsk\n\
|
c2d [-bgm] [-r row] [-t filename] [-s start address override] input[.mon],[load_address] output.dsk\n\
|
||||||
\n\
|
\n\
|
||||||
-h|? this help\n\
|
-h|? this help\n\
|
||||||
-m jump to monitor after booting\n\
|
-m jump to monitor after booting\n\
|
||||||
-s XXXX jump to XXXX after booting\n\
|
-s XXXX jump to XXXX after booting\n\
|
||||||
-t filename where filename is a 1K $400-$7FF text page splash screen.\n\
|
-t filename, where filename is a 1K $400-$7FF text page splash screen\n\
|
||||||
The splash screen will display while the binary is loading.\n\
|
The splash screen will display while the binary is loading\n\
|
||||||
|
-b animated loading bar\n\
|
||||||
|
-g splash page is mixed mode GR\n\
|
||||||
|
-r override row default of 19 with 'row'\n\
|
||||||
-v print version number and exit\n\
|
-v print version number and exit\n\
|
||||||
\n\
|
\n\
|
||||||
Input without a .mon extension is assumed to be a binary with a 4 byte header.\n\
|
Input without a .mon extension is assumed to be a binary with a 4 byte header.\n\
|
||||||
|
@ -9002,8 +9005,8 @@ disk blank = {
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x67,0x69,0x74,0x68,0x75,0x62,0x2e,0x63,
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
0x6f,0x6d,0x2f,0x64,0x61,0x74,0x61,0x6a,0x65,0x72,0x6b,0x2f,0x63,0x32,0x64,0x2f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
4
dwine
Executable file
4
dwine
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
docker run --rm -it -v $PWD:/pwd wine32 bash -c "cd /pwd && sleep 1 && wine $*"
|
BIN
gameserverclient
BIN
gameserverclient
Binary file not shown.
4104
gameserverclient.mon
Normal file
4104
gameserverclient.mon
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -1,24 +1,24 @@
|
||||||
|
___ __ ______
|
||||||
|
/ | ____ ____ / /__ / / _/
|
||||||
|
/ /| | / __ \/ __ \/ / _ \ / / /
|
||||||
|
/ ___ |/ /_/ / /_/ / / __/ / / /
|
||||||
|
/_/ |_/ .___/ .___/_/\___/ _/ / /
|
||||||
|
/_/ /_/ /__/__/
|
||||||
______
|
______
|
||||||
/ ____/___ _____ ___ ___
|
/ ____/___ _____ ___ ___
|
||||||
/ / __/ __ `/ __ `__ \/ _ \
|
/ / __/ __ `/ __ `__ \/ _ \
|
||||||
/ /_/ / /_/ / / / / / / __/
|
/ /_/ / /_/ / / / / / / __/
|
||||||
\____/\__,_/_/ /_/ /_/\___/
|
\____/\__,_/_/ /_/ /_/\___/
|
||||||
|
|
||||||
_____
|
_____
|
||||||
/ ___/___ ______ _____ _____
|
/ ___/___ ______ _____ _____
|
||||||
\__ \/ _ \/ ___/ | / / _ \/ ___/
|
\__ \/ _ \/ ___/ | / / _ \/ ___/
|
||||||
___/ / __/ / | |/ / __/ /
|
___/ / __/ / | |/ / __/ /
|
||||||
/____/\___/_/ |___/\___/_/
|
/____/\___/_/ |___/\___/_/
|
||||||
|
____ ___ __
|
||||||
|
/ __ \____ / (_)___ ___ / /
|
||||||
|
/ / / / __ \/ / / __ \/ _ \/ /
|
||||||
|
/ /_/ / / / / / / / / / __/_/
|
||||||
|
\____/_/ /_/_/_/_/ /_/\___(_)
|
||||||
|
|
||||||
_________ __
|
THE APPLE ][ AE WARESHOLE IS BACK!
|
||||||
/ ____/ (_)__ ____ / /_
|
CASSETTE PORT FTW! ---- ASCIIEXPRESS.NET
|
||||||
/ / / / / _ \/ __ \/ __/
|
|
||||||
/ /___/ / / __/ / / / /_
|
|
||||||
\____/_/_/\___/_/ /_/\__/
|
|
||||||
|
|
||||||
____ ___
|
|
||||||
/ __ \____ / (_)___ ___
|
|
||||||
/ / / / __ \/ / / __ \/ _ \
|
|
||||||
/ /_/ / / / / / / / / / __/
|
|
||||||
\____/_/ /_/_/_/_/ /_/\___/
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
BIN
gameserverclient.tiff
Normal file
BIN
gameserverclient.tiff
Normal file
Binary file not shown.
BIN
gameserverclientsplash.tiff
Normal file
BIN
gameserverclientsplash.tiff
Normal file
Binary file not shown.
44
makeheader
44
makeheader
|
@ -1,43 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
header()
|
|
||||||
{
|
|
||||||
FILE=$1
|
|
||||||
VAR=$2
|
|
||||||
EOL=$3
|
|
||||||
BYTES=$(hexdump -v $FILE | sed 's/^.......//' | wc -w | awk '{print $1}');
|
|
||||||
|
|
||||||
echo "/*"
|
|
||||||
expand ${FILE}.s
|
|
||||||
echo "*/"
|
|
||||||
|
|
||||||
printf "unsigned char $VAR[] = {\n\t"
|
|
||||||
|
|
||||||
for i in $(hexdump -v $FILE | sed 's/^.......//');
|
|
||||||
do
|
|
||||||
printf "0x%02X" 0x$i
|
|
||||||
BYTES=$((BYTES - 1))
|
|
||||||
if ((BYTES != 0))
|
|
||||||
then
|
|
||||||
printf ","
|
|
||||||
fi
|
|
||||||
EOL=$((EOL - 1))
|
|
||||||
if ((EOL == 0))
|
|
||||||
then
|
|
||||||
EOL=8
|
|
||||||
printf "\n\t"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "\n};\n"
|
|
||||||
}
|
|
||||||
|
|
||||||
cd asm
|
cd asm
|
||||||
make clean
|
make clean
|
||||||
make
|
PATH=../cc65-2.13.3/bin:$PATH make
|
||||||
|
|
||||||
(
|
(
|
||||||
header loader loadercode 8
|
echo "/*"
|
||||||
|
expand loader.s
|
||||||
|
echo "*/"
|
||||||
|
/usr/bin/xxd -i loader | sed 's/loader/loadercode/'
|
||||||
|
|
||||||
|
echo "/*"
|
||||||
|
expand bar.s
|
||||||
|
echo "*/"
|
||||||
|
/usr/bin/xxd -i bar | sed 's/bar/barcode/'
|
||||||
) > ../c2d.h.1
|
) > ../c2d.h.1
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
94
mandelbrotgr.c
Normal file
94
mandelbrotgr.c
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#define MAX 15
|
||||||
|
#define NORMAL 0x80
|
||||||
|
|
||||||
|
// unsigned char colors[16] = { 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 };
|
||||||
|
|
||||||
|
// chanage order and number of colors for different output
|
||||||
|
// default palette
|
||||||
|
// unsigned char colors[15] = { 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 };
|
||||||
|
// redish
|
||||||
|
// unsigned char colors[15] = { 0xB, 0x3, 0x1, 0x9, 0xD, 0xE, 0xB, 0x4, 0x7, 0x6, 0x2, 0xA, 0x5, 0x8, 0x0 };
|
||||||
|
// blueish
|
||||||
|
unsigned char colors[15] = { 0x2, 0x6, 0x7, 0xE, 0xC, 0x4, 0xD, 0x9, 0xB, 0x3, 0x1, 0xA, 0x5, 0x8, 0x0 };
|
||||||
|
|
||||||
|
const char text[4][41] = {
|
||||||
|
"EXAMPLE GR/TEXT SPLASH SCREEN",
|
||||||
|
"LOADING GAME SERVER CLIENT...",
|
||||||
|
"________________________________________",
|
||||||
|
"________________________________________",
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int c, r, i, j, k, line = 0;
|
||||||
|
double xd, yd, x0, y0, x, y, xt;
|
||||||
|
unsigned char screen[24][40];
|
||||||
|
|
||||||
|
// clear screen to zeros
|
||||||
|
for (i = 0; i < 24; i++)
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
screen[i][j] = 0x00;
|
||||||
|
|
||||||
|
c = 40;
|
||||||
|
r = 40;
|
||||||
|
xd = (1.0 - -2.5) / (double) c; // size of x pixel
|
||||||
|
yd = (1.0 - -1.0) / (double) r; // size of y pixel
|
||||||
|
|
||||||
|
// 39 rows, set i = 1
|
||||||
|
for (i = 1; i < r; i++) {
|
||||||
|
// gr text page translation
|
||||||
|
// 40 row
|
||||||
|
// line = 3 * ((i / 2) % 8) + i / 16;
|
||||||
|
// 39 row
|
||||||
|
line = 3 * (((i - 1) / 2) % 8) + (i - 1) / 16;
|
||||||
|
y0 = 1 - i * yd;
|
||||||
|
for (j = 0; j < c; j++) {
|
||||||
|
x0 = -2.5 + j * xd;
|
||||||
|
k = x = y = 0;
|
||||||
|
while (x * x + y * y <= 4 && k < MAX) {
|
||||||
|
xt = x * x - y * y + x0;
|
||||||
|
y = 2 * x * y + y0;
|
||||||
|
x = xt;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 39 row
|
||||||
|
screen[line][j] |= (colors[(k - 1) / (MAX / sizeof(colors))] << 4 * (i % 2 == 0));
|
||||||
|
|
||||||
|
// 40 row
|
||||||
|
//screen[line][j] |= (colors[(k - 1) / (MAX / sizeof(colors))] << 4 * (i % 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear text lines with spaces
|
||||||
|
for (i = 20; i < 24; i++) {
|
||||||
|
line = 3 * (i % 8) + i / 8;
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
screen[line][j] = ' ' | NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
line = 3 * ((i + 20) % 8) + (i + 20) / 8;
|
||||||
|
for (j = 0; j < 20 - strlen(text[i]) / 2; j++)
|
||||||
|
screen[line][j] = ' ' | NORMAL; // text rows
|
||||||
|
for (k = 0; k < strlen(text[i]); k++)
|
||||||
|
screen[line][j++] = text[i][k] | NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump to stdout
|
||||||
|
for (i = 0; i < 24; i++) {
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
putchar(screen[i][j]);
|
||||||
|
if (i % 3 == 2)
|
||||||
|
for (k = 0; k < 8; k++)
|
||||||
|
putchar(0x0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
32
page2text.c
Normal file
32
page2text.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define MASK 0x7F
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int i, j, k, line;
|
||||||
|
char screen[24][40];
|
||||||
|
|
||||||
|
// clear screen (just in case partial dump)
|
||||||
|
for (i = 0; i < 24; i++)
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
screen[i][j] = ' ';
|
||||||
|
|
||||||
|
for (i = 0; i < 24; i++) {
|
||||||
|
line = 8 * (i % 3) + i / 3;
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
screen[line][j] = getchar() & MASK;
|
||||||
|
if (i % 3 == 2)
|
||||||
|
for (k = 0; k < 8; k++)
|
||||||
|
getchar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump to stdout
|
||||||
|
for (i = 0; i < 24; i++) {
|
||||||
|
for (j = 0; j < 40; j++)
|
||||||
|
putchar(screen[i][j]);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
47
test.scrp
Normal file
47
test.scrp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
on run argv
|
||||||
|
|
||||||
|
set my_path to (system attribute "PWD") & "/"
|
||||||
|
set my_disk to item 1 of argv
|
||||||
|
set my_done1 to item 2 of argv
|
||||||
|
set my_done2 to item 3 of argv
|
||||||
|
set my_timeout1 to item 4 of argv
|
||||||
|
set my_timeout2 to item 5 of argv
|
||||||
|
|
||||||
|
tell application "Virtual ]["
|
||||||
|
activate
|
||||||
|
-- may need delay for this error: execution error: Virtual ][ got an error: Connection is invalid. (-609)
|
||||||
|
delay 1.5
|
||||||
|
-- Close all open machines
|
||||||
|
close every machine saving no
|
||||||
|
-- Create a new (AppleIIe)
|
||||||
|
set theMachine to (make new AppleIIe)
|
||||||
|
tell theMachine
|
||||||
|
-- Change to a color screen
|
||||||
|
set monochrome screen to false
|
||||||
|
set scanlines to true
|
||||||
|
set speaker volume to 0.25
|
||||||
|
insert my_path & my_disk into device "S6D1"
|
||||||
|
|
||||||
|
try
|
||||||
|
with timeout of my_timeout1 seconds
|
||||||
|
waiting until screen equals imagefile POSIX path of (my_path & my_done1)
|
||||||
|
end timeout
|
||||||
|
on error
|
||||||
|
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_done1
|
||||||
|
end try
|
||||||
|
|
||||||
|
try
|
||||||
|
with timeout of my_timeout2 seconds
|
||||||
|
waiting until screen equals imagefile POSIX path of (my_path & my_done2)
|
||||||
|
end timeout
|
||||||
|
on error
|
||||||
|
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_done2
|
||||||
|
end try
|
||||||
|
|
||||||
|
end tell
|
||||||
|
delay 0.5
|
||||||
|
close every machine saving no
|
||||||
|
quit
|
||||||
|
end tell
|
||||||
|
end run
|
||||||
|
|
178
test.sh
178
test.sh
|
@ -2,74 +2,196 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
PATH=bin:$PATH
|
||||||
BIN=gameserverclient
|
BIN=gameserverclient
|
||||||
ADDR=800
|
ADDR=800
|
||||||
SUM=898ebb103fdda6fffe62394c1b915d1d
|
SUM=3226e0aa8f35ee23a9de9b8f05abf688
|
||||||
|
|
||||||
rm -f ${BIN}.dsk
|
rm -f ${BIN}.dsk
|
||||||
echo
|
echo
|
||||||
echo "Testing OS/X c2d..."
|
echo "Testing OS/X c2d..."
|
||||||
echo
|
echo
|
||||||
echo "bin/c2d ${BIN},${ADDR} ${BIN}.dsk"
|
echo "c2d ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
bin/c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
if [ "$CHECK" = "$SUM" ]
|
if [ "$CHECK" = "$SUM" ]
|
||||||
then
|
then
|
||||||
echo PASSED
|
echo PASSED
|
||||||
else
|
else
|
||||||
echo FAILED
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${BIN}.dsk
|
if ((EMU == 1))
|
||||||
echo
|
|
||||||
echo "Testing Windows c2d..."
|
|
||||||
echo
|
|
||||||
PATH=$HOME/wine/bin:$PATH
|
|
||||||
echo "wine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk"
|
|
||||||
wine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
|
||||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
|
||||||
if [ "$CHECK" = "$SUM" ]
|
|
||||||
then
|
then
|
||||||
echo PASSED
|
echo
|
||||||
else
|
echo -n "Emulator Test..."
|
||||||
|
if ! OUTPUT=$(osascript test.scrp gameserverclient.dsk gameserverclient.tiff gameserverclient.tiff 15 15)
|
||||||
|
then
|
||||||
echo FAILED
|
echo FAILED
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo FAILED
|
||||||
|
echo $OUTPUT
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo PASSED
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SUM=aaed7ee47fde72a69435d146f01301f4
|
if ((WIN == 1))
|
||||||
|
then
|
||||||
|
rm -f ${BIN}.dsk
|
||||||
|
echo
|
||||||
|
echo "Testing Windows c2d..."
|
||||||
|
echo
|
||||||
|
echo "./dwine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
|
./dwine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
|
if [ "$CHECK" = "$SUM" ]
|
||||||
|
then
|
||||||
|
echo PASSED
|
||||||
|
else
|
||||||
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUM=56a52e40a2351ff39669efa3fbdd0f19
|
||||||
|
|
||||||
rm -f ${BIN}.dsk
|
rm -f ${BIN}.dsk
|
||||||
echo
|
echo
|
||||||
echo "Testing OS/X c2d textpage..."
|
echo "Testing OS/X c2d textpage..."
|
||||||
echo
|
echo
|
||||||
echo "bin/text2page <${BIN}.text >${BIN}.textpage"
|
echo "text2page <${BIN}.text | page2text | text2page >${BIN}.textpage"
|
||||||
bin/text2page <${BIN}.text >${BIN}.textpage
|
text2page <${BIN}.text | page2text | text2page >${BIN}.textpage
|
||||||
echo "bin/c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
echo "c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
bin/c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
if [ "$CHECK" = "$SUM" ]
|
if [ "$CHECK" = "$SUM" ]
|
||||||
then
|
then
|
||||||
echo PASSED
|
echo PASSED
|
||||||
else
|
else
|
||||||
echo FAILED
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ((EMU == 1))
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo -n "Emulator Test..."
|
||||||
|
if ! OUTPUT=$(osascript test.scrp gameserverclient.dsk gameserverclientsplash.tiff gameserverclient.tiff 15 15)
|
||||||
|
then
|
||||||
|
echo FAILED
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo FAILED
|
||||||
|
echo $OUTPUT
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo PASSED
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((WIN == 1))
|
||||||
|
then
|
||||||
|
rm -f ${BIN}.dsk
|
||||||
|
echo
|
||||||
|
echo "Testing Windows c2d textpage..."
|
||||||
|
echo
|
||||||
|
echo "./dwine bin/text2page.exe <${BIN}.text >${BIN}.textpage"
|
||||||
|
./dwine bin/text2page.exe '<'${BIN}.text '>'${BIN}.textpage
|
||||||
|
echo "./dwine bin/c2d.exe -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
|
./dwine bin/c2d.exe -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
|
if [ "$CHECK" = "$SUM" ]
|
||||||
|
then
|
||||||
|
echo PASSED
|
||||||
|
else
|
||||||
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
BIN=gameserverclient
|
||||||
|
MON=gameserverclient.mon
|
||||||
|
ADDR=800
|
||||||
|
SUM=3226e0aa8f35ee23a9de9b8f05abf688
|
||||||
|
|
||||||
rm -f ${BIN}.dsk
|
rm -f ${BIN}.dsk
|
||||||
echo
|
echo
|
||||||
echo "Testing Windows c2d textpage..."
|
echo "Testing OS/X c2d..."
|
||||||
echo
|
echo
|
||||||
PATH=$HOME/wine/bin:$PATH
|
echo "c2d ${MON} ${BIN}.dsk"
|
||||||
echo "wine bin/text2page.exe <${BIN}.text >${BIN}.textpage"
|
c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
wine bin/text2page.exe <${BIN}.text >${BIN}.textpage
|
|
||||||
echo "wine bin/c2d.exe -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
|
||||||
wine bin/c2d.exe -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
|
||||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
if [ "$CHECK" = "$SUM" ]
|
if [ "$CHECK" = "$SUM" ]
|
||||||
then
|
then
|
||||||
echo PASSED
|
echo PASSED
|
||||||
else
|
else
|
||||||
echo FAILED
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ((WIN == 1))
|
||||||
|
then
|
||||||
|
rm -f ${BIN}.dsk
|
||||||
|
echo
|
||||||
|
echo "Testing Windows c2d..."
|
||||||
|
echo
|
||||||
|
echo "./dwine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
|
./dwine bin/c2d.exe ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
|
if [ "$CHECK" = "$SUM" ]
|
||||||
|
then
|
||||||
|
echo PASSED
|
||||||
|
else
|
||||||
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUM=56a52e40a2351ff39669efa3fbdd0f19
|
||||||
|
|
||||||
|
rm -f ${BIN}.dsk
|
||||||
|
echo
|
||||||
|
echo "Testing OS/X c2d textpage..."
|
||||||
|
echo
|
||||||
|
echo "text2page <${BIN}.text >${BIN}.textpage"
|
||||||
|
text2page <${BIN}.text >${BIN}.textpage
|
||||||
|
echo "c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
|
c2d -t ${BIN}.textpage ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
|
if [ "$CHECK" = "$SUM" ]
|
||||||
|
then
|
||||||
|
echo PASSED
|
||||||
|
else
|
||||||
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ((WIN == 1))
|
||||||
|
then
|
||||||
|
rm -f ${BIN}.dsk
|
||||||
|
echo
|
||||||
|
echo "Testing Windows c2d textpage..."
|
||||||
|
echo
|
||||||
|
echo "./dwine bin/text2page.exe <${BIN}.text >${BIN}.textpage"
|
||||||
|
./dwine bin/text2page.exe '<'${BIN}.text '>'${BIN}.textpage
|
||||||
|
echo "./dwine bin/c2d.exe -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||||
|
./dwine bin/c2d.exe -t ${BIN}.textpage ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||||
|
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||||
|
if [ "$CHECK" = "$SUM" ]
|
||||||
|
then
|
||||||
|
echo PASSED
|
||||||
|
else
|
||||||
|
echo "FAILED $CHECK != $SUM (expected)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
69
text2page.c
69
text2page.c
|
@ -1,59 +1,44 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
unsigned char holes[] = {
|
#define NORMAL 0x80
|
||||||
0x37,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
|
#define BLINK 0x40
|
||||||
0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,
|
|
||||||
0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,
|
|
||||||
0xff,0xff,0x00,0x17,0xff,0xff,0x00,0x00,
|
|
||||||
0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
|
|
||||||
0xff,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
|
|
||||||
0xff,0xff,0x00,0xd0,0xff,0xff,0x00,0x00,
|
|
||||||
0xc6,0xff,0x00,0x07,0xff,0xff,0x00,0x00
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char c, highbit = 0x80;
|
char c;
|
||||||
int i, j, k, columns = 0, lines = 0, linemap[24];
|
int i, j, k, line = 0;
|
||||||
unsigned char screen[24][40];
|
unsigned char screen[24][40];
|
||||||
|
|
||||||
// build table
|
// clear screen (just in case < 40x24)
|
||||||
for(j=0,i=0;i<8;i++) {
|
for (i = 0; i < 24; i++)
|
||||||
linemap[ 0 + j]=0+3*j;
|
for (j = 0; j < 40; j++)
|
||||||
linemap[ 8 + j]=1+3*j;
|
screen[i][j] = ' ' | NORMAL;
|
||||||
linemap[16 + j]=2+3*j;
|
|
||||||
j++;
|
i = j = 0;
|
||||||
|
while ((c = getchar()) != EOF) {
|
||||||
|
if (c == '\r') // windows trash
|
||||||
|
continue;
|
||||||
|
if (c == '\n') { // end of line
|
||||||
|
j = 0;
|
||||||
|
i++;
|
||||||
|
line = 3 * (i % 8) + i / 8;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (j > 39) // user didn't read the docs
|
||||||
// clear screen
|
|
||||||
for(i=0;i<24;i++)
|
|
||||||
for(j=0;j<40;j++)
|
|
||||||
screen[linemap[i]][j] = ' ' | highbit;
|
|
||||||
|
|
||||||
while((c = getchar()) != EOF) {
|
|
||||||
if(c == '\r') // windows trash
|
|
||||||
continue;
|
continue;
|
||||||
if(columns > 40) // user didn't read the docs
|
if (i > 23) // ditto
|
||||||
continue;
|
|
||||||
if(lines > 24) // ditto
|
|
||||||
break;
|
break;
|
||||||
if(c == '\n') { // end of line
|
|
||||||
columns=0;
|
|
||||||
lines++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
screen[linemap[lines]][columns] = c | highbit;
|
screen[line][j++] = c | NORMAL;
|
||||||
columns++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump to stdout
|
// dump to stdout
|
||||||
for(i=0;i<24;i++) {
|
for (i = 0; i < 24; i++) {
|
||||||
for(j=0;j<40;j++)
|
for (j = 0; j < 40; j++)
|
||||||
putchar(screen[i][j]);
|
putchar(screen[i][j]);
|
||||||
if((i + 1) % 3 == 0)
|
if (i % 3 == 2)
|
||||||
for(k=0;k<8;k++)
|
for (k = 0; k < 8; k++)
|
||||||
putchar(holes[(i/3)*8+k]);
|
putchar(0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user