Recent Updates Page 2 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 9:45 am on March 29, 2018 Permalink | Reply
    Tags: ,   

    Categories: Commodore, Screencast ( 38 )

    How to build a Word Splitter on the C64 in Commodore BASIC 

    In this video I’m demonstrating how to build a word splitter on the Commodore 64. We’ll use string functions to parse a sentence and split each word off into an array of words so that they can be analysed later (for example, as part of an adventure game).

    Here’s the code I’m building:

    20 input a$
    30 gosub 100
    40 print:print wd;" words:"
    50 for i=1 to wd
    60 print wd$(i)
    70 next
    99 end
    100 rem word splitter
    110 lt$="":wd=1
    120 for i=1 to len(a$)
    130 lt$=mid$(a$,i,1)
    140 if lt$=" " then wd=wd+1:next
    150 wd$(wd)=wd$(wd)+lt$
    160 next
    199 return

    The interesting part starts in line 100 and onwards, where I’m building a subroutine that deals with the string functions. In line 110 I’m resetting/initialising two of the three important variables: LT$ holds a single letter from the phrase we’re getting in A$, while WD is counting each word we’re splitting out.

    The FOR loop in line 120 parses each letter of the phrase, and if it finds a space character (line 140), the word count is increased. If the letter is not a space, then it’s added to the current word held in WD$(WD). The current word is assembled character by character.

    Apologies for the audio quality, I did this on my laptop while sitting on the balcony, hence sea planes flying overhead can be heard (as well as the neighbours dog and kids).

    Happy hacking ๐Ÿ™‚

     
  • Jay Versluis 9:58 am on March 28, 2018 Permalink | Reply
    Tags: ,   

    Categories: Commodore, Screencast ( 38 )

    How to build a time of day clock on the Commodore 64 

    In this video I’ll demonstrate how to build a simple clock on the C64. We’ll go through this process step by step, including the built-in TI and TI$ variables, string formatting with LEFT$, RIGHT$ and MID$, as well as screen formatting.

    Here’s the code I’m writing – works in Commodore BASIC v2 and above:

    5 input "qwhat is the current time (hhmm
    ss) ";ti$
    10 print chr$(147):print chr$(5)
    20 a$ = left$(ti$,2)
    25 a$ = a$ +":"
    30 a$ = a$ + mid$(ti$,3,2)
    35 a$ = a$ +":"
    40 a$ = a$ +right$(ti$,2)
    50 gosub 200
    60 print chr$(19)
    70 print "qqqqqqqqqqq]]]]]]]]]]]]]]curre
    nt time"
    80 print "]]]]]]]]]]]]]]]]";
    90 print a$
    100 goto 20
    200 rem print a box
    210 print chr$(19)
    220 print "qqqqqqqqqq]]]]]]]]]]]]]UCCCCC
    CCCCCCCI"
    230 print "]]]]]]]]]]]]]B]]]]]]]]]]]]B"
    240 print "]]]]]]]]]]]]]B]]]]]]]]]]]]B"
    250 print "]]]]]]]]]]]]]JCCCCCCCCCCCCK"
    299 return

    Many of the characters that appear in this listing are cursor control characters and appear in reverse in the video. They either position the cursor or print PETSCII graphics.

    Inspired by David’s video, in which he connects an LCD screen to his C64’s User Port: https://www.youtube.com/watch?v=vV8FbwobrKY

     
  • Jay Versluis 9:51 am on March 27, 2018 Permalink | Reply
    Tags: ,   

    Categories: Commodore, Screencast ( 38 )

    How to create random YouTube URLs in Commodore BASIC v2 

    In this episode I’ll demonstrate how to create those seemingly random YouTube Video IDs using a Commodore 64.

    Here’s the code I’m writing – works in BASIC v2 and above:

    10 print chr$(14)
    20 gosub 100:x=rnd(-ti):cn=1
    30 a$="https://youtu.be/"
    40 for i=1 to 11
    50 rn=int(rnd(0)*62)+1
    60 a$=a$+yt$(rn)
    70 next
    80 print:print cn;" : ";a$
    85 cn=cn+1
    90 goto 30
    85 cn=cn+1
    90 goto 30
    
    100 rem populate array
    110 dim yt$(62)
    120 i=1
    130 for j=65 to 90
    140 yt$(i)=chr$(j)
    150 i=i+1
    160 next j
    170 for j=193 to 218
    180 yt$(i)=chr$(j)
    190 i=i+1
    200 next j
    210 for j=48 to 57
    220 yt$(i)=chr$(j)
    230 i=i+1
    240 next j
    299 return

    The first line switches to lower case letters (I forgot to show that in the video).

    NOTE: In addition to the upper case and lower case alphabet, and the numbers 0-9, YouTube also use two special characters that I forgot to mention in the video. One is the standard minus sign (-), and the other one is the underscore (_). The Commodore machines cannot produce the latter. For simplicity’s sake, I’ve left both of those out (just though I’d mention it here).

    Inspired by Tom Scott’s video “Will YouTube ever run out of Video IDs” – watch it here: https://www.youtube.com/watch?v=gocwRvLhDf8

     
  • Jay Versluis 10:48 am on March 26, 2018 Permalink | Reply
    Tags: , Review, Webcam   

    Categories: Screencast ( 84 )

    My honest Logitech C920 Review (2018) 

    In this video I’m taking a closer look at the Logitech C920 webcam.

    I’m testing it on my Mac running Sierra, as well as under Windows 10 Pro. I wanted a 1080p capable webcam for use with Camtasia, mainly for my Windows system which currently doesn’t have a webcam.

    Let’s find out if it does what I wanted it to do.

     
  • Jay Versluis 10:43 am on March 25, 2018 Permalink | Reply
    Tags:   

    Categories: Screencast ( 84 )

    What is my YouTube Channel URL 

    In this video I’ll show you four ways of finding your YouTube Channel’s URL. I’ll also explain why there are three types of YouTube Channel URLs, and what the query parameters are that you can append.

    Just in case watching videos isn’t your thing, or you’re in a hurry, I thought I’d include some written instructions as well ๐Ÿ™‚

    (More …)

     
  • Jay Versluis 8:38 pm on March 24, 2018 Permalink | Reply  
    Categories: WordPress ( 141 )

    How to retrieve the total word count from all posts in WordPress 

    Most of my own WordPress sites have been up for longer than a decade at the time of writing, and I was wondering how much I had written in that time.

    Post count notwithstanding, I was interested in the total word count of my output in that period of time.

    Here’s a small function that retrieves just that.

    Word Count in Posts

    Comments

    But word count from posts is not all that a website adds up to: I have answered several thousand comments since then, and my answers may fill a whole book just by itself.

    Here’s how to retrieve the comment word count for the current user:

    To retrieve the total word count in all comments instead, we can do much the same thing by leaving out the user_id parameter in the above query. Subtracting the total word count from the current user word count would then reveal the comment word count that everybody else has left on a site.

    Both functions work outside of The Loop.

    You got to love statistics ๐Ÿ™‚

     
  • Jay Versluis 5:55 pm on March 16, 2018 Permalink | Reply
    Tags:   

    Categories: Windows ( 22 )

    How to shutdown Windows 10 without applying updates 

    Although most of Windows 10 keeps getting better with every iteration, some things just never change. Windows Updates are one of those. They always want to download and install when we really don’t have the time or the battery power.

    What’s worst, Microsoft have removed the graphical option to simply shutdown the system – and all we’re left with are two choices: “Update and shutdown”, or “Update and restart”.

    What if all we want to do is to shutdown or restart WITHOUT applying those updates? Perhaps we’re out and about, running on an already near-depleted battery? Or we’re in a hurry and would like to leave the update for when we have more time, or a power outlet?

    Fear not, there is a way to do these things – even if they don’t come up in the Start menu anymore.

    (More …)

     
  • Jay Versluis 11:43 am on March 14, 2018 Permalink | Reply
    Tags: , , , VIC-20   

    Categories: Commodore ( 38 )

    String Operations on Commodore Computers 

    Commodore BASIC has some interesting and simple string functions built in. Three of them are self explanatory: LEN, LEFT$ and RIGHT$. But others, like the mysterious MID$ and INSTR functions, are a little tricker, and I can never remember how they works.

    So here’s a quick recap on how they all work.

    LEN (A$)

    Returns the length of any given string. For example,

    a$=”the cake is a lie”

    print len (a$)
    17

    returns 17, which is the number of characters in our string.

    LEFT$ (A$,X)

    The LEFT$ function takes the x left characters from a given string. Here’s an example:

    a$="one-two-three"
    
    print left$(a$,3)
    one

    We get “one”, because those are the 3 leftmost characters in our string a$.

    RIGHT$ (A$,X)

    Likewise, RIGHT$ takes the x right characters from any given string:

    a$="one-two-three"
    
    print right$(a$,5)
    three

    Here we get “three”, because those are the 5 right characters of a$.

    MID$ (A$,X,Y)

    MID$ is a little more complex. It takes x characters from a given string, starting at position y. Let’s look at our earlier example again:

    a$="one-two-three"
    
    print mid$(a$,5,3)
    two

    We get “two”, because those are the 3 characters, starting at position 5. The first position in all these string operations counts as one rather than zero.

    But did you know that MID$ can also be used to assign and replace different characters in a string? Consider this:

    mid$(a$,5,3)="ten"
    
    print a$
    one-ten-three

    Now we’ve replaced the 3 characters in our string with another string, starting at position 5.

    I had no idea it cold do that! All these string operations work in all variations of the Commodore BASIC, except for the MID$ assignment which only works on the Plus/4 and the C128.

     

    INSTR (A$, B$)

    On the Plus/4 and C128, we can even check if one string is contained in another and at which position this occurs. Consider this:

    a$="the cake is a lie"
    
    b$="cake"
    
    print instr(a$,b$)
     5

    In our example, INSTR returns 5 because “cake” has been found at position 5 of “the cake is a lie”.

    We can also specify a position from which the search shall be started like this:

    print instr(a$,b$,6)
     0

    Now INSTR returns 0 because “cake” has not been found beyond position 6 of our input string.

     
  • Jay Versluis 11:04 pm on March 13, 2018 Permalink | Reply
    Tags:   

    Categories: Commodore ( 38 )

    How to play sounds and music on the Commodore Plus/4 

    The Plus/4 has a total of two voices thanks to its integrated TED chip, which is also responsible for rendering text and graphics on screen. The first voice can play square waves, while the second one can generate either square wave sounds or white noise.

    Let’s see how we can make him play a tune.

    We can use some BASIC keywords to make the Plus/4 be all musical. First we need to turn up the volume by using the VOL command. We can set this to anything between 0 and 8.

    VOL 8

    Next we can use the SOUND command to make each channel play a note, like so:

    SOUND 1,400,60

    This will play a one-second long note on channel 1.

    (More …)

     
  • Jay Versluis 5:00 pm on March 4, 2018 Permalink | Reply
    Tags: Facebook, ,   

    Categories: Screencast ( 84 )

    How to turn off PayPal Notifications in the Facebook Messenger App on iOS 

    In this video I’ll show you how to switch off those super annoying PayPal notifications in the Facebook Messenger App in iOS on my iPhone 6s Plus. I’ve recorded this video on iOS 11 in March 2018.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel