• I’m confused. After writing an entry in the Journal app I can’t do anything with it. Am I supposed to read it back later, only in the app? That seems rather pointless.

  • Currently reading: Mapping the Commodore 64 by Sheldon Leemon 📚

    Why would you even want to use the C64, it’s an old computer? It isn’t old, it’s retro!

    book cover of Mapping the Commodore 64 by Sheldon Leemon
  • I got a taste of what it is to write a computer program on the C64 (see here and here). For now, that is enough for me, and I’ll refrain from doing any more for the Advent of Code. It’s just too hardcore for me! I need something less intimidating.

  • Advent of Code 2023, day 1, part one—Hunting down the bug

    This is a continuation of this article I wrote earlier today.

    There was a bug in my Basic program when calculating the value of the two-digit number:

    140 p=f+10*l:sm=sm+p:print n,p,sm

    That should of course be:

    140 p=f*10+l:sm=sm+p:print n,p,sm

    After rewriting the code I got this answer:

    999 : 33 , 53194

    So adding 999 two-digit numbers gave me 53194. Would that be the correct answer?

    Yes!

    What have I learned?

    Always use simple examples to test your algorithm.

  • Advent of Code 2023, day 1, part one—Basic language approach

    Day 1 of the Advent of Code consisted of two parts. You had to finish part one before you could advance to part two, plus you had to log in using OAuth (with a Google, Twitter, or Reddit account).

    In part one there was a list of character strings, which I separated by commas (to avoid character return issues between platforms), and for which the first and last digit in each character string formed a two-digit number. All the two-digit numbers had to be added up into a total sum, which was the solution to part one.

    As a first attempt, I compiled the list as follows:

    *= $2000

    .byte "…"
    .byte 0

    where the stands for the list of comma separated items.

    I compiled the source code file to a .PRG file, using Virtual 6502 Assembler, and loaded the resulting file into the V.I.C.E. emulator on my Raspberry Pi 400, running Raspberry Pi OS. This took a couple of minutes, since it was a large file (21 Kb) for such a small retro computer.

    Next, I lowered the end of Basic memory, and wrote the following CBM Basic 2.0 program:

    poke 56,32:new: rem lower end of basic memory to $2000

    10 ad=8192:rem decimal of $2000
    20 sm=0:n=0:rem total sum of 2-digit values, number of items
    30 f=-1:l=-1:p=0:rem first, last digit, 2-digit value
    40 c=peek(ad)
    50 if c=0 then end:rem zero value signals end of file
    60 if c=asc(",") then 120:rem comma separated list
    70 if c<asc("0") or c>asc("9") then 110:skip for non-digits
    80 v=c-asc("0")
    90 if f<0 then f=v:rem -1 signals no digit found
    100 l=v
    110 ad=ad+1:goto 40:rem do next character
    120 n=n+1:rem count number of items
    130 if f<0 then 150:rem skip non-digits
    140 p=f+10*l:sm=sm+p:print n,p,sm
    150 ad=ad+1:goto 30:rem do next item

    Running in Warp mode took a few minutes, and the resulting last line was:

    999 66 54727

    ready.

    Apparently, there were 999 items, where the sum of the two-digit numbers was 54727. I checked my code, and reran the Basic program, same result (of course).

    Anxiously, I entered the result into the answer box on the website. It turned out my answer was wrong. It was too high.

    Ah well, this was to be expected. Now I have to reread the instructions to see if I perhaps misunderstood, then debug and find a better solution. Maybe I need to start smaller, instead of using the entire list.

    I think it was a valiant first attempt. Coding is hard, after all.

  • So I wrote some Commodore 64 assembly code in Textastic on iPad, assembled in an online 6502 assembler, into a .PRG file, and loaded that into the V.I.C.E. C64 emulator. You can see the ML monitor output and the output of the program. Note that clearing the screen isn’t needed, simply:

    SYS 49176
    
    random maze machine code monitor in V.I.C.E. random maze output in V.I.C.E.
  • The difference between how I think the world is, and how it appears to me couldn’t be further apart. I suppose this applies to most people. It is hope (or belief) that makes us see a better world. Too bad so few (including myself) act on that belief/hope in any substantial way to cross the gap.

    stylized blue cat on Christmassy background
  • It is said that Practice makes perfect, but I think it should be Passionate practice makes improvement. Being dispassionate and detached from the world is a good defense mechanism against a cruel world, but it does squat for making art. Hence, artists must suffer, from mostly indifference.

    blue tabby kitten on a Christmassy background
  • It amazes me how much can be done in one sitting, and yet how little it seems compared to what one can do in multiple sittings. However, much of the spontaneity is lost over the sittings.

    sketch of kitten on Christmassy card in blueprint
    After drawing a new background, all I had left in me was a simple monochrome sketch from reference.
  • AI is made of people…

    Letters A and I stylized into a antropomorphic cat, with red skulls as a filling
    Funnily enough, this drawing was scaled using AI.
  • I sometimes wonder why the world is the way it is. Then I realize it’s hard to change what has been developing over billions of years. The most one can do is tweak some things. Free will is an illusion, to keep humans sane and seemingly in control.

    tabby and white cat sitting on wall
    Sometimes cats find you, instead of you them.
  • My code is almost twice as fast as the original Print Maze routine,

    10 printchr$(205.5+rnd(1));:goto 10
    
    0 d=205.5:fori=.to39:printchr$(d+rnd(.));:next:goto
    
    screenshot of Commodore 64 Basic code for a random maze
  • It turned out I was over-exhausted from all the running lately. After a restday it was much easier to draw.

    colored drawing of a calico cat looking up
    I once adopted a calico cat as a kitten from a nearby cat colony. She had a wonderful life indoors.
  • Having paid for a year subscription for ibis Paint X didn’t make me want to draw more. After the free month was up, I struggled to draw daily. Maybe it’s the shortening of days making me gloomy.

    drawing of lying cat surrounded by Christmassy garland
    I suppose this is considered rather cute, isn't it?
  • I found a proper and informal method to add a description to an image,

    1. figcaption
    2. emphasis after a line break
    two cats play-fighting on a bed
    One play-fights, the other often takes it too far.

    two cats lying on a bed, one resting its head on the body of the other
    However, they still trust each other to snuggle up.

    Alas, markdown has no code for captions, _nor_ does it work inside an html container.

  • Drawing without reference can take you only so far. I guess I use it from now on, yet without wholesale copying.

    AI super resolution of a cat sticking its tongue out
  • Oh my! Is it December already? How time flies when you’re being lazy.

    AI super resolution version of stylized kitten sleeping, surrounded by a garland
  • I’m amazed how adaptable the human body is, now I’m dealing with yet another injury. The cause of those injuries is mostly overweight and over-ambition. If I had a coach experienced with older runners, he’d probably told me to act more responsibly and put myself on a diet.

  • It suddenly appeared to me while watching Adventure Time on Netflix (S01E18, “Dungeon”), where Demon Cat has “approximate knowledge of many things.” It’s how I would describe chatGPT.

  • Someone dug a trench across a footpath, and I stepped right into it, hurting my ankle badly. Who does such a thing, making a trap for pedestrians? The ankle is swollen and hurts, but not enough to go to a doctor. I suppose R.I.C.E. will reduce the swelling, as in Rest, Ice, Compression, Elevation.