I decided not to use the MSXgl project from the start as the build system (Windows, no makefiles) doesn't fit in with my current development environment (Linux, makefiles)... but the guy has done a tremendous amount of work to bring a whole suite of addons to the C environment for hardware interaction on the MSX.
First thing is that they have all been built with vanilla SDCC (>4.1.x), with the new assembler calling convention. I realise that I'll need to convert any inline assembly to the style used by z88dk, and there will be some tradeoff in speed.
However, I'm trying to compile the first part of the project, the vdp functions (https://github.com/aoineko-fr/MSXgl/blo ... /src/vdp.c), and am stumbling at the first hurdle:
Code: Select all
zcc -compiler=sdcc +msx -m -subtype=msxdos2 -pragma-define:CRT_DISABLELOADER=0 -I./src -I./src/msxgl -o src/msxgl/vdp.o -c src/msxgl/vdp.c
src/msxgl/vdp.c:1655: error: syntax error
^---- .rept 15 -1
^---- rept:15-1
src/msxgl/vdp.c:1676: error: syntax error
^---- .rept 11 -1
^---- rept:11-1
src/msxgl/vdp.c:1678: error: duplicate definition: endm
^---- .endm
^---- endm:
make: *** [Makefile:135: src/msxgl/vdp.o] Error 1
Code: Select all
#endif // (MSX_VERSION >= MSX_2)
#endif // (VDP_USE_DEFAULT_SETTINGS)
} // <---- THIS IS LINE 1655
//-----------------------------------------------------------------------------
// Get VDP version
// @return 0: TMS9918A, 1: V9938, 2: V9958, x: VDP ID
// @note Code by Grauw (http://map.grauw.nl/sources/vdp_detection.php)
u8 VDP_GetVersion() __naked
{
__asm
// Detect VDP version
//
// a <- 0: TMS9918A, 1: V9938, 2: V9958, x: VDP ID
// f <- z: TMS9918A, nz: other
VDP_GetVersionAsm:
call VDP_IsTMS9918A // use a different way to detect TMS9918A
ret z
ld a, #1 // select s#1
VDP_DI
out (P_VDP_ADDR), a
ld a, #VDP_REG(15)
out (P_VDP_ADDR), a
in a, (P_VDP_ADDR) // read s#1 // <---- THIS IS LINE 1676
and #0b00111110 // get VDP ID
rrca // <---- THIS IS LINE 1678
The .rept and .endm directives are present in that file, but way off on other lines.
I'm not an assembler person (that's why I write in C), but is there an option to zcc to retain the intermediate file so that I can see exactly what (I suppose z80asm?) is actually trying to be assembled here?