mirror of
https://github.com/datajerk/gameserverclient.git
synced 2025-01-13 12:31:35 +00:00
added missing files to build assembly tables.
This commit is contained in:
parent
4f1fb71db7
commit
87d8c3cb88
41
Makefile
Normal file
41
Makefile
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
CL = cl65
|
||||
CL_FLAGS = -t none --listing --list-bytes 100
|
||||
C2D = c2d
|
||||
CC = gcc
|
||||
CC_FLAGS = -Wall -O3 -I/opt/local/include -L/opt/local/lib -lqrencode -lm
|
||||
|
||||
all: gameserverclient.dsk
|
||||
|
||||
qrbytes: qrbytes.c
|
||||
$(CC) $(CC_FLAGS) -o $@ $<
|
||||
|
||||
qrcodes.inc: qrcodes.pl qrbytes
|
||||
curl -sL http://asciiexpress.net/gameserver/links.html | \
|
||||
sort | \
|
||||
./qrcodes.pl >$@
|
||||
|
||||
titles.inc: titles.pl
|
||||
curl -sL http://asciiexpress.net/gameserver/links.html | \
|
||||
sort | \
|
||||
./titles.pl >$@
|
||||
|
||||
gameserverclient: gameserverclient.s titles.inc qrcodes.inc
|
||||
$(CL) $(CL_FLAGS) $<
|
||||
|
||||
clean:
|
||||
rm -f qrbytes *.o *.lst *.dsk *.inc *.textpage gameserverclient
|
||||
|
||||
gameserverclient.textpage: Makefile
|
||||
( \
|
||||
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 | text2page >$@
|
||||
|
||||
gameserverclient.dsk: gameserverclient.textpage gameserverclient
|
||||
$(C2D) -t gameserverclient.textpage gameserverclient,800 $@
|
||||
|
22
README.md
22
README.md
@ -20,27 +20,11 @@ Download <https://github.com/datajerk/gameserverclient/archive/master.zip> and e
|
||||
|
||||
- `cl65` (<http://cc65.github.io/cc65/>)
|
||||
- `c2d` (<https://github.com/datajerk/c2d>)
|
||||
- `libqrencode` (<https://github.com/fukuchi/libqrencode>)
|
||||
|
||||
|
||||
#### Compile
|
||||
#### Build
|
||||
```
|
||||
cl65 -t none --listing --list-bytes 100 gameserverclient.s
|
||||
```
|
||||
|
||||
#### Create Diskette Image
|
||||
```
|
||||
c2d gameserverclient,800 gameserverclient.dsk
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```
|
||||
Reading gameserverclient, type BINARY, start: $0800, length: 32664
|
||||
|
||||
Number of sectors: 128
|
||||
Sector page range: $08 - $87
|
||||
After boot, jump to: $0800
|
||||
|
||||
Writing gameserverclient to T:01/S:00 - T:08/S:15 on gameserverclient.dsk
|
||||
make
|
||||
```
|
||||
|
||||
|
Binary file not shown.
2365
gameserverclient.s
2365
gameserverclient.s
File diff suppressed because it is too large
Load Diff
83
qrbytes.c
Normal file
83
qrbytes.c
Normal file
@ -0,0 +1,83 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <qrencode.h>
|
||||
|
||||
static int casesensitive = 1;
|
||||
static int version = 0;
|
||||
static QRecLevel level = QR_ECLEVEL_L;
|
||||
static QRencodeMode hint = QR_MODE_8;
|
||||
|
||||
#define MAX_DATA_SIZE (7090 * 16) /* from the specification */
|
||||
|
||||
static int writetext(QRcode *qrcode)
|
||||
{
|
||||
unsigned char *p, bytes[1000];
|
||||
int x, y, bit = 0, count=0;
|
||||
|
||||
printf("width: %d\n",qrcode->width);
|
||||
|
||||
p = qrcode->data;
|
||||
for(y=0; y<qrcode->width; y++) {
|
||||
for(x=0; x<qrcode->width; x++) {
|
||||
if(bit == 0) {
|
||||
bytes[count++] = 0;
|
||||
bit = 8;
|
||||
}
|
||||
|
||||
bytes[count-1] *= 2;
|
||||
bytes[count-1] += (*p & 1);
|
||||
bit--;
|
||||
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
for(x=0;x<bit;x++) {
|
||||
bytes[count-1] *= 2;
|
||||
}
|
||||
|
||||
printf("bytes: ");
|
||||
for(x=0;x<count;x++) {
|
||||
printf("0x%02X ",bytes[x]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static QRcode *encode(const unsigned char *intext, int length)
|
||||
{
|
||||
QRcode *code;
|
||||
|
||||
code = QRcode_encodeString((char *)intext, version, level, hint, casesensitive);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
static void qrencode(const unsigned char *intext, int length)
|
||||
{
|
||||
QRcode *qrcode;
|
||||
|
||||
qrcode = encode(intext, length);
|
||||
if(qrcode == NULL) {
|
||||
perror("Failed to encode the input data");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
writetext(qrcode);
|
||||
QRcode_free(qrcode);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned char *intext = NULL;
|
||||
int length = 0;
|
||||
|
||||
intext = (unsigned char *)argv[optind];
|
||||
length = strlen((char *)intext);
|
||||
|
||||
qrencode(intext, length);
|
||||
|
||||
return 0;
|
||||
}
|
94
qrcodes.pl
Executable file
94
qrcodes.pl
Executable file
@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env perl -w
|
||||
|
||||
#use strict;
|
||||
|
||||
my @titles = ();
|
||||
my $max = 0;
|
||||
my $s = 0;
|
||||
|
||||
while(<>)
|
||||
{
|
||||
my @a = split(/\"/);
|
||||
my $short = $a[5];
|
||||
my $qr;
|
||||
|
||||
$short =~ s/.html//;
|
||||
$short .= ".qr.wav";
|
||||
$short = "http://asciiexpress.net/gameserver/$short";
|
||||
|
||||
$qr = `./qrbytes "$short"`;
|
||||
|
||||
my $width = $qr;
|
||||
my $bytes = $qr;
|
||||
|
||||
$width =~ s/\n//g;
|
||||
$width =~ s/^width: (\d+).*/$1/;
|
||||
|
||||
$bytes =~ s/\n//g;
|
||||
$bytes =~ s/.*bytes: (.*)/$1/;
|
||||
$bytes =~ s/0x/\$/g;
|
||||
$bytes =~ s/ /,/g;
|
||||
$bytes =~ s/,$//;
|
||||
|
||||
$s++;
|
||||
|
||||
printf("qr%03d:\t.byte\t",$s);
|
||||
print "$width\n";
|
||||
|
||||
my $i = 0;
|
||||
|
||||
foreach(split(/,/,$bytes)) {
|
||||
$i++;
|
||||
if(($i-1) % 16 == 0) {
|
||||
print " .byte ";
|
||||
}
|
||||
print "$_";
|
||||
if($i % 16 == 0) {
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
if($i != split(/,/,$bytes)) {
|
||||
print ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print "qrptrl:";
|
||||
|
||||
for(my $i=1;$i<=128;$i++) {
|
||||
if(($i-1) % 8 == 0) {
|
||||
print " .word ";
|
||||
}
|
||||
printf("qr%03d",$i);
|
||||
if($i % 8 == 0) {
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
if($i != $s) {
|
||||
print ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
||||
print "qrptrh:";
|
||||
|
||||
for(my $i=129;$i<=$s;$i++) {
|
||||
if(($i-1) % 8 == 0) {
|
||||
print " .word ";
|
||||
}
|
||||
printf("qr%03d",$i);
|
||||
if($i % 8 == 0) {
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
if($i != $s) {
|
||||
print ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
33
titles.pl
Executable file
33
titles.pl
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
my @titles = ();
|
||||
my $max = 0;
|
||||
my $s = 1;
|
||||
|
||||
#open(LINKS,"links.sort.html") || die;
|
||||
|
||||
print "first:\n";
|
||||
|
||||
while(<>)
|
||||
{
|
||||
my @a = split(/\"/);
|
||||
|
||||
push @titles,$a[3];
|
||||
|
||||
if(length($a[3]) > $max) {
|
||||
$max = length($a[3]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(@titles) {
|
||||
if(\$_ == \$titles[-1]) {
|
||||
print "last:\n";
|
||||
}
|
||||
printf("s%03d:\t.asciiz\t\"%-${max}s\"\n",$s++,$_);
|
||||
}
|
||||
|
||||
#close(LINKS);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user