mirror of
https://github.com/datajerk/c2d.git
synced 2024-06-15 03:29:31 +00:00
added page2text, fixed 40 col bug in text2page
This commit is contained in:
parent
bf8d9d465e
commit
8e2ed42e0d
10
Makefile
10
Makefile
|
@ -1,9 +1,9 @@
|
|||
|
||||
WIN32GCC = /usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin/i586-mingw32-gcc
|
||||
|
||||
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
|
||||
|
||||
|
@ -22,6 +22,12 @@ bin/text2page: text2page.c
|
|||
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
|
||||
(cd asm; make clean)
|
||||
|
|
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.
51
page2text.c
Normal file
51
page2text.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned char c;
|
||||
int i, j, k, count=0, linemap[24];
|
||||
unsigned char screen[24][40];
|
||||
|
||||
// build table
|
||||
for(j=0,i=0;i<8;i++) {
|
||||
linemap[0+3*j]=j;
|
||||
linemap[1+3*j]=j+8;
|
||||
linemap[2+3*j]=j+16;
|
||||
j++;
|
||||
}
|
||||
|
||||
// clear screen
|
||||
for(i=0;i<24;i++)
|
||||
for(j=0;j<40;j++)
|
||||
screen[linemap[i]][j] = ' ';
|
||||
|
||||
for(i=0;i<24;i++) {
|
||||
for(j=0;j<40;j++) {
|
||||
c = getchar();
|
||||
if(++count > 1024) {
|
||||
fprintf(stderr,"input size > 1024\n\n");
|
||||
return 1;
|
||||
}
|
||||
screen[linemap[i]][j] = c & 0x7F;
|
||||
}
|
||||
if((i + 1) % 3 == 0)
|
||||
for(k=0;k<8;k++) {
|
||||
c = getchar();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(count != 1024) {
|
||||
fprintf(stderr,"input size < 1024\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// dump to stdout
|
||||
for(i=0;i<24;i++) {
|
||||
for(j=0;j<40;j++)
|
||||
putchar(screen[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
25
test.sh
25
test.sh
|
@ -2,6 +2,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
PATH=bin:$PATH
|
||||
BIN=gameserverclient
|
||||
ADDR=800
|
||||
SUM=898ebb103fdda6fffe62394c1b915d1d
|
||||
|
@ -10,8 +11,8 @@ rm -f ${BIN}.dsk
|
|||
echo
|
||||
echo "Testing OS/X c2d..."
|
||||
echo
|
||||
echo "bin/c2d ${BIN},${ADDR} ${BIN}.dsk"
|
||||
bin/c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
echo "c2d ${BIN},${ADDR} ${BIN}.dsk"
|
||||
c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||
if [ "$CHECK" = "$SUM" ]
|
||||
then
|
||||
|
@ -43,10 +44,10 @@ rm -f ${BIN}.dsk
|
|||
echo
|
||||
echo "Testing OS/X c2d textpage..."
|
||||
echo
|
||||
echo "bin/text2page <${BIN}.text >${BIN}.textpage"
|
||||
bin/text2page <${BIN}.text >${BIN}.textpage
|
||||
echo "bin/c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||
bin/c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
echo "text2page <${BIN}.text | page2text | text2page >${BIN}.textpage"
|
||||
text2page <${BIN}.text | page2text | text2page >${BIN}.textpage
|
||||
echo "c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||
c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||
if [ "$CHECK" = "$SUM" ]
|
||||
then
|
||||
|
@ -83,8 +84,8 @@ rm -f ${BIN}.dsk
|
|||
echo
|
||||
echo "Testing OS/X c2d..."
|
||||
echo
|
||||
echo "bin/c2d ${MON} ${BIN}.dsk"
|
||||
bin/c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
echo "c2d ${MON} ${BIN}.dsk"
|
||||
c2d ${BIN},${ADDR} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
CHECK=$(md5sum ${BIN}.dsk | awk '{print $1}')
|
||||
if [ "$CHECK" = "$SUM" ]
|
||||
then
|
||||
|
@ -116,10 +117,10 @@ rm -f ${BIN}.dsk
|
|||
echo
|
||||
echo "Testing OS/X c2d textpage..."
|
||||
echo
|
||||
echo "bin/text2page <${BIN}.text >${BIN}.textpage"
|
||||
bin/text2page <${BIN}.text >${BIN}.textpage
|
||||
echo "bin/c2d -t ${BIN}.textpage ${BIN},${ADDR} ${BIN}.dsk"
|
||||
bin/c2d -t ${BIN}.textpage ${MON} ${BIN}.dsk 2>&1 | sed 's/^/ /'
|
||||
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
|
||||
|
|
|
@ -33,15 +33,15 @@ int main()
|
|||
while((c = getchar()) != EOF) {
|
||||
if(c == '\r') // windows trash
|
||||
continue;
|
||||
if(column > 39) // user didn't read the docs
|
||||
continue;
|
||||
if(line > 23) // ditto
|
||||
break;
|
||||
if(c == '\n') { // end of line
|
||||
column=0;
|
||||
line++;
|
||||
continue;
|
||||
}
|
||||
if(column > 39) // user didn't read the docs
|
||||
continue;
|
||||
if(line > 23) // ditto
|
||||
break;
|
||||
|
||||
screen[linemap[line]][column] = c | highbit;
|
||||
column++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user