[MSX-C] Q&A official thread

Pagina 55/57
48 | 49 | 50 | 51 | 52 | 53 | 54 | | 56 | 57

Van DarkSchneider

Paladin (942)

afbeelding van DarkSchneider

25-06-2018, 08:40

As you compile on the emulator, create a machine with DOS2. The compiled programs works fine on Nextor. So don't worry if the compiler/assembler itself don't.

Van cosmic

Supporter (15)

afbeelding van cosmic

25-06-2018, 13:04

Yes, I assume that under that circumstances, that is the way to go.

Regarding the issue, it seems like the more you use msx-c tools (i.e. cf.com, cg.com, etc...) after a clean restart, the more prone to fail.
For simple compilations (i.e. just a simple printf("Hello world\n")), and under Nextor, it uses to compile apparently fine the first time(s). By iterating the same compilation process, it crashes. With more complex compilations, it usually crashes on the first compilation process.

Regards,

Van Roland007

Expert (85)

afbeelding van Roland007

22-03-2019, 14:25

Some questions about C and speeding it up. I'm writing some code that requires many locate operations. So I am looking at the fastest way to set the cursor position. I know 0xF3DD and 0xF3DC contain the locations of the cursor but are they safe? I can define a global pointer to these addresses, write values and skip the locate function or is there a downside? Another question is, is this actually faster (assuming MSX-C uses BIOS and so skip a bios routine that writes these values to F3DD and F3DC) or is there an even faster way?

Thanks!

Van AxelStone

Prophet (3064)

afbeelding van AxelStone

05-11-2019, 22:50

Roland007 wrote:

Some questions about C and speeding it up. I'm writing some code that requires many locate operations. So I am looking at the fastest way to set the cursor position. I know 0xF3DD and 0xF3DC contain the locations of the cursor but are they safe? I can define a global pointer to these addresses, write values and skip the locate function or is there a downside? Another question is, is this actually faster (assuming MSX-C uses BIOS and so skip a bios routine that writes these values to F3DD and F3DC) or is there an even faster way?

Thanks!

Hello sorry for delay, long time not to return to program. One question, why not to use simply locate function of MSX-C ? It calls POSIT BIOS function and it's completely safe and standard.

Van AxelStone

Prophet (3064)

afbeelding van AxelStone

05-11-2019, 23:12

Hello everyone, to recover the last conversation about libraries, right now MSX-C has still the most complete libraries set dedicated to MSX, check out here: https://www.fvue.nl/wiki/MSX-C_manual

Thanks to the work of people like Eric Boez and Fernando García we have now a very complete set of libraries with Fusion-C. If you are thinking about to jump to a cross compiler is a good time to do it. On the other hand, Z88DK is growing fast too, so you have both options.

At this moment I'm still coding in MSX-C and I've overcome all obstacles, I'm near to finish a complete game engine entirely done in MSX-C.

Van melovictor

Supporter (5)

afbeelding van melovictor

24-06-2020, 21:29

Hi All,
Newbie here!
I learned how to program in a MSX back in the 80s. Today I work as a Java developer (boring I know). Because I also learned a little bit of C, I started writing programs for MSX in that language. Version 1.20 to be precise.
The question:
Is it possible to call a subrom routine from C (I am trying to stay away from Assembly)?
Basically I want to convert the code bellow into C programming.

;--- REDCLK ------------------------------------------------------------------
;Address  : #01F5
;Function : Read clock-RAM
;Input    : C  - clock-RAM address
;                xxBBAAAA
;                  ||++++-- address
;                  ++------ Block-number
;Output   : A  - Read value in lowest four bits
;Registers: F

REDCLK	equ	01F5h

			public RdClck
			
			extrn  _CALSUB

RdClck:	ld 	c,a
			ld 	ix,REDCLK
			jp 	_CALSUB
			
			end

Thanks!

Van ericb59

Paragon (1058)

afbeelding van ericb59

25-06-2020, 10:13

Hello,

melovitor :
Calling Bios, Subrom, must be done from ASM. Once you made your ASM function you can call it from C.
But it depend where you com from. If you are using MSX-DOS, you must do Interslot calls.

Di you know about FUSION-C the Free MSX-DOS library for SDCC
https://www.ebsoft.fr/shop/en/19-fusion-c

Van DarkSchneider

Paladin (942)

afbeelding van DarkSchneider

25-06-2020, 10:24

But remember that the SUBROM must be called in a special way in MSX-DOS/2 environment, that is the used one by TPA programs (.COM) compiled with C usually. Can read here:
http://map.grauw.nl/resources/subrom.php
That links to:
http://map.grauw.nl/sources/callbios.php
That is the official routine, but I think it would be much better to load it permanently into memory at page 3 (as always must be available because it uses interrupts).

Van melovictor

Supporter (5)

afbeelding van melovictor

25-06-2020, 12:54

ericb59 wrote:

Hello,

melovitor :
Calling Bios, Subrom, must be done from ASM. Once you made your ASM function you can call it from C.
But it depend where you com from. If you are using MSX-DOS, you must do Interslot calls.

Di you know about FUSION-C the Free MSX-DOS library for SDCC
https://www.ebsoft.fr/shop/en/19-fusion-c

Hi Eric,
Yes, it is already being called from a C program (I extracted it from a program I found somewhere o n the internet - cTime). Really I was just trying to see if I could write everything purely in C). Apparently not possible. Yes I am aware of FUSION-C and have downloaded it already but I am only using it as reference because I am playing with MSX-C 1.2 and DOS2.

Van melovictor

Supporter (5)

afbeelding van melovictor

25-06-2020, 13:08

DarkSchneider wrote:

But remember that the SUBROM must be called in a special way in MSX-DOS/2 environment, that is the used one by TPA programs (.COM) compiled with C usually. Can read here:
http://map.grauw.nl/resources/subrom.php
That links to:
http://map.grauw.nl/sources/callbios.php
That is the official routine, but I think it would be much better to load it permanently into memory at page 3 (as always must be available because it uses interrupts).

Hi DarkSchneider,
Easy on me... I am a newbie...
I am intrigued by the fact that the code I posted does not look anytinhg like the code suggested by ASCII in the callbios link. Is that some sort of generic function call that I should wrap from a C program and pass the parameters as needed according to the SUBROM routine I want to call? Could you elaborate on that for me? I am very bad at ASM...
Thanks!

Pagina 55/57
48 | 49 | 50 | 51 | 52 | 53 | 54 | | 56 | 57