[Z88DK] Official thread:

Door AxelStone

Prophet (2701)

afbeelding van AxelStone

28-10-2019, 20:40

Hello everyone, a few years ago I started an official MSX-C thread focused on ASCII MSX-C. For sure we learnt a lot, but I feel that now it's time to jump to cross compilers like SDCC / Z88DK.

I've seen official thread for Fusion-C / SDCC, but not for Z88DK so I think it's good to create one for whose who had decided to use this compiler.

I'm thinking in a near future to create a github shared repository with all info, examples and libs available that we can share, buy meanwhile we can start with this thread.

Here goes first question: how can I generate my own libraries? I want to generate some .lib from my C sources.

Wellcome to all Z88DK coders Wink and thanks for sharing your knowledge.

Aangemeld of registreer om reacties te plaatsen

Van AxelStone

Prophet (2701)

afbeelding van AxelStone

03-11-2019, 16:04

Ok here goes first code question. I'm trying to use asmlib developed by Nestor, as first try I want to generate a simple BEEP, here goes my source code:

#include &ltstdio.h&gt
#include &ltarch/msx/asm.h&gt

#define BEEP 0x00C0

Z80_registers *regs;
register_usage usage;

int main()
{
	usage = REGS_NONE;
	BiosCall(BEEP,regs,usage);
	printf("Hello World !\n");
    return 0;
}

I don't get a normal BEEP, it sounds something quite strange. Where is the error?

Thanks.

Van Sandy Brand

Master (156)

afbeelding van Sandy Brand

03-11-2019, 19:54

So I am not familiar with the libraries, but are you sure you can pass in an uninitialized pointer (= regs)?

Seem to me that something like this would make more sense:

Z80_registers regs;
// ....
    BiosCall(BEEP, &regs, usage);

(and maybe you need to initialize the 'regs' structure as well?)

Van zPasi

Champion (472)

afbeelding van zPasi

03-11-2019, 20:20

AxelStone wrote:

I don't get a normal BEEP, it sounds something quite strange. Where is the error?

I don't know, but are you making a DOS COM, a ROM or a BLOAD-style binary? At least in case of DOS-program you have to use inter-slot calls. Maybe that BiosCall does just that, I haven't checked out.

Van AxelStone

Prophet (2701)

afbeelding van AxelStone

03-11-2019, 21:45

Hello Sandy, you are right, your way is more clear to pass, this is the code now:

#include <stdio.h>
#include <arch/msx/asm.h>

#define BEEP 0x00C0

Z80_registers regs;
register_usage usage;

int main()
{
    usage = REGS_NONE;
    BiosCall(BEEP,&regs,usage);
    return 0;
}

But here goes the warning: the function doesn't work on OpenMSX, this is why I was wandering what happened. In real MSX it works perfectly.

@zPassi yes it was a DOS executable, the library from Nestor uses inter-slot calls.

Thanks guys.