[MSX-C] Q&A official thread

Page 53/54
46 | 47 | 48 | 49 | 50 | 51 | 52 | | 54

By Wolverine_nl

Paladin (733)

Wolverine_nl's picture

17-10-2017, 15:03

AxelStone wrote:

Hi Eric, you are right, SDCC is a powerful cross compiler, however it has a serious problem: its lack of libraries. I decided to use MSX-C basically because it has the best set of libraries, the official ASCII MSX-C libs for handle basically all aspects of MSX. There is a way to get a "more or less" confortable MSX dev environment using MSX-C: OpenMSX + folder as disk.

1.- Follow steps of http://www.lavandeira.net/relearning-msx/ to setup your environment.
2.- Using OpenMSX, use feature "folder as disk". In that folder you edit your sources using a modern editor like Notepad++.
3.- Compile it using OpenMSX throtle function (F9) to speed up compilation.

It's not perfect since PC compilation with SDCC will be faster, but you have a lot of libraries available. I hope that in a near future SDCC will have as many libraries as MSX-C :(

This ^^
I used a folder that I shared from a mounted image file so I could realtime test on a real MSX using the Nowind after compilation.

By hit9918

Prophet (2685)

hit9918's picture

17-10-2017, 16:11

@ericb59 look at this
https://sites.google.com/site/tueftlerlabs/home/downloads/de...

the point is that you can make your own gfx commands in C. without needing asm.
and a lot folks know help about how to code the VDP.

By AxelStone

Prophet (2527)

AxelStone's picture

19-10-2017, 16:59

I suggest @ericb59 give a try to MSX-C since you have graphic libraries instead of creating your own. Let us know if you have any question using these libs Wink

By aceki

Master (129)

aceki's picture

20-12-2017, 16:28

Hello everyone

I'm starting in C for MSX, also starting in programming, I never did much about this, more than language assembler in Pic 16f86.

I'm following the laundry tutorial, it hurts that not avazando a little more. So, I accept proposals to read about this topic,

Currently I program crossover, devc ++ on the pc, and I raise the code in emulator, where I have armed an environment with DOS 2.22 + msx-c 1.2 + TED

Greetings to all!

By PingPong

Prophet (2977)

PingPong's picture

21-12-2017, 00:43

hit9918 wrote:

@ericb59 look at this
https://sites.google.com/site/tueftlerlabs/home/downloads/de...

the point is that you can make your own gfx commands in C. without needing asm.
and a lot folks know help about how to code the VDP.

It seems that the lack of gfx routines is a big showstopper.
on msx to interact with video is a matter of three simple routines, that one can easily make in c or in-line assembly.
1) write a vdp register
2) set vram ptr for read or write
3) write or read from data port

With those in place you can manage the entire gfx.
Lines are done by vdp itself, memory copy the same and some operations that move data between vdp / cpu are also easy to implement. From a graphic point of view there is a missing routine. the ellipse/circle one... but the breseham algo is easy to implement in 'c' and a good exercise to begin to work with sdcc...
so do not having a gfx graphic library is not itself a big problem.
AT LEAST, as hit9918 mentioned, one can do all in 'c'. SDCC has sfx port extensions that are translated in machine code in a reasonable efficient way....

By Wolverine_nl

Paladin (733)

Wolverine_nl's picture

21-12-2017, 10:00

ASCII MSX-C does have gfx routines if I am not mistaken, but is ofcourse K&R C and not ANSI ;-)

By Giangiacomo Zaffini 2

Resident (46)

Giangiacomo Zaffini 2's picture

26-12-2017, 05:15

For SDCC and MSX I saw different projects aiming at helping being productive.
I didn't tracked them down, so I don't have their URLs at hands, but with a simple search I found again
snpl's skeleton of SDCC C project targeting MSX
and
RetroDeLuxe game engine for MSX first generation (Msx1)
Then there's z88dk and others c compilers.

By PingPong

Prophet (2977)

PingPong's picture

26-12-2017, 19:28

Giangiacomo Zaffini 2 wrote:

For SDCC and MSX I saw different projects aiming at helping being productive.
I didn't tracked them down, so I don't have their URLs at hands, but with a simple search I found again
snpl's skeleton of SDCC C project targeting MSX
and
RetroDeLuxe game engine for MSX first generation (Msx1)
Then there's z88dk and others c compilers.

Retrodeluxe engine routines contained on vdp.c file are not correctly implemented:
vdp_poke contains an add a,#0x40. better should be "or a, #0x40". Plus on the end there is a double ei instruction that is not needed.
vdp_poke_di contains an add a,#0x40. better should be or 0x40.
vdp_peek should NOT contain an add a, #0x40 instruction instead something like and a, 0x3f to ensure a read access.

By aceki

Master (129)

aceki's picture

27-12-2017, 10:08

PingPong wrote:
Giangiacomo Zaffini 2 wrote:

For SDCC and MSX I saw different projects aiming at helping being productive.
I didn't tracked them down, so I don't have their URLs at hands, but with a simple search I found again
snpl's skeleton of SDCC C project targeting MSX
and
RetroDeLuxe game engine for MSX first generation (Msx1)
Then there's z88dk and others c compilers.

Retrodeluxe engine routines contained on vdp.c file are not correctly implemented:
vdp_poke contains an add a,#0x40. better should be "or a, #0x40". Plus on the end there is a double ei instruction that is not needed.
vdp_poke_di contains an add a,#0x40. better should be or 0x40.
vdp_peek should NOT contain an add a, #0x40 instruction instead something like and a, 0x3f to ensure a read access.

This engine, based on sdcc by what I see, therefore follows the same guidelines as msx-c? Or point more to a more advanced c?

By PingPong

Prophet (2977)

PingPong's picture

27-12-2017, 20:47

aceki wrote:
PingPong wrote:
Giangiacomo Zaffini 2 wrote:

For SDCC and MSX I saw different projects aiming at helping being productive.
I didn't tracked them down, so I don't have their URLs at hands, but with a simple search I found again
snpl's skeleton of SDCC C project targeting MSX
and
RetroDeLuxe game engine for MSX first generation (Msx1)
Then there's z88dk and others c compilers.

Retrodeluxe engine routines contained on vdp.c file are not correctly implemented:
vdp_poke contains an add a,#0x40. better should be "or a, #0x40". Plus on the end there is a double ei instruction that is not needed.
vdp_poke_di contains an add a,#0x40. better should be or 0x40.
vdp_peek should NOT contain an add a, #0x40 instruction instead something like and a, 0x3f to ensure a read access.

This engine, based on sdcc by what I see, therefore follows the same guidelines as msx-c? Or point more to a more advanced c?

It is not a question of more advanced 'c' rather than the proper way to interact with hw.
SDCC is a ansi 'c' implementation.
msx-c not

Page 53/54
46 | 47 | 48 | 49 | 50 | 51 | 52 | | 54
My MSX profile