

It is unavoidable that switching to 'C' loose a certain level of performances. however, some complex high level tasks are a bit hard in asm. msx should use asm for better performance.
#CPLOT Z88DK PLUS#
Plus i do not think that port based access is an issue on both compilers, the banked out port extensions work fine on both compilers and are not the bottleneck, imho. We are focusing on msx, so it is a good thing to see how those compilers fit on msx development. I do not think to leave out msx specifics.
#CPLOT Z88DK CODE#
No "push", no "pop" in generated assembly code testrom.c:184: pset.vram_type=0 // 0= main VRAM

Void Pset(PSET *pxy) _naked _z88dk_fastcall * graphic mode 5 and 8 display of a point at coordinates x, y with color and logical operation Other example Pset function : // Structure for Pset In main function : testrom.c:190: MouseReadTo(&md) Void MouseReadTo(MOUSE_DATA *md) _naked _z88dk_fastcallĪSM : libmsx.h:134: void MouseReadTo(MOUSE_DATA *md) _naked _z88dk_fastcall Read Mouse Offset x and y, mouse button and return to MOUSE_DATA Structure In main function : testrom.c:146: hkb=kbread(8) Įxample get mouse information : // Structure for ReadMouseTo output data libmsx.h:63: unsigned char kbread(unsigned char kbline) _naked _z88dk_fastcall > Same (_naked _z88dk_fastcall) for functions that retrun a value : unsigned char kbread(unsigned char kbline) _naked _z88dk_fastcall In main function : testrom.c:147: putchar(' ') libmsx.h:9: void putchar(unsigned char car) _naked _z88dk_fastcall > I use "_naked _z88dk_fastcall" for functions whith 1 parameter : void putchar(unsigned char car) _naked _z88dk_fastcall In main function : testrom.c:143: screen0() Gives : libmsx.h:32: void screen0() _naked next declaration causes an compilation error : #define CLEAR_SPRITE _asm_ ("call CLRSPR") įunctions whithout parameters and return value : void screen0() _naked
#CPLOT Z88DK HOW TO#
If someone knows how to use a define into another define thanks!. #define CLEAR_SPRITE _asm_ ("call 0x0069") I use the "inline" functions for calls to the system functions whenever possible (beware of registers backups if interrupts are used) : // CLRSPR So, no need peek or poke functions, but simply use of variables so declared : void main (void) _at (BAKCLR) unsigned char backgroundcolor _at (FORCLR) unsigned char foregroundcolor I declare in my source.c the variables I am going to use. #define CRTCNT 0xf3b1 // 1 Number of lines on screen #define LINLEN 0xf3b0 // 1 Width for the current text mode #define LIN元2 0xf3af // 1 Width for SCREEN 1 (default 29) #define LINL40 0xf3ae // 1 Width for SCREEN 0 (default 37) #define USRTAB 0xf39a // 2 Address to call with Basic USR0 #define CLPRIM 0xf38c // 14 Routine that calls a routine in a primary slot #define WRPRIM 0xf385 // 7 Routine that writes to a primary slot #define RDPRIM 0xf380 // 5 Routine that reads from a primary slot 0=MSX1, 1=MSX2, 2=MSX2+, 3=turbo R.Īnd 1 file msxsysvar.h #ifndef _MSXSYSVAR_H_ #define ENASLT 0x0024 // Switches indicated slot at indicated page on perpetual #define CALSLT 0x001C // Executes inter-slot call #define WRSLT 0x0014 // Writes a value to an address in another slot #define RDSLT 0x000C // Reads the value of an address in another slot #define KEYINT 0x38 // RSTĐx38 > Executes the timer interrupt process routine #define CALLF 0x30 // RSTĐx30 > Executes an interslot call #define GETYPR 0x28 // RSTĐx28 > Returns Type of DAC #define DCOMPR 0x20 // RSTĐx20 > Compares HL with DE #define OUTDO 0x18 // RSTĐx18 > Output to current outputchannel (printer, diskfile, etc.) #define CHRGTR 0x10 // RSTĐx10 > Gets the next character (or token) of the Basic-text #define SYNCHR 0x08 // RSTĐx08 > Checks if then current character pointed by HL is one desired. #define VDP_DW 0x07 // VDP write port address #define VDP_DR 0x06 // VDP read port address #define CHKRAM 0x00 // RST 0x00 > Check RAM and sets slot for command area.

I have 1 file msxbios.h with : #ifndef _MSXBIOS_H_ Here are my practices for programming with SDCC : I use SDCC version 3.6.0 which is currently provided with Fusion-C.
