mirror of
https://github.com/datajerk/c2d.git
synced 2024-09-28 17:54:48 +00:00
Compare commits
31 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 |
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
|
83
Makefile
83
Makefile
@ -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,29 +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 holes.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/c2d.exe: c2d.c c2d.h holes.h
|
||||
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 holes.h
|
||||
gcc -Wall -O3 -o $@ $< -lm
|
||||
|
||||
bin/text2page.exe: text2page.c holes.h
|
||||
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 $@ $<
|
||||
|
||||
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
|
||||
@ -55,21 +90,35 @@ barloader.text: Makefile
|
||||
text="________________________________________"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||
echo; \
|
||||
echo; \
|
||||
text="HTTPS://GITHUB.COM/DATAJERK/C2D/"; printf "%*s\n" $$((($${#text}+40)/2)) "$$text"; \
|
||||
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
|
||||
gameserverclientbar.dsk: barloader.textpage gameserverclient bin/c2d Makefile
|
||||
bin/c2d -b -t $< gameserverclient,800 $@
|
||||
|
||||
fulltest: gameserverclient gameserverclient.mon gameserverclient.text dist
|
||||
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 dist
|
||||
disttest: gameserverclient gameserverclient.mon gameserverclient.text test.sh dist
|
||||
EMU=0 WIN=1 ./test.sh
|
||||
|
||||
test: gameserverclient gameserverclient.mon gameserverclient.text all
|
||||
test: gameserverclient gameserverclient.mon gameserverclient.text test.sh all
|
||||
EMU=0 WIN=0 ./test.sh
|
||||
|
||||
|
75
README.md
75
README.md
@ -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
|
||||
@ -51,15 +60,15 @@ Windows/MinGW:
|
||||
|
||||
```
|
||||
usage: c2d [-vh?]
|
||||
c2d [-bum] [-r row] [-t filename] [-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
|
||||
-m jump to monitor after booting
|
||||
-s XXXX jump to XXXX after booting
|
||||
-t filename, where filename is a 1K $400-$7FF text page splash screen
|
||||
The splash screen will display while the binary is loading
|
||||
-u do not patch screen holes
|
||||
-b animated loading bar (experimental)
|
||||
-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
|
||||
|
||||
@ -82,6 +91,40 @@ Examples:
|
||||
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
|
||||
|
||||
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.
|
||||
@ -99,6 +142,24 @@ Input is expected to be an Apple II binary from $400-$7FF. Exactly 1024 bytes.
|
||||
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
|
||||
|
||||
Yes. No input checking. Big Endian untested.
|
||||
@ -106,7 +167,7 @@ Yes. No input checking. Big Endian untested.
|
||||
|
||||
### The Ugly Stuff
|
||||
|
||||
c2d, Code to Disk, Version 0.55
|
||||
c2d, Code to Disk, Version 0.57
|
||||
|
||||
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
||||
|
||||
|
12
asm/Makefile
12
asm/Makefile
@ -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)
|
||||
@ -18,10 +15,3 @@ clean:
|
||||
|
||||
%: %.s
|
||||
$(CL) $(CL_FLAGS) $<
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CC_FLAGS) $<
|
||||
|
||||
%.mon: %
|
||||
$(C2T) $< $@
|
||||
|
||||
|
61
asm/bar.s
61
asm/bar.s
@ -21,7 +21,7 @@ rwts = $B7B5 ; rwts jsr
|
||||
|
||||
; vars
|
||||
|
||||
stage1 = $800
|
||||
stage1 = $C00
|
||||
stage2 = $300 ; $300 looks open
|
||||
invsp = $20 ; inverse space for draw
|
||||
trkcnt = $00 ; track counter
|
||||
@ -34,6 +34,35 @@ 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
|
||||
@ -114,11 +143,24 @@ secloop:
|
||||
lda barptr ; get position
|
||||
;clc
|
||||
;adc #5 ; indent
|
||||
sta ch
|
||||
lda row ; row 19
|
||||
jsr movecur
|
||||
lda #invsp
|
||||
jsr cout
|
||||
|
||||
; 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
|
||||
@ -151,7 +193,14 @@ loadpage:
|
||||
.org *+1
|
||||
nextjump:
|
||||
.org *+2
|
||||
gr:
|
||||
.org *+1
|
||||
row:
|
||||
.org *+1
|
||||
rowlsb:
|
||||
.org *+1
|
||||
rowmsb:
|
||||
.org *+1
|
||||
bar:
|
||||
.org *+40
|
||||
end:
|
||||
|
68
asm/loader.s
68
asm/loader.s
@ -18,8 +18,7 @@ rwts = $B7B5 ; rwts jsr
|
||||
|
||||
; vars
|
||||
|
||||
stage1 = $800
|
||||
;stage2 = $B600 ; overwrite track 0/sector 0, not needed any more?
|
||||
stage1 = $C00
|
||||
stage2 = $300 ; $300 looks open
|
||||
;;;run time
|
||||
trkcnt = $00 ; track counter
|
||||
@ -32,6 +31,46 @@ trknum = $04 ; loop var
|
||||
start:
|
||||
.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 #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
|
||||
|
||||
ldx #0 ; move code to stage2
|
||||
move:
|
||||
lda moved,x
|
||||
@ -45,17 +84,6 @@ moved:
|
||||
.org stage2
|
||||
|
||||
loader:
|
||||
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
|
||||
|
||||
lda loadpage ; where to dump the tracks
|
||||
sta buffer
|
||||
|
||||
@ -125,14 +153,6 @@ loadpage:
|
||||
.org *+1
|
||||
nextjump:
|
||||
.org *+2
|
||||
;;; used for debug
|
||||
;trkcnt:
|
||||
; .org *+1
|
||||
;segcnt:
|
||||
; .org *+1
|
||||
;buffer:
|
||||
; .org *+1
|
||||
;secnum:
|
||||
; .org *+1
|
||||
;trknum:
|
||||
; .org *+1
|
||||
gr:
|
||||
.org *+1
|
||||
end:
|
||||
|
BIN
bargrloader.textpage
Normal file
BIN
bargrloader.textpage
Normal file
Binary file not shown.
@ -20,4 +20,4 @@ ________________________________________
|
||||
________________________________________
|
||||
|
||||
|
||||
HTTPS://GITHUB.COM/DATAJERK/C2D/
|
||||
HTTP://GITHUB.COM/DATAJERK/C2D
|
||||
|
Binary file not shown.
BIN
bin/c2d.exe
BIN
bin/c2d.exe
Binary file not shown.
BIN
bin/page2text
BIN
bin/page2text
Binary file not shown.
Binary file not shown.
BIN
bin/text2page
BIN
bin/text2page
Binary file not shown.
Binary file not shown.
60
c2d.c
60
c2d.c
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
c2d, Code to Disk, Version 0.55
|
||||
c2d, Code to Disk, Version 0.57
|
||||
|
||||
(c) 2012,2017 All Rights Reserved, Egan Ford (egan@sense.net)
|
||||
|
||||
@ -41,29 +41,29 @@ Bugs:
|
||||
#include <math.h>
|
||||
#include <sys/stat.h>
|
||||
#include "c2d.h"
|
||||
#include "holes.h"
|
||||
|
||||
#define VERSION "Version 0.55"
|
||||
#define VERSION "Version 0.57"
|
||||
#define INFILE argv[argc-2]
|
||||
#define OUTFILE argv[argc-1]
|
||||
#define BINARY 0
|
||||
#define MONITOR 1
|
||||
#define LOADER "loader"
|
||||
|
||||
void usage();
|
||||
void usage(void);
|
||||
char *getext(char *filename);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *ifp, *ofp;
|
||||
int c, i, j, k, start = 0, loadaddress, inputtype, warm = 0, filesize = 0, unpatch = 0;
|
||||
int loaderstart, loader = 0, loadersize = 0, loaderbasesize = 0, textpagesize = 0, bar = 0, row = 19;
|
||||
int c, i, j, k, start = 0, loadaddress, inputtype, warm = 0, filesize = 0;
|
||||
int loaderstart, loader = 0, loadersize = 0, loaderbasesize = 0, textpagesize = 0;
|
||||
int bar = 0, row = 19, gr = 0;
|
||||
struct stat st;
|
||||
char *filetypes[] = { "BINARY", "MONITOR" };
|
||||
char *ext, filename[256], load_address[10], *textpage = NULL;
|
||||
|
||||
opterr = 1;
|
||||
while ((c = getopt(argc, argv, "r:t:vmh?s:ub")) != -1)
|
||||
while ((c = getopt(argc, argv, "gr:t:vmh?s:b")) != -1)
|
||||
switch (c) {
|
||||
case 't': // load a splash page while loading binary
|
||||
loader = 1;
|
||||
@ -82,13 +82,15 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 'r': // bar row
|
||||
row = (int) strtol(optarg, (char **) NULL, 10); // todo: input check
|
||||
break;
|
||||
case 'u':
|
||||
unpatch = 1;
|
||||
if (row > 23)
|
||||
row = 23;
|
||||
break;
|
||||
case 'b':
|
||||
bar = 1;
|
||||
break;
|
||||
case 'g':
|
||||
gr = 1;
|
||||
break;
|
||||
case 'h': // help
|
||||
case '?':
|
||||
usage();
|
||||
@ -223,20 +225,6 @@ int main(int argc, char **argv)
|
||||
fread(&blank.track[1].sector[0].byte[0], textpagesize, 1, ifp);
|
||||
fclose(ifp);
|
||||
|
||||
// patch holes
|
||||
if(!unpatch) {
|
||||
uint64_t *p = (uint64_t *)&blank.track[1].sector[0].byte[0]; // set to start of splash page
|
||||
uint64_t *h = (uint64_t *)&holes; // holes are 64-bits
|
||||
int i;
|
||||
|
||||
p -= 1; // back up virtual hole
|
||||
|
||||
for(i = 0; i < 8; i++) {
|
||||
p += 16; // 3 lines x 40 columns + last hole / 8 (64-bit);
|
||||
*p = *h++; // copy screen hole data
|
||||
}
|
||||
}
|
||||
|
||||
if(!bar) {
|
||||
loaderbasesize = sizeof(loadercode);
|
||||
if ((loadersize = sizeof(loadercode)) > 256) {
|
||||
@ -269,21 +257,30 @@ int main(int argc, char **argv)
|
||||
blank.track[1].sector[4].byte[loadersize + 3] = start & 0xFF;
|
||||
// program start MSB
|
||||
blank.track[1].sector[4].byte[loadersize + 4] = start >> 8;
|
||||
// gr mode
|
||||
blank.track[1].sector[4].byte[loadersize + 5] = gr;
|
||||
|
||||
//bar code, pre compute status bar table
|
||||
if(bar) {
|
||||
int num_sectors = (int) ceil((filesize + (loadaddress & 0xFF)) / 256.0);
|
||||
int bar_length = 40;
|
||||
int i;
|
||||
int i, rowaddr;
|
||||
|
||||
// bar row
|
||||
blank.track[1].sector[4].byte[loadersize + 5] = 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 + 5 + i] = i * num_sectors / bar_length;
|
||||
blank.track[1].sector[4].byte[loadersize + 8 + i] = i * num_sectors / bar_length;
|
||||
}
|
||||
|
||||
loaderstart = 0x400;
|
||||
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
|
||||
@ -301,7 +298,7 @@ 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;
|
||||
blank.track[0].sector[1].byte[0x3C] = loaderstart & 0xFF;
|
||||
@ -339,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++)
|
||||
@ -348,7 +346,7 @@ char *getext(char *filename)
|
||||
return (rval);
|
||||
}
|
||||
|
||||
void usage()
|
||||
void usage(void)
|
||||
{
|
||||
fprintf(stderr, "%s", usagetext);
|
||||
}
|
||||
|
6
c2d.h.0
6
c2d.h.0
@ -13,15 +13,15 @@ typedef struct d {
|
||||
|
||||
const char *usagetext="\n\
|
||||
usage: c2d [-vh?]\n\
|
||||
c2d [-bum] [-r row] [-t filename] [-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\
|
||||
-h|? this help\n\
|
||||
-m jump to monitor 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\
|
||||
The splash screen will display while the binary is loading\n\
|
||||
-u do not patch screen holes\n\
|
||||
-b animated loading bar (experimental)\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\
|
||||
\n\
|
||||
|
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.
7580
gameserverclient.mon
7580
gameserverclient.mon
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
10
holes.h
10
holes.h
@ -1,10 +0,0 @@
|
||||
unsigned char holes[] = {
|
||||
0x37, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||
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
|
||||
};
|
45
makeheader
45
makeheader
@ -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 ..
|
||||
|
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;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
#define MASK 0x7F
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, line;
|
||||
char screen[24][40];
|
||||
|
@ -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
36
test.sh
@ -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=c027f451edcec4bef8a9edb66e15c78e
|
||||
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=c027f451edcec4bef8a9edb66e15c78e
|
||||
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
|
||||
|
@ -1,10 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "holes.h"
|
||||
|
||||
#define NORMAL 0x80
|
||||
#define BLINK 0x40
|
||||
|
||||
int main()
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char c;
|
||||
int i, j, k, line = 0;
|
||||
@ -39,7 +38,7 @@ int main()
|
||||
putchar(screen[i][j]);
|
||||
if (i % 3 == 2)
|
||||
for (k = 0; k < 8; k++)
|
||||
putchar(holes[(i / 3) * 8 + k]);
|
||||
putchar(0x0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user