MSX FUSION-C, Talking about bugs, errors, mistakes

Page 11/12
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12

By ericb59

Paladin (868)

ericb59's picture

09-08-2019, 18:09

Hello Shus,

Yes you are right, Line command can not be used with resolution > 256 pixels actually.
Some other functions too, but i'm working on it by rewriting most of the VDP commands for FUSION-C.

New update is coming soon, (next week I hope).

By sinus

Expert (79)

sinus's picture

09-08-2019, 22:17

Thank you Eric,
I know this project is a work in progress and that the libs keep on improving, nice to know that you're working on graphic libs as we speak. I can tell you they work great already in the present version, at least up to 255 pixels! Wink
Sinus

By ericb59

Paladin (868)

ericb59's picture

10-08-2019, 17:27

sinus wrote:

Thank you Eric,
I know this project is a work in progress and that the libs keep on improving, nice to know that you're working on graphic libs as we speak. I can tell you they work great already in the present version, at least up to 255 pixels! Wink
Sinus

Thank you for your kind words. I 'm trying to make this project the most useful possible for MSX Coders, and keep it alive. :-)

you can see some improvements of the graphic library in this quick test video : https://www.youtube.com/watch?v=Br8Gk9MEQMU

I just finished a new LINE function, now compatible with 512 pixels screen mode. This new LINE function is 30% in C , 70% in ASM. The difficulty is the VDP Line function need to know the lenght and high that must be calculate by a 16bits substraction... And I don't know how to make 16bits substraction in ASM ! *_*

By Grauw

Ascended (8457)

Grauw's picture

10-08-2019, 18:13

and a ; clear carry
sbc hl,de

By zPasi

Champion (471)

zPasi's picture

12-08-2019, 17:45

Did you notice, (in SDCC) when a function only needs one parameter, you could use __z88dk_fastcall.

So, instead of writing crap like

	push ix
	ld ix,#0
	add ix,sp
	ld l,4(ix)
	ld h,5(ix)
; ...
	pop ix

you'll just have the parameter value in hl directly!

One other thing: the interrupt-system ( InitInterruptHandler(), SetInterruptHandler() etc ) does not always work as expected. When your c-program uses any BIOS routine, the runtime makes an inter-slot call. Sometimes the interrupt occurs when the BIOS is switched in. So the BIOS int handler will be called instead.

Also, if your int function uses IsVsync() (like in the sample interrupt.c) it clears the VDP "flag" so the normal MSX int routine does not work properly even when called. And there is not much we can do about it, that's just the way the VDP works.

Maybe there is a better way doing interrupts under MSX-DOS, but I'm not aware of any. The hooks don't seem to work.

By Grauw

Ascended (8457)

Grauw's picture

12-08-2019, 21:34

The H.TIMI and H.KEYI hooks work fine in DOS, and are the preferred way of hooking interrupts if you don’t need extremely quick response, and you don’t if you use C.

You need to place the ISR in memory page 3 (C000h-FFFFh), or do an interslot call, to ensure it continues to work while the BIOS (page 0) or DiskROM (page 1) or any other service routine is paged in.

Alternatively, remove the hook when doing a BIOS or BDOS call (if it’s H.KEYI, don’t forget to also disable the interrupt device). It’s more cumbersome but I think it may be difficult to ensure the C code is in page 3 so probably your best option.

By thegeps

Champion (272)

thegeps's picture

12-08-2019, 23:27

You can also do 16bit subtraction by setting DE as subtrahend in negative form and then adding it to HL (as minuend)

ld hl,100
ld de,-50
add hl,de

Is equal to hl-de-> 100-50

By zPasi

Champion (471)

zPasi's picture

13-08-2019, 15:57

Grauw wrote:

The H.TIMI and H.KEYI hooks work fine in DOS, and are the preferred way of hooking interrupts if you don’t need extremely quick response, and you don’t if you use C.

You need to place the ISR in memory page 3 (C000h-FFFFh), or do an interslot call, to ensure it continues to work while the BIOS (page 0) or DiskROM (page 1) or any other service routine is paged in.

Of course! Now that is obvious, when you wrote that. I think page 2 (8000h-BFFFh) should also be safe?

Well, for now, I'm using my own interrupt-setup thing, and avoid using BIOS when using that. But what you suggested is also possible, because currently I use interrupts for music / fx player and current frame tracking only. Could just load the asm code to a fixed address. No need to call C-code from there, but, even that could be done if needed.

By Grauw

Ascended (8457)

Grauw's picture

13-08-2019, 16:52

zPasi wrote:

Of course! Now that is obvious, when you wrote that. I think page 2 (8000h-BFFFh) should also be safe?

No, the common two (BIOS and DiskROM) are in pages 0 & 1, but afaik MSX-DOS2 uses page 2 as well when loading. Also inter-segment writes use page 2. And you don’t know what other extension is present that may switch out page 2 on some hooks.

By zPasi

Champion (471)

zPasi's picture

31-08-2019, 22:15

I've made some progress. I have a small routine that I'll copy to somewhere in page 3, and hook on H.TIMI. That routine makes an interslot call to a handler that is located anywhere in RAM, and can be written in C or ASM. Seems to work well.

Page 11/12
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12