Hello Screen2: VDP programming for MSX1

Gilbert Francois Duivesteijn

< Back to main page

The goal of this page is to show how to create graphics in screen mode 2. The examples in this page are the very minimum to create a tile, an 8x8 pixel sized block. Both examples give the output as seen in the screenshot above.

Step 1: Watch the tutorial from ChibiAkumas to learn how the tile based Graphics system of the MSX works.

Lesson S6 - Easy Tiles on the MSX1

Lesson P5 - Bitmap graphics on the TI-83 and MSX

Note: On the MSX1, there are some details to be careful with! The command otir to copy a block of memory to the VRAM cannot be used on an MSX1. There is a speed limit when accessing the VRAM of 29 cycles. The otir instruction is too fast and it results in incomplete tiles in VRAM. On the (real) MSX1, I had lines skipped in the tiles. The examples on this page will be using an alternative routine for the otir instruction, as suggested by Grauw (see references). The MSX2 does not have these speed limits, since the VDP is faster than the otir instruction.

Method 1: using easy BIOS functions

Using bios functions gives the benefit of smaller code and guaranteed to work subroutines. The downside is that it might be not the most efficient way to perform tasks.

Step 2a: Type in the code below and save to a file named hello_screen2.asm. The code is made for a ROM. If you prefer to compile to a CAS or BIN file, look at the How to create a ROM, BIN or CAS file page.

The listing above does the following things:

Step 3a: Compile

with VASM

or with Glass (you can choose)

Step 4a: run with openMSX

Now you should see 3 coloured blocks in a diagonal.

Method 2: using custom copy functions

Using your own written functions gives the benefit of code that you fully understand and enables you to optimize it as far as you can. Usually, the code footprint is larger than using ready made BIOS functions.

Step 2b: Type in the code below and save to a file named hello_screen2.asm.

Step 3b: Compile

with VASM

or with Glass (you can choose)

Step 4b: run with openMSX

Now you should see 3 coloured blocks as in the first example.

References