« Back“PET-Globe” Demomasswerk.atSubmitted by masswerk 6 days ago
  • rezmason 3 days ago

    96x32 pixels? A kindred spirit!

    I'm using WebGL to emulate a unique Casio LCD that hue-shifts pixels into the right color, and its display is 95x32 and typically its bit depth is two. (The hardware is 96x32, I'm honestly not sure where the last column went)

    https://rezmason.github.io/birefringence-lcd (Epilepsy Warning! WIP; arrow keys to change screen image)

    Before long I'll want to display more interesting things on it; OP, can I try to credit your project and port it to JavaScript for my LCD emulator?

  • musicale 3 days ago

    > there is no way we could do this in BASIC

    If you had enough memory, a PRINT statement for each frame delta might work.

    Looking at the user/BASIC manual, it looks like strings can contain screen positioning characters as well as visible characters.

    • masswerk 3 days ago

      BASIC is about 1000 times slower, so there's no way we could do this in realtime. Moreover, as mentioned in the article, the original PET 2001 suffers from bus conflicts when the CPU and the video circuitry access the video memory at the same time, because of slow SRAM, which is just the same speed as the CPU. To avoid this, the BASIC used by these earlier models prints only during the vertical blanking interval (V-BLANK), when video is off. This is only about a quarter of the duty cycle, where PRINT can actually happen, slowing this down to a fraction of what BASIC could theoretically achieve.

      Let's do some nerdy numbers: ;-)

      We may try rendering this to static slides and store them as strings in DATA statements. At 16 cols and 16 rows, this is 256 bytes per frame and there are 100 of them (the current map width), which makes 25 KB. We'll also need memory for the overhead of this as BASIC lines, which is 2 bytes for the line number in binary, another two bytes for the link to the location of the next line in memory (a 16-bit pointer), 1 for the "DATA" token, and a zero-byte as the line delimiter (EOL), which makes 6 bytes per BASIC line. And we'll need another two bytes for the enclosing quotes per string, and one for a separating comma (if we put more then one string in a given line).

      Assuming we store 3 strings in a line (of max 80 characters), this makes a total of 533.3 × (6 + 3 × 18 + 2) = 33,064 bytes (or 32.29 KB), the memory requirement to store just the DATA lines. – So there's no way to fit this into a machine, which maxes out at 32K in its most luxurious memory configuration (or 16K for the original PET 2001).

      • musicale 2 days ago

        Wow I didn't expect an author response!! Nice article, and it helps fulfill the weekly quota for 6502 articles on HN.

        Well, I've never tried programming a PET before, but here is my cheap BASIC imitation which I tried in a web emulator:

            10 PRINT CHR$(147):A$=CHR$(19)
            20 B$="    ****    "
            30 C$="  **    **  "
            40 D$(0)=" ***     ** "
            50 D$(1)=" ** *    **"
            60 D$(2)=" **  *   **"
            70 D$(3)=" **   *  **"
            80 D$(4)=" **    * **"
            90 D$(5)=" **     ***"
            100 A=0
            110 FOR I=1 to 10000
            120 PRINT A$:PRINT B$:PRINT C$:PRINT D$(A)
            130 PRINT C$:PRINT B$
            140 A=A+1:IF A>5 THEN A=0
            150 NEXT I
        
        In the emulator it seems to get around 10FPS with an 11x5 character matrix, but it may be possible to do better.
      • undefined 2 days ago
        [deleted]
    • memalign 3 days ago