Relearning MSX

Relearning MSX

This is a series of articles I’m writing about developing software for MSX computers. I don’t assume previous experience with these machines, so even new users will be able to have fun and make stuff.

I will be talking mainly about development in C and assembly language.

Starting from March 2015 there’s one new post every Friday. Note to self: do not set deadlines.

Become a Patron

patreon

If you are enjoying this series please consider becoming a Patron to support future articles. If we get enough supporters I will spend all earnings in hiring a company to translate the original ASCII books and manuals into English.

Articles

#45: Pointers, arrays and strings (Part 2)

Using pointer arithmetic to access the elements of an array. Passing pointers as function arguments. Using pointers inside functions to access local variables that belong to other functions, access external arrays inside functions, and implement functions that return more than one result. Relationship between an array name and the start address of the same array.

Level: beginner. Programming language: C

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

Pointers. The address operator (&) and the indirection operator (*). Variable addresses and pointer arithmetic. Declaring pointer variables. Accessing the value referenced by a pointer.

Level: beginner. Programming language: C

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

Storage classes. Automatic and static variables. Variable scope. Local and global variables.

Level: beginner. Programming language: C

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

Functions that return values. Automatic type conversion of the value returned. The VOID type.

Level: beginner. Programming language: C

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

Local variables. Functions that accept parameters. Data types in function parameters. Aborting the execution of a function before it reaches the end.

Level: beginner. Programming language: C

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

Functions. Declarations, definitions and externs. How to define functions that don’t take parameters. Functions declared locally inside other functions.

Level: beginner. Programming language: C

#39: Graphic characters and additional quoted symbols

The MSX graphic characters and the 2-byte sequences to put them on the screen. Differences between the Japanese and European graphic character sets. Escaping single/double quotes and backslashes in order to print them from C programs.

Level: beginner. Programming language: C

#38: Screen escape sequences

Screen escape sequences: strings of characters that control aspects of the screen. Difference between C escape sequences, screen escape sequences and control characters.  Using escape sequences to change the shape of the cursor, insert and delete lines of text, hide and show the cursor. How to create a text scroll upwards or downwards using only escape sequences.

Level: beginner. Programming language: C

#37: Control characters and C escape sequences

Control characters, their functions and character codes. C escape sequences. How to print control characters that don’t have an escape sequence in C using the character code in hexadecimal or octal.

Level: beginner. Programming language: C

#36: Formatted output with printf()

Format placeholders and format strings. Aligning numeric values on the screen.

Level: beginner. Programming language: C

#35: Checking consistency of data types with FPC.COM

Using MSX-C’s Function Parameter Checker support tool (FPC.COM) to detect function calls with incorrect parameters. Other kinds of bugs detected by FPC. Integrating FPC into the build process.

Level: beginner. Programming language: C

#34: Data types in MSX-C

The built-in data types: unsigned, int and char. Their ranges and size in memory. How the MSX-C compiler assigns data types during compilation. The type cast operator. Type precedence rules.

Level: beginner. Programming language: C

#33: Numeric notations in MSX-C

Numeric notations in MSX-C: representing numbers as decimal, hexadecimal, octal, and character constants in our programs. Displaying numbers in any notation using printf()‘s format specifiers.

Level: beginner. Programming language: C

#32: Other control structures in MSX-C

Controlling loops in MSX-C: break, continue and goto. The switch statement.

Level: beginner. Programming language: C

#31: Loops in MSX-C

Loops in MSX-C: for() loops and several ways to use them. Characteristics of while() and do…while() loops. Shorthand arithmetic assignment and decrement/increment operators.

Level: beginner. Programming language: C

#30: Complex conditional statements in MSX-C

Comparison values. What is true and what isn’t. Values of true and false conditions. The logical operators (&&, || and !). Assignments inside conditions.

Level: beginner. Programming language: C

#29: Conditional statements in MSX-C

Statements in C. Checking for conditions: if/else. Compound statements. Comparison operators.

Level: beginner. Programming language: C

#28: Keyboard input

Reading single key presses from the keyboard: getch() and getche(). I/O buffering: setbuf() and fflush(). Reading character arrays: gets().

Level: beginner. Programming language: C

#27: Variables and arithmetic operations in MSX-C (part 2)

Bitwise arithmetic and bit shift operators. Using arithmetic with the char type.

Level: beginner. Programming language: C

#26: Variables and arithmetic operations in MSX-C (part 1)

Variable declarations. The char and int types. Arrays. Arithmetic operators. Overflows.

Level: beginner. Programming language: C

#25: Printing on the screen in MSX-C

Printing text and numbers on the screen. Library functions putchar(), puts() and printf(). character constants and string constants. The new line character.

Level: beginner. Programming language: C

#24: Calling MSX-C functions from assembler

The opposite of the previous article: how to link and call MSX-C functions from assembler programs.

Level: advanced. Programming languages: C and assembler.

#23: Calling assembler routines from MSX-C

How to write assembler routines and call them from MSX-C programs: functions without arguments, functions with a fixed number of arguments, and functions with variable number of arguments. Returning values to MSX-C programs.

Level: advanced. Programming languages: C and assembler.

#22: Programming for MSX-DOS (part2)

Functions of the operating system: file management and program execution.

Level: beginner

#21: Programming for MSX-DOS (part 1)

Functions of the operating system. MSX-DOS and MSX-DOS2 system calls. CP/M compatibility. Input/Output. Calling system calls from assembler.

Level: beginner

#20: Assembly language overview

Comparison of an example program in BASIC and assembly language. Mnemonics and pseudoinstructions. Symbols and labels.

Level: beginner

#19: Assembly language concepts

Introduction to assembly programs. Machine code, assembly language, interpreted languages and compiled languages.

Level: beginner

#18: Structure of an MSX-C program

Introduction to the structure of a C program. Function and variable declarations. Comments. Whitespace and semicolons. Library functions. The main() function. Header files.

Level: beginner

#17: Command line parameters, redirection and pipes

This week we enter two small example programs (TRIANGLE.C and DOUBLE.C). We see some common errors during compilation and how to deal with them. We see very briefly how a program uses command line parameters, and we examine with some detail input/output redirection and pipes.

#16: Roadmap

This is not a technical article. We talk about the Introduction to MSX-C books published by ASCII and also about the two editions of The C Programming Language book by Brian Kernighan and Dennis Ritchie. From this post there will be one new issue every Friday.

#15: MSX-C commands (3/3): CG.COM

Detailed explanation of MSX-C’s command line tool CG.COM, the code generator. This is the program that converts intermediate code (TCO files) into assembler source code.

Level: intermediate. Programming language: C

#14: MSX-C commands (2/3): FPC.COM

Detailed explanation of MSX-C’s command line tool FPC.COM, the function parameter checker. This is an optional program that checks our source code for incorrect parameters in function calls.

Level: intermediate. Programming language: C

#13: MSX-C commands (1/3): CF.COM

Detailed explanation of MSX-C’s command line tool CF.COM, the parser. This is the program that takes a source code file written in C and translates it into intermediate code (a TCO file) that can be later converted into Z80 assembler by the CF.COM program.

Level: intermediate. Programming language: C

#12: Setting up the MSX-C environment (part 6)

How to create an AUTOEXEC.BAT file to set up some aspects of MSX-DOS2 when it boots. Creating a C.BAT script to automate compilation of our C programs.

#11: The KID (AKID) text editor (part 2)

Copying and pasting text in KID/AKID. The default keyboard shortcuts and how to change them using the CONKID program.

#10: The KID (AKID) text editor (part 1)

We need to learn how to use a text editor before we can continue setting up MSX-C. What’s the difference between a text editor and a word processor? Differences between the KID and AKID text editors included in MSX-DOS2 TOOLS. Creating text files with KID/AKID. Description of the KID/AKID menus.

#9: Setting up the MSX-C environment (part 5)

Description of the MSX-C Library package. Installation of MSX-C Library in the MSX hard drive.

#8: Setting up the MSX-C environment (part 4)

Differences between MSX-C Ver.1.1 and MSX-C Ver.1.2. Installing MSX-C Ver.1.2 in the MSX hard drive. Compilation of a simple C program by hand.

Level: beginner. Programming language: C

#7: Setting up the MSX-C environment (part 3)

Description of the MSX-DOS2 TOOLS package. Installation of MSX-DOS2 TOOLS in the MSX hard drive. Quick intro to the KID and AKID text editors

#6: Setting up the MSX-C environment (part 2)

How to install MSX-DOS2 in the MSX hard drive.

#5: Setting up the MSX-C environment (part 1)

How to set up an emulator (openMSX) to emulate a Panasonic FS-A1GT computer with a Sunrise IDE interface and hard drive. In case you don’t have a real MSX for development.

#4: Our software environment

Description of the software packages that we will use in this series: MSX-DOS2, MSX-DOS2 TOOLS, MSX-S BUG2, MSX-C Ver.1.2, MSX-C Library.

#3: User environments

MSX-BASIC and MSX-DOS/MSX-DOS2.

Level: beginner

#2: What’s this “MSX” thing?

What MSX computers are. Differences between generations (MSX1, MSX2, MSX2+ and MSX turbo R). Types of media: cartridges, cassette tape, floppy disks.

Level: beginner

#1: Introduction

First article of the series. My story with MSX computers.

msx_documentation-300pxmsx_magazine_1985_05_p152_aiwa_dr-2_data_recordermsx_magazine_1985_01_p152_external_floppy_disk_driveIMG_2189msx-c_booksmsx_magazine_1985-05_msx-copenMSX_cbios_bootmsx_magazine_1989-08_msx-dos2_adPanasonic_FS-A1GT_with_MSX-DOS2_floppymsx-c_cf_automatic_type_conversion_programmsx_magazine_1989-01_msx-dos2_ad

Sony HB-101, a first-generation model (MSX Magazine, January 1985)


Warning: Illegal string offset 'share_counts' in /www/javi_lavandeira/lavandeira.net/ftproot/htdocs/wp-content/plugins/simple-social-buttons/simple-social-buttons.php on line 477