Blog

Relearning MSX #44: Pointers, arrays and strings (Part 1)

Posted by in How-to, MSX, Retro, Technology | May 24, 2016

Relearning_MSX_44

Pointers are a special type of data in the C programming language (and also C-like languages). In short, a pointer is just a variable that contains the memory address of some data in the computer. It’s a simple concept, but pointers are always a source of confusion when we’re learning the language. However, once understood they become a powerful tool that provide lots and lots of flexibility.

Today we’re starting a short series explaining what pointers are and how they can make our programs much more interesting. As always, don’t hesitate to ask in the comments below when anything isn’t clear.

Let’s begin.

The address operator (&) and the indirection operator (*)

Computers store all program data and variables in an area known as memory. In MSX computers memory is organized in 65,536 cells(*), each containing a number between 0 and 255 (known as a byte).

Each memory cell is identified by a number between 0 and 65,535 (0x0000 – 0xFFFF in hexadecimal). We call this the memory address.

It’s easy to visualize this concept if we think of the computer memory as an spreadsheet with 65,536 rows, such as this one:

Memory cells and data (Click to enlarge)

Memory cells and data (Click to enlarge)

Read more ›

Changes to the Patron rewards for Relearning MSX posts

Posted by in MSX, Retro, Technology | May 23, 2016

Hi all,

First of all, thanks to all of you who support the creation of new Relearning MSX articles via your patronage on Patreon, and in your comments here, on the Facebook MSX groups, Reddit and Twitter!

Today I’ve changed the Patreon reward system. Until yesterday, the first four Relearning MSX posts every month were exclusive for Patrons for a week, and after that they became public for everybody.

Somebody gave feedback on Facebook, saying that announcing each post twice (once the moment it became available for Patrons, and once more a week later when it became public) felt too spammy.

In order to address this, all future Relearning MSX posts will be public from the very first moment. Patrons are still charged for the first four articles every month, but now everybody has access at the same time, whether they’re supporters or not. This also involves less work for me, since I don’t have to go back and forth setting up access passwords and keeping track of when articles become public.

If you find my programming articles useful, please consider becoming a Patron. Every little bit helps ensure that other life commitments don’t take precedence over writing new content.

Thanks!

The MSX Resource Center’s rotten user community

Posted by in MSX, Rants, Retro, Stupidity | May 19, 2016

The MSX Resource Center (most commonly known as MRC) is currently the biggest MSX user community on the Internet. It started when Sander van Nunen in the Netherlands registered the msx.org domain around 1996. Search results for “MSX” or “MSX computers” on Google show the MRC near the top because their domain name matches the search and also because it has been around for so long.

This is unfortunate, because the MRC is a toxic community and it keeps harming the MSX scene.

The latest incident happened just yesterday. What started as a post about Brazilian MSX users taking a stand against piracy ended in a heated discussion when the user foobarry81 attacked the game developer Kralizec. The MRC moderators did nothing to stop this user, resulting in continuous attacks agains Kralizec and several users publicly announcing they were leaving the MRC for good.

In other words, a shitstorm.

(Click to enlarge)

Original post (Click to enlarge)

Keep reading for the details.

Read more ›

Relearning MSX #43: Storage classes and variable scope in MSX-C

Posted by in Development, How-to, MSX, Retro, Technology | May 13, 2016

Relearning_MSX_43

We’ve already seen how to use local variables inside a function declaration. However, there are times when we want to be able to share the same variable between several functions. In this situation local variables aren’t the best solution.

There are other cases when we want to use a local variable, but we need the variable to retain its value between calls to the function.

In this chapter we’re going to see how to declare and use variables to support these two situations.

The storage class of a variable

All variables in C have a property called storage class. The storage class defines the lifecycle of a variable. This means that depending on this property, a variable can either be created and destroyed several times during the execution of a program (whenever we call the function or block that defines the variable), or created once and exist until the program finishes.

Variables in MSX-C can belong to one of the two storage classes below:

Storage classes in MSX-C

Storage classes in MSX-C

Read more ›

Relearning MSX #42: Functions in MSX-C (Part 3)

Posted by in How-to, MSX, Retro, Technology | April 12, 2016

Relearning_MSX_42

The previous post dealt with function arguments and private variables inside functions. Today we’re going to complete our study of functions by looking at how we can return values from them.

Let’s jump into it.

Read more ›

Relearning MSX #41: Functions in MSX-C (Part 2)

Posted by in How-to, MSX, Retro, Technology | March 04, 2016

 

Relearning_MSX_41

It’s been a bit over two months since the previous post. In it we learnt how to define simple functions that don’t take or return any parameters. We also learnt that we need to declare a function if we’re calling it at a point in our program where it hasn’t been defined yet.

Today we’re resuming the course exactly where we left it. If you need a refresher then go ahead and re-read the previous chapter. As always, don’t hesitate to ask questions in the comments below if anything isn’t clear.

Let’s see a few more properties of functions in C:

Read more ›

Review: 8bits4ever’s FDC-600 floppy disk controller

Posted by in Hardware, MSX, Retro, Technology | February 12, 2016

Last December as the year was about to end I received 8bits4ever‘s FDC-600 floppy disk controller for MSX computers and Tweeted about it:

The plan was to go buy a floppy drive and a couple of cables and write a review immediately after the New Year vacation, but I focused on other things for a while.

It has taken a while, but here’s the review.

Read more ›

Relearning MSX #40: Functions in MSX-C (Part 1)

Posted by in How-to, MSX, Retro, Technology | December 21, 2015

DSC_1680

We’ve covered a lot of ground already, but so far we haven’t seen anything about MSX-C that couldn’t be done with some effort with MSX-BASIC. That changes with the posts that follow.

Today we’re going to see one of the strengths of the C programming language: functions.

Let’s get to it.

Defining and using functions

When we write a program, as the source code becomes bigger and bigger it becomes much more complex and more difficult to maintain. Because of this, no matter what programming language we use, we normally divide a big program into smaller parts that perform a specific action. For example, in BASIC we used to write subroutines and call them with GOSUB.

In C we do this with functions.

Defining a function

Before we can use a function we have to indicate what code it is going to execute and what name we’re going to give to it. We call this the function definition.

The way we define a function changes slightly depending on whether it takes parameters or not, and whether it returns any data or not. Let’s start with the simplest cases and then look at more complex scenarios.

Function without parameters nor return value

The simplest case is a function that doesn’t take any parameters and that performs some action, but doesn’t return any data. It’s basically just a bunch of C statements grouped together and given a name. This is how we define such a function:

(Click to enlarge)

(Click to enlarge)

Read more ›

Statement regarding Kai Magazine and msx.org

Posted by in MSX, Personal, Rants, Stupidity | December 17, 2015

(Update: Kai stole the ship graphics from here. See below)

(Update 2: I was wrong about Kai stealing the ship images. He has shown proof that he purchased these models back in November 4th. I apologize to Kai for asserting he had stolen these two images, when he did legally purchase them)

For the last ~20 years I’ve been a user of the MSX Resource Center, but differences with the msx.org staff made me leave yesterday. To be precise, I cannot accept the childish behaviour of one of the administrators: Sander Zuidema (snout).

The problem revolves around the user Oscar Albero (Kai Magazine). To summarize:

  • Oscar is releasing a new game called Life On Mars, which he’s selling for 39 euro (about $42).
  • Life On Mars uses graphics stolen from Nintendo’s Metroid Fusion and at least two other sources.
  • User Arkhan (Andrew Darovich, who is himself a game developer) notices the stolen content and calls Oscar out on this.
  • Oscar evades the point, going on a tangent on how much work he has put on the game (he claims “over 1000 hours”) and lying about having created “over 90%” of the content.
  • Admin snout joins the discussion, insulting Arkhan calling him a nutjob and posting an offensive image.
  • Meits (Jelle Jelsma, another admin) joins the conversation and takes sides against Arkhan. Arkhan is forced to defend himself from the insults of Oscar, snout, Meits and Grauw (Laurens Holst, who joins the others).
  • Arkhan obviously gets more and more frustrated.
  • snout makes things worse by childishly posting a log from the #msxdev IRC channel at Rizon. The log shows that users on IRC are also discussing Kai stealing the Metroid graphics.
  • One of the users on IRC happens to be GuyveR800 (Patriek Lesparre), who snout has personal issues with.
  • snout bans Arkhan from msx.org because of his association with Patriek on #msxdev
  • I join the thread and explain how I agree with Arkhan’s point (the graphics ARE stolen), and that he shouldn’t be insulted (and much less banned!) for telling the truth. For this I get put down on the thread while simultaneously other users are insulting me on a closed MSX-related Facebook group for agreeing with Arkhan.

I will not put up with this childish behaviour, so I’ve left both msx.org (I’ve requested them to delete my accounts there) and also the MSX Boixos Club Facebook group.

Read more ›

Relearning MSX #39: Graphic characters and additional quoted symbols

Posted by in How-to, MSX, Retro, Technology | December 16, 2015

relearningMSX39cover

In the last few posts we’ve learnt how to control what’s being printed on the screen. Soon we’ll move on to something else (functions!), but first we’re going to see how to handle graphical characters and how to print any character inside a double-quoted string.

The MSX graphic characters

MSX computers have a set of 32 special characters known as graphic characters. These only occupy one position on the screen and one byte in the video RAM, but in order to display them we have to print a 2-byte sequence.

We can type all of these characters by pressing the GRAPH key together with normal alphanumeric characters on the keyboard, but not all the characters generated with GRAPH are 2-byte codes: some are normal characters from the ASCII table (we’ll see these in the future).

The GRAPH key on a Japanese MSX computer

The GRAPH key on a Japanese MSX computer

Also, it’s important to remember that most of these graphic characters will be different from one MSX to another depending on the country of origin of the computer. For example, a Japanese MSX computer would display several commonly used kanji characters, while an European MSX would display several other useful symbols:

Read more ›