Skip to content

Commit

Permalink
completely removed all hacks for scratchpad ram, loader and bar asm o…
Browse files Browse the repository at this point in the history
…nly write to text RAM, no scratchpad ram.
  • Loading branch information
datajerk committed May 3, 2017
1 parent a191c5c commit 249e6c2
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 84 deletions.
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ dist: all windows
c2d.h: c2d.h.0 asm/loader.s asm/bar.s makeheader
./makeheader

bin/c2d: c2d.c c2d.h holes.h
bin/c2d: c2d.c c2d.h
gcc -Wall -Wno-missing-braces -I. -O3 -o $@ $< -lm

bin/c2d.exe: c2d.c c2d.h holes.h
bin/c2d.exe: c2d.c c2d.h
$(WIN32GCC) -Wall -Wno-missing-braces -I. -O3 -o $@ $<

bin/text2page: text2page.c holes.h
bin/text2page: text2page.c
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
Expand All @@ -28,6 +28,9 @@ bin/page2text: page2text.c
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
(cd asm; make clean)
Expand Down Expand Up @@ -61,15 +64,26 @@ barloader.text: Makefile
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

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

28 changes: 24 additions & 4 deletions asm/bar.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,12 +37,32 @@ barptr = $06 ; bar pointer

grcheck:
lda *+(gr-loader)+(moved-grcheck)
beq text
beq movetext
lda #0 ; GR mode
sta $C050
sta $C053
text:

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
Expand Down
1 change: 0 additions & 1 deletion asm/loader.s
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ rwts = $B7B5 ; rwts jsr
; vars

stage1 = $C00
;stage2 = $B600 ; overwrite track 0/sector 0, not needed any more?
stage2 = $300 ; $300 looks open
;;;run time
trkcnt = $00 ; track counter
Expand Down
Binary file modified barloader.textpage
Binary file not shown.
Binary file modified bin/c2d
Binary file not shown.
Binary file modified bin/c2d.exe
Binary file not shown.
Binary file modified bin/page2text.exe
Binary file not shown.
Binary file modified bin/text2page
Binary file not shown.
Binary file modified bin/text2page.exe
Binary file not shown.
26 changes: 2 additions & 24 deletions c2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Based on work by:
#include <math.h>
#include <sys/stat.h>
#include "c2d.h"
#include "holes.h"

#define VERSION "Version 0.57"
#define INFILE argv[argc-2]
Expand All @@ -56,15 +55,15 @@ 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 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, "gr: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;
Expand All @@ -86,9 +85,6 @@ int main(int argc, char **argv)
if (row > 23)
row = 23;
break;
case 'u':
unpatch = 1;
break;
case 'b':
bar = 1;
break;
Expand Down Expand Up @@ -229,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) {
Expand Down Expand Up @@ -302,10 +284,6 @@ int main(int argc, char **argv)
blank.track[1].sector[4].byte[loadersize + 8 + i] = i * num_sectors / bar_length;
}

// this version loads text page right into place, however can cause
// issues with scratchpad RAM
// loaderstart = 0x400;
// load here and move to 0x400 just the text data
loaderstart = 0x800;

// temp hack to effect the sound of the drive, i.e. to make consistent
Expand Down
84 changes: 55 additions & 29 deletions c2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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\
-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\
Expand Down Expand Up @@ -9032,7 +9032,6 @@ rwts = $B7B5 ; rwts jsr
; vars

stage1 = $C00
;stage2 = $B600 ; overwrite track 0/sector 0, not needed any more?
stage2 = $300 ; $300 looks open
;;;run time
trkcnt = $00 ; track counter
Expand Down Expand Up @@ -9221,7 +9220,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
Expand All @@ -9237,12 +9236,32 @@ barptr = $06 ; bar pointer

grcheck:
lda *+(gr-loader)+(moved-grcheck)
beq text
beq movetext
lda #0 ; GR mode
sta $C050
sta $C053
text:

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
Expand Down Expand Up @@ -9386,26 +9405,33 @@ barptr = $06 ; bar pointer
end:
*/
unsigned char barcode[] = {
0xAD,0xB0,0x08,0xF0,0x08,0xA9,0x00,0x8D,
0x50,0xC0,0x8D,0x53,0xC0,0xA9,0x00,0x85,
0x05,0x85,0x06,0xA9,0x01,0xA0,0x0C,0x99,
0xE8,0xB7,0xA9,0x00,0xA0,0x08,0x99,0xE8,
0xB7,0xA9,0x02,0x85,0x04,0xA2,0x00,0xBD,
0x35,0x08,0x9D,0x00,0x03,0xE8,0xE0,0xD0,
0xD0,0xF5,0x4C,0x00,0x03,0xAD,0x78,0x03,
0x85,0x02,0xAE,0x76,0x03,0xCA,0xCA,0x86,
0x00,0xA5,0x04,0xA0,0x04,0x99,0xE8,0xB7,
0xA5,0x00,0xD0,0x05,0xAD,0x77,0x03,0x10,
0x02,0xA9,0x0F,0x85,0x03,0xA5,0x03,0xA0,
0x05,0x99,0xE8,0xB7,0xA5,0x02,0x18,0x65,
0x03,0xA0,0x09,0x99,0xE8,0xB7,0xA0,0xE8,
0xA9,0xB7,0x20,0xB5,0xB7,0xB0,0x39,0xA9,
0x00,0x85,0x48,0xE6,0x05,0xA6,0x06,0xBD,
0x7F,0x03,0xC5,0x05,0xD0,0x16,0xA5,0x06,
0x18,0x6D,0x7D,0x03,0x8D,0x5B,0x03,0xAD,
0x7E,0x03,0x8D,0x5C,0x03,0xA9,0x20,0x8D,
0x00,0x04,0xE6,0x06,0xC6,0x03,0x10,0xBD,
0xA5,0x02,0x18,0x69,0x10,0x85,0x02,0xE6,
0x04,0xC6,0x00,0x10,0x9C,0x6C,0x79,0x03,
0x4C,0x69,0xFF
0xAD,0xE7,0x0C,0xF0,0x08,0xA9,0x00,0x8D,
0x50,0xC0,0x8D,0x53,0xC0,0xA2,0x00,0xBD,
0x00,0x08,0x9D,0x00,0x04,0xBD,0x80,0x08,
0x9D,0x80,0x04,0xBD,0x00,0x09,0x9D,0x00,
0x05,0xBD,0x80,0x09,0x9D,0x80,0x05,0xBD,
0x00,0x0A,0x9D,0x00,0x06,0xBD,0x80,0x0A,
0x9D,0x80,0x06,0xBD,0x00,0x0B,0x9D,0x00,
0x07,0xBD,0x80,0x0B,0x9D,0x80,0x07,0xE8,
0xE0,0x78,0xD0,0xCB,0xA9,0x00,0x85,0x05,
0x85,0x06,0xA9,0x01,0xA0,0x0C,0x99,0xE8,
0xB7,0xA9,0x00,0xA0,0x08,0x99,0xE8,0xB7,
0xA9,0x02,0x85,0x04,0xA2,0x00,0xBD,0x6C,
0x0C,0x9D,0x00,0x03,0xE8,0xE0,0xD0,0xD0,
0xF5,0x4C,0x00,0x03,0xAD,0x78,0x03,0x85,
0x02,0xAE,0x76,0x03,0xCA,0xCA,0x86,0x00,
0xA5,0x04,0xA0,0x04,0x99,0xE8,0xB7,0xA5,
0x00,0xD0,0x05,0xAD,0x77,0x03,0x10,0x02,
0xA9,0x0F,0x85,0x03,0xA5,0x03,0xA0,0x05,
0x99,0xE8,0xB7,0xA5,0x02,0x18,0x65,0x03,
0xA0,0x09,0x99,0xE8,0xB7,0xA0,0xE8,0xA9,
0xB7,0x20,0xB5,0xB7,0xB0,0x39,0xA9,0x00,
0x85,0x48,0xE6,0x05,0xA6,0x06,0xBD,0x7F,
0x03,0xC5,0x05,0xD0,0x16,0xA5,0x06,0x18,
0x6D,0x7D,0x03,0x8D,0x5B,0x03,0xAD,0x7E,
0x03,0x8D,0x5C,0x03,0xA9,0x20,0x8D,0x00,
0x04,0xE6,0x06,0xC6,0x03,0x10,0xBD,0xA5,
0x02,0x18,0x69,0x10,0x85,0x02,0xE6,0x04,
0xC6,0x00,0x10,0x9C,0x6C,0x79,0x03,0x4C,
0x69,0xFF
};
4 changes: 2 additions & 2 deletions c2d.h.0
Original file line number Diff line number Diff line change
Expand Up @@ -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\
-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\
Expand Down
Binary file modified gameserverclient.textpage
Binary file not shown.
10 changes: 0 additions & 10 deletions holes.h

This file was deleted.

3 changes: 1 addition & 2 deletions mandelbrotgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <strings.h>
#include "holes.h"

#define MAX 15
#define NORMAL 0x80
Expand Down Expand Up @@ -88,7 +87,7 @@ int main(int argc, char **argv)
putchar(screen[i][j]);
if (i % 3 == 2)
for (k = 0; k < 8; k++)
putchar(holes[(i / 3) * 8 + k]);
putchar(0x0);
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ then
fi
fi

SUM=7d509bcef9a53c89839a0622514955fd
SUM=df792a2715bb9f7b91aed94e19e5f46c

rm -f ${BIN}.dsk
echo
Expand Down Expand Up @@ -158,7 +158,7 @@ rm -f ${BIN}.dsk
fi
fi

SUM=7d509bcef9a53c89839a0622514955fd
SUM=df792a2715bb9f7b91aed94e19e5f46c

rm -f ${BIN}.dsk
echo
Expand Down
3 changes: 1 addition & 2 deletions text2page.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdio.h>
#include "holes.h"

#define NORMAL 0x80
#define BLINK 0x40
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 249e6c2

Please sign in to comment.