Compare commits

...

21 Commits

Author SHA1 Message Date
Egan Ford 9af2b2d8fd new bins from tests, hack to dwine to sleep 1 sec before test 2023-10-26 14:57:08 -06:00
datajerk f3991f4cd1
Merge pull request #3 from ryandesign/ryandesign-cc
Allow Makefile compiler to be set with CC variable
2023-10-26 14:54:07 -06:00
datajerk d74542dd56
Merge pull request #2 from ryandesign/ryandesign-strict-prototypes
Fix issues found with -Wstrict-prototypes
2023-10-26 14:53:26 -06:00
Ryan Schmidt 11281905bd Allow Makefile compiler to be set with CC variable 2023-10-25 23:03:40 -05:00
Ryan Schmidt a54024f82a Fix issues found with -Wstrict-prototypes 2023-10-25 22:43:55 -05:00
Egan Ford e4815fe220 updated README.md 2023-05-10 17:37:01 -06:00
Egan Ford 9b1b8c423c updated README.md links, cleaned up testing docs 2023-05-10 17:24:58 -06:00
Egan Ford 6105800884 readded binaries 2023-05-09 14:25:36 -06:00
Egan Ford a64e5a176b readded binaries 2023-05-09 14:04:22 -06:00
Egan Ford ced20889ab docker wine32 support added 2023-05-09 14:02:04 -06:00
Egan Ford e6e2c9b15a fixed virtual ii 11.1 testing 2023-05-09 13:37:58 -06:00
Egan Ford 51933f3223 fixed windows testing, docker required now 2023-05-09 12:32:10 -06:00
Egan Ford 163d8a9661 updated README for cc65 version 2023-05-09 12:10:22 -06:00
Egan Ford e0d9e2a3ca included cc65 build, macos universal builds, refactored 2023-05-09 12:04:21 -06:00
Egan Ford e690a1c022 spelling error 2019-06-23 09:54:29 -06:00
Egan Ford ecd49dd0bf updated gameserverclient example binary 2017-05-31 20:15:19 -06:00
Egan Ford 0a4199ed9c updated README 2017-05-11 16:11:02 -06:00
Egan Ford 6db80b8ae5 minor readme and comment and formatting updates 2017-05-06 12:24:37 -06:00
Egan Ford ebf2cfc94d minor readme and comment and formatting updates 2017-05-06 12:22:59 -06:00
Egan Ford 5e85697fe4 readme clean 2017-05-05 07:41:02 -06:00
Egan Ford 7e03db4b42 readme clean 2017-05-05 07:40:00 -06:00
22 changed files with 4233 additions and 13629 deletions

12
Dockerfile.wine32 Normal file
View 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

View File

@ -1,5 +1,6 @@
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 bin/page2text
@ -7,32 +8,63 @@ windows: bin/c2d.exe bin/text2page.exe bin/page2text.exe
dist: all windows
c2d.h: c2d.h.0 asm/loader.s asm/bar.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
bin/c2d: c2d.c c2d.h
gcc -Wall -Wno-missing-braces -I. -O3 -o $@ $< -lm
bin/c2d_arm: c2d.c c2d.h
$(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
$(WIN32GCC) -Wall -Wno-missing-braces -I. -O3 -o $@ $<
bin/text2page: text2page.c
gcc -Wall -O3 -o $@ $< -lm
bin/text2page.exe: text2page.c
$(WIN32GCC) -Wall -O3 -o $@ $<
bin/page2text: page2text.c
gcc -Wall -O3 -o $@ $< -lm
bin/page2text.exe: page2text.c
$(WIN32GCC) -Wall -O3 -o $@ $<
bin/mandelbrotgr: mandelbrotgr.c
gcc -Wall -O3 -o $@ $< -lm
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)
gameserverclient.text: Makefile
@ -65,19 +97,22 @@ barloader.textpage: barloader.text bin/text2page
bin/text2page <$< >$@
gameserverclientbar.dsk: barloader.textpage gameserverclient bin/c2d Makefile
bin/c2d -b -t $< gameserverclient,800 $@
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 $@
bin/c2d -b -g -r 23 -t $< gameserverclient,800 $@
gameserverclient.dsk: gameserverclient bin/c2d Makefile
bin/c2d gameserverclient,800 $@
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

View File

@ -4,13 +4,17 @@
> 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
* `$800-$B6FF` available for binary code.
* `$B700-$BFFF` free after load.
* Platforms tested:
* 32-bit/64-bit x86 OS/X.
* 32-bit/64-bit x86 MacOS|OS/X.
* 32-bit x86 Windows/MinGW.
@ -25,6 +29,11 @@ git clone https://github.com/datajerk/c2d.git
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
Unix/Linux:
@ -33,7 +42,7 @@ Unix/Linux:
*or*
OS/X, Linux, Cygwin:
MacOS|OS/X, Linux, Cygwin:
gcc -Wall -Wno-missing-braces -I. -O3 -o c2d c2d.c -lm
gcc -Wall -O3 -o bin/text2page text2page.c -lm
@ -86,16 +95,18 @@ 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 (don't worry the `c2d` loader will not over-right the Peripheral Slot Scratchpad RAM).
> 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` tell `c2d` to put up a text splash page while the binary is loading.
`-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
```
@ -104,6 +115,8 @@ c2d -b -t barloader.textpage gameserverclient,800 gameserverclientbar.dsk
[![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
```
@ -131,20 +144,20 @@ page2text <gameserverclient.textpage >gameserverclient.text
### Testing
Automated testing is only supported on OS/X and requires the following:
Automated testing is only supported on MacOS|OS/X and requires the following:
* Virtual ][ (<http://http://www.virtualii.com/>)
* Windows cross-compiling tools <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>
* Wine (<http://winehq.org>) installed in `~/wine` (extract the tarball in `~/wine` and move the contents of `~/wine/usr` to `~/wine`, or change the path to `wine` in `tests/test.sh`).
* 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 # OS/X only
make disttest # OS/X and Windows
make fulltest # OS/X, Windows, and Virtual ][
make test # MacOS|OS/X only
make disttest # MacOS|OS/X and Windows
make fulltest # MacOS|OS/X, Windows, and Virtual ][
```
> If Virtual ][ crashes while testing, just `make fulltest` again
### Bugs

View File

@ -1,9 +1,6 @@
CL = cl65
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)
AOBJ = $(ASRC:%.s=%.o)
@ -17,11 +14,4 @@ clean:
-rm -f $(ABIN) $(AOBJ) $(ALST) $(AMON)
%: %.s
$(CL) $(CL_FLAGS) $<
%: %.c
$(CC) $(CC_FLAGS) $<
%.mon: %
$(C2T) $< $@
$(CL) $(CL_FLAGS) $<

BIN
bin/c2d

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

14
c2d.c
View File

@ -18,7 +18,7 @@ License:
Description:
This small utility will read Apple II binary and monitor text files and
output a DOS ordered dsk image that will boot your code quickly.
output a DOS ordered dsk image that will boot your code quickly.
Features:
* Apple II+, IIe support.
@ -49,7 +49,7 @@ Bugs:
#define MONITOR 1
#define LOADER "loader"
void usage();
void usage(void);
char *getext(char *filename);
int main(int argc, char **argv)
@ -276,10 +276,6 @@ int main(int argc, char **argv)
// program start MSB
blank.track[1].sector[4].byte[loadersize + 8] = rowaddr >> 8;
// temp hack to prevent screen from scrolling
//if(row == 23)
// bar_length = 39;
for(i = 1; i <= bar_length; i++)
blank.track[1].sector[4].byte[loadersize + 8 + i] = i * num_sectors / bar_length;
}
@ -302,7 +298,6 @@ int main(int argc, char **argv)
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;
blank.track[0].sector[1].byte[0x3B] = 0x4C;
@ -341,7 +336,8 @@ char *getext(char *filename)
if (sp == strlen(filename) || sp == 0)
return (NULL);
if ((rval = (char *) malloc(sp * sizeof(char))) == NULL); //do error code
if ((rval = (char *) malloc(sp * sizeof(char))) == NULL)
; //do error code
rval[sp] = '\0';
for (i = 0; i < sp + i; i++)
@ -350,7 +346,7 @@ char *getext(char *filename)
return (rval);
}
void usage()
void usage(void)
{
fprintf(stderr, "%s", usagetext);
}

9437
c2d.h

File diff suppressed because it is too large Load Diff

4
dwine Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -x
docker run --rm -it -v $PWD:/pwd wine32 bash -c "cd /pwd && sleep 1 && wine $*"

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,44 +1,19 @@
#!/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
make clean
make
PATH=../cc65-2.13.3/bin:$PATH make
(
header loader loadercode 8
header bar barcode 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
cd ..

View File

@ -2,7 +2,7 @@
#define MASK 0x7F
int main()
int main(int argc, char **argv)
{
int i, j, k, line;
char screen[24][40];

View File

@ -17,7 +17,7 @@ on run argv
set theMachine to (make new AppleIIe)
tell theMachine
-- Change to a color screen
-- set monochrome screen to false
set monochrome screen to false
set scanlines to true
set speaker volume to 0.25
insert my_path & my_disk into device "S6D1"

36
test.sh
View File

@ -5,7 +5,7 @@ set -e
PATH=bin:$PATH
BIN=gameserverclient
ADDR=800
SUM=198bfc7dc8b17256c3c252998c26ce03
SUM=3226e0aa8f35ee23a9de9b8f05abf688
rm -f ${BIN}.dsk
echo
@ -47,9 +47,8 @@ then
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/^/ /'
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
@ -60,7 +59,7 @@ then
fi
fi
SUM=df792a2715bb9f7b91aed94e19e5f46c
SUM=56a52e40a2351ff39669efa3fbdd0f19
rm -f ${BIN}.dsk
echo
@ -104,11 +103,10 @@ then
echo
echo "Testing Windows c2d textpage..."
echo
PATH=$HOME/wine/bin:$PATH
echo "wine bin/text2page.exe <${BIN}.text >${BIN}.textpage"
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/^/ /'
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
@ -122,7 +120,7 @@ fi
BIN=gameserverclient
MON=gameserverclient.mon
ADDR=800
SUM=198bfc7dc8b17256c3c252998c26ce03
SUM=3226e0aa8f35ee23a9de9b8f05abf688
rm -f ${BIN}.dsk
echo
@ -145,9 +143,8 @@ rm -f ${BIN}.dsk
echo
echo "Testing Windows c2d..."
echo
PATH=$HOME/wine/bin:$PATH
echo "wine bin/c2d.exe ${BIN},${ADDR} ${BIN}.dsk"
wine bin/c2d.exe ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
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
@ -158,7 +155,7 @@ rm -f ${BIN}.dsk
fi
fi
SUM=df792a2715bb9f7b91aed94e19e5f46c
SUM=56a52e40a2351ff39669efa3fbdd0f19
rm -f ${BIN}.dsk
echo
@ -183,11 +180,10 @@ then
echo
echo "Testing Windows c2d textpage..."
echo
PATH=$HOME/wine/bin:$PATH
echo "wine bin/text2page.exe <${BIN}.text >${BIN}.textpage"
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 ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
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

View File

@ -3,7 +3,7 @@
#define NORMAL 0x80
#define BLINK 0x40
int main()
int main(int argc, char **argv)
{
char c;
int i, j, k, line = 0;