ccZ80++ library for MSX

Naoki Ito

Posted 7 years ago

Hi,

I made the ccZ80++ library for MSX. The ccZ80++ is a language similar to C language.

This library has the following classes.

  • bios: the basic functions with BIOS
  • bitbuster: the functions for decompressing with bitbuster
  • chr: the functions for the management of the characters in SCREEN 2 or 4
  • file: the functions for the management of files
  • g9k: the functions for the management of V9990
  • graphic: the functions for the management of the graphics in SCREEN 5~8
  • gtext: the functions for the management of the texts in SCREEN5~8
  • music: the functions for the management of music
  • sound: the functions for the management of sound
  • sprite: the functions for the management of the sprites
  • timer: the functions for using the timer interrupt with VSYNC
  • xmgs: the functions for using XMGS


Example using V9990 and music class

// Hello v9990 (2017 N.I)
include bios.ccz80++
include g9k.ccz80++
include music.ccz80++

class MainClass{
//--- palette(MSX default)
static short colors[]={0,0,0, 8,8,8, 4,24,4, 12,28,12, 4,4,28, 8,12,28, 20,4,4, 8,24,28, 28,4,4, 28,12,12, 24,24,4, 24,24,16, 4,16,4, 24,8,20, 20,20,20, 31,31,31};

//---------- main 
static void main(){
 //--- initialize
 if(!g9k.detect()){bios.info("V9990 not found");return;}
 bios.screen(5);
 g9k.reset();
 g9k.screen(g9k.MODE_B1,g9k.SCR0_4BIT,g9k.SCR0_XIM256,0,0);
 g9k.arg(0);
 g9k.writeMask(#ffff);
 g9k.palette(&colors,0,3*16);

 //--- load the image to page1
 g9k.vram(g9k.PG1,g9k.PGH1);
 g9k.bload("FONT.SR5");

 //--- create sceeen
 g9k.lop(g9k.LOP_WCSC);
 g9k.box(0,0,256,212,0);g9k.cmdWait();
 g9k.lop(g9k.LOP_WCSC|g9k.LOP_TP); // transparent
 g9k.box(0,38,256,2,#2222);g9k.cmdWait();
 g9k.box(0,36,256,2,#5555);g9k.cmdWait();
 print(32,32,"HELLO V9990");
 print(32,80,"PUSH SPACE KEY TO QUIT.");
 g9k.displayEnable();

 //--- load music
 music.load("SAMPLE1.MGS",0);
 music.play(0);
 
 //---
 while(bios.strig(0)==0);

 music.stop();
 g9k.lop(g9k.LOP_WCSC);
 g9k.box(0,0,256,212,0);g9k.cmdWait();
}

//----- print
static void print(int X,int Y,int S){
 while(*S){
 if(*S!=32){
  g9k.copy(X,Y,8,8,((*S-32)&31)*8,212+((*S-32)/32)*8);g9k.cmdWait();}
 ++S;X+=8;}
}
}

Result:

This library is included in the text editor called Tabmegx.

Tabmegx works on Windows. It has the function to compile and execute sources written in ccZ80++, BASIC, MML and so on.

Download

http://ni.x0.com/msx/tabmegx/


Replies

Nice! Going to try this for sure...

Post a reply

You need to be signed in to reply.