sblendorio / petscii-bbs

A Java framework for building highly customizable PETSCII-enabled BBS, accessible from Commodore 64/128
Mozilla Public License 2.0
119 stars 16 forks source link

Understanding logo bitmap #19

Open ssshake opened 4 years ago

ssshake commented 4 years ago

A pretty noobish question but you have this logo here. Can you tell me how to construct my own logo. I'm not very familiar with java (not at all really).

This looks like an array of byte, you give it an int value and that is driving what, the pixels?

 public static byte[] LOGO = new byte[] {
        32,  32,  32,  32,  32,  28, -84,  32,  32,  32,  32,  32,  32,  32,  32,  32,
        32,  32,  32,  32,  32,-104, -69,  32,  32,  32,  32,  32,  32,  32,  32,  32,
        32,  32,  32,-101, -69, -84,  32, -84, -84,  13,  18,  28, -95, -65,-110, -84,
        18, -69,-110, -69,  18, -69,-110, -66,  18, -68,-110, -66,  18, -65,-110, -65,
        -104, -84,  18, -94,-110, -95,  18, -65,-110, -66,  18, -65, -69,-110, -84,  18,
        -94,-110, -95,  18, -65, -68, -95, -69,-110, -65,  18, -95,-110,  32, -95,  32,
        32,  32,-101, -68,  18, -65, -95,-110, -69, -84,  18, -95,-110, -66,  13,  18,
        28, -95,-110,  32, -68,  18, -68,-110,  32, -68, -69, -95,  32, -65,  18, -65,
        -110,-104, -68, -94, -95, -65, -69, -65,  18, -66,-110, -68, -94, -95,  18, -69,
        -110, -69,  18, -95, -95, -95,-110, -68, -94, -95,  30, -94, -94,  32,-101, -68,
        18, -65, -95, -65, -95,-110, -68, -69,  13,  32,  32,  32,  32,  32,  32,  32,
        32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,
        32,  32,  32,  32,-104, -94, -66,  13,  18,-102, -95, -84, -69,-110, -69,  13,
        18, -95, -68, -66,-110, -66,  13,  18, -95,-110, -95,  18, -95,-110, -95,  13,
        -68,  18, -94, -94,-110,  13,  18,-103, -95, -84, -69,-110, -69,  13,  18, -95,
        -68, -66,-110, -66,  13,  18, -95,-110, -95,  18, -95,-110, -95,  13, -68,  18,
        -94, -94,-110,  13,-106, -84,  18, -84, -69,-110, -69,  13, -68,  18, -68,-110,
        -94,  13, -84, -69,  18, -95,-110, -95,  13,  32,  18, -94, -94,-110,  13
    };
ssshake commented 4 years ago

I think my question could be a bit better defined.

1) How could I take a .c export from something like https://nurpax.github.io/petmate/ and turn it into this series of signed bytes compatible with the write() method?

2) In tic tac toe there is an example using write() without using a byte array. So which values is that using versus all of the logos in the example files?

sblendorio commented 4 years ago

Hi dudes, here is how I do :)

Using this "lores draw v2" on C64 or on VICE: http://commodore.software/index.php/downloads/download/42-c-g-editors/745-lowres-draw-v2

This program saves a ",SEQ" file that at the end I put on my PC/Mac's filesystem (let's call it "logo"). I do this through "c1541" utility included in VICE:

$ c1541 diskname.d64 -read logo,s

(where ",s" stands for "SEQ" file). Then, on a Unix/Linux, shell, I display the file with this command:

$ cat logo | od -t dC

You will see something similar to this:

0000000   80   75    3    4   20    0    2    0    8    0  -37  123  -19   30  -78   89
0000020  -95  -27   91  -13    1    0    0  -85    2    0   12    0    0    0   66   79
0000040   85   76   68   69   82   80   46   68   54   52  -36  -69  -41   87 -109   93
0000060  -12   45 -100    6 -124   42  -95 -122  106  -24   16   58 -124   32   32   26
0000100  122  -17  -95    3 -122  -34  123  -57    6  -95   55   33  -12   46   45   16
0000120  -86  -12  -82  -46   59   24   58   32   42  -46    4   68   20  -60   -2  -86
0000140  -57  -33   57  -25  -30   -4    1  -33  -43   55  -57  -66  -39  107  -52 -117
0000160   61  -98   53  -58   94  115  -51  103  109   13  117   35  -64   63   48  -13
0000200   -4   31  -64   -2   47   52  -48   40 -124  -90  -98 -123 -127   22   22  -85
0000220 -123   64  104  106   33  -84  -76  116  -80    8   35   53  115  -53  127  116

Adding some fancy stuff, like this:

$ cat logo | od -t dC | sed -E 's/-/ -/g' | sed -E 's/\s+$//g' | sed -E 's/\s+/, /g' | sed -E 's/$/,/' | cut -c9-

you can get this, ready to be copy-pasted into the byte array:

 80, 75, 3, 4, 20, 0, 2, 0, 8, 0, -37, 123, -19, 30, -78, 89,
 -95, -27, 91, -13, 1, 0, 0, -85, 2, 0, 12, 0, 0, 0, 66, 79,
 85, 76, 68, 69, 82, 80, 46, 68, 54, 52, -36, -69, -41, 87, -109, 93,
 -12, 45, -100, 6, -124, 42, -95, -122, 106, -24, 16, 58, -124, 32, 32, 26,
 122, -17, -95, 3, -122, -34, 123, -57, 6, -95, 55, 33, -12, 46, 45, 16,
 -86, -12, -82, -46, 59, 24, 58, 32, 42, -46, 4, 68, 20, -60, -2, -86,
 -57, -33, 57, -25, -30, -4, 1, -33, -43, 55, -57, -66, -39, 107, -52, -117,
 61, -98, 53, -58, 94, 115, -51, 103, 109, 13, 117, 35, -64, 63, 48, -13,
 -4, 31, -64, -2, 47, 52, -48, 40, -124, -90, -98, -123, -127, 22, 22, -85,
 -123, 64, 104, 106, 33, -84, -76, 116, -80, 8, 35, 53, 115, -53, 127, 116,

...and so...

 write(new byte[] {80, 75, 3, 4, 20, 0, 2, 0, 8, 0, -37, 123, -19, 30, -78, 89,
 -95, -27, 91, -13, 1, 0, 0, -85, 2, 0, 12, 0, 0, 0, 66, 79,
 85, 76, 68, 69, 82, 80, 46, 68, 54, 52, -36, -69, -41, 87, -109, 93,
 -12, 45, -100, 6, -124, 42, -95, -122, 106, -24, 16, 58, -124, 32, 32, 26,
 122, -17, -95, 3, -122, -34, 123, -57, 6, -95, 55, 33, -12, 46, 45, 16,
 -86, -12, -82, -46, 59, 24, 58, 32, 42, -46, 4, 68, 20, -60, -2, -86,
 -57, -33, 57, -25, -30, -4, 1, -33, -43, 55, -57, -66, -39, 107, -52, -117,
 61, -98, 53, -58, 94, 115, -51, 103, 109, 13, 117, 35, -64, 63, 48, -13,
 -4, 31, -64, -2, 47, 52, -48, 40, -124, -90, -98, -123, -127, 22, 22, -85,
 -123, 64, 104, 106, 33, -84, -76, 116, -80, 8, 35, 53, 115, -53, 127, 116});
sblendorio commented 4 years ago

I'm looking at PETMATE you linked, it should work in place of lores_draw! PLEASE EXPORT IN SEQ FORMAT on petmate

sblendorio commented 4 years ago

Difference between:

write(12, 34, 54, ...)

and

write(new byte[] {12, 34, 54, ...})

The first form accepts numbers from 0 to 255, the second form accepts number from -128 to 127, it's just a different representation of a byte, unsigned or signed.

ssshake commented 4 years ago

Hey @sblendorio that's awesome. Thanks for the information. That might be a good candidate for a wiki page?

I really like this project. Great features out of the box.

sblendorio commented 4 years ago

You can also load a file from disk and "raw write" it like PetsciiGallery tenant does. Look at writeRawFile function in PetsciiThread class.

Please tell us if you create some BBS with this framework, it should be very interesting!

ssshake commented 4 years ago

theoldnet.com:6400. Right now it's just a blatant rip off of what you did but I've brought in some of my own wordpress sources (awesome that you support this).

Since what you made supports simultaneous connections I think I could do a sudo-realtime chat system.

I made a project for old vintage computers called theoldnet.com which lets you browse archived websites on old browsers. I think I might use the api I already created for that, and offer up some generic text-based web browsing through what you've created.

sblendorio commented 4 years ago

Just saw your BBS. Awesome :)

I suggest to add a "13" (alias 0D alias CR alias Carriage Return) byte in your LOGOs, in order to add a newline

ssshake commented 4 years ago

thanks!

ssshake commented 4 years ago

Do you have any idea why when using petmate and then the Bash 1 liner you provided some of my characters show up 'weird'. Observe what I designed on the right to what gets output in syncterm on the left

image

This is my logo after running it through your parser

    public final static byte[] LOGO = new byte[] {
        -102, 18, -87, 32, 32, 32, -110, 32, 32, 32, 5, 18, 32, 32, -110, 32,
        32, 18, 32, 32, -102, -110, 32, 32, 32, 5, 18, 32, 32, -102, -110, 32,
        5, 32, 32, 32, 32, -102, 32, 5, 32, 32, 32, 32, 32, 32, 32, 32,
        32, 32, 32, 32, -102, 32, 32, 32, 32, 18, 32, -110, -87, 32, 32, 18,
        32, -110, -87, 32, 5, 18, 32, -110, 32, 18, 32, -110, 32, 18, 32, -110,
        32, 18, 32, -102, -110, 32, 5, 18, 32, -102, -110, 32, 32, 32, 5, 67,
        66, 66, 83, 79, 85, 84, 80, 79, 83, 84, 46, -102, 32, 32, 32, 32,
        32, 32, 32, 32, 32, 18, 32, -110, 32, 32, 32, 32, 32, 32, 5, 18,
        32, 32, -110, 32, 32, 18, 32, 32, -102, -110, 32, 32, 32, 5, 18, 32,
        -102, -110, 32, 32, 5, 83, 69, 82, 86, 69, 66, 66, 83, 46, 32, 32,
        32, 32, -102, 32, 32, 32, 32, 32, 32, 32, 32, 18, 32, -33, -110, 32,
        32, 28, 18, 32, -33, -102, -110, 32, 5, 18, 32, -102, -110, 32, 5, 18,
        32, -110, 32, 18, 32, -102, -110, 32, 5, 18, 32, -102, -110, 32, 32, 32,
        5, 18, 32, -102, -110, 32, 5, 67, 79, 77, 32, -102, 32, 5, 32, -102,
        32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -33,
        18, 32, 32, 32, -110, 32, 32, 32, 5, 18, 32, 32, -110, 32, 32, 18,
        32, 32, -102, -110, 32, 32, 5, 18, 32, 32, -102, -110, 32, 32, 5, 32,
        32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
        32, 32, 32, 32, 32, 32, 32, -102, 32, 32, 32, 32, 32, 32, 32, 32,
        32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 5, 32, 32, -102,
        32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,

        32, 32, 32, 32, 32, 32, 32,

        13
    };
sblendorio commented 4 years ago

The reason for "weird" chars is that the screen is in "lowercase/uppercase" mode (CHR$(14)) instead of "uppercase/graphics" mode (CHR$(142)). In this charset (lowercase/uppercase) the "diagonal characters" are rendered differently.

Try running it on C64

fori=0to255:poke1024+i,i:next

and then switch charset with SHIFT + C= keys, and look at those characters