Graphics library on NC200

Amstrad CPC and NC systems
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Graphics library on NC200

Post by vagant »

Hi,

Is anyone using gfxnc200? I tried drawing something on NC200 using standard graphics library and it is only using 1/4 of the screen. Functions getmaxX and getmaxY are returning 479 and 127 but when I try to draw a line it is only using bottom left part of the screen:
foto1.jpg
foto2.jpg
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 2328
Joined: Mon Jul 16, 2007 7:39 pm

Re: Graphics library on NC200

Post by stefano »

As written elsewhere I'm close to a short holiday in the next week, so I can't check it very deeply.
The library was written quite a long ago, it could be just a matter of sorting the library make process.

If you have a full build environment, you could try by manually deleting all the ".o" files in the in libsrc/target/nc100/ folder and subfolders
Then run "make gfxnc200.lib" in /z88dk/libsrc and move the resulting ".lib" file in /c/z88dk/lib/clibs
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

I will try! I have similar issue also in Z88 where I can also use just 25% of the screen and extending width beyond 64 pixels is messing up the screen. Not sure if this could be connected as it is different library?
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

I'll see if I can run the nc200 example - I'm wondering if it's just using nc100 object files so gets the height completely wrong (no idea on the width at the momen, maybe it's ended up clamped to 256 pixels?)

The z88 is completely different library. On an unexpanded z88 you can't actually open up a map that's wider than 64 px. But who's running an unexpanded z88 these days? examples/z88/dstar.c uses the full map screen - does that work?
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

As Stefano suggested this was due to nc100 object files hanging around the place.
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

I made Z88 working using this thread: https://www.z88dk.org/forum/viewtopic.p ... Z88#p21301 so all is good there but had no luck yet with NC200. Will try to rebuild gfxnc200/
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

stefano wrote: Fri Jul 04, 2025 2:42 pm you could try by manually deleting all the ".o" files in the in libsrc/target/nc100/ folder and subfolders
Then run "make gfxnc200.lib" in /z88dk/libsrc and move the resulting ".lib" file in /c/z88dk/lib/clibs
Tried but to no avail unfortunately... still stuck with 255x64
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

I took gfxnc200.lib from the latest nightly builds, and tweaked showlib3d.c a little (it uses draw and I think that's what you're using?) and created this screenshot:
Screenshot 2025-07-06 at 21.56.04.png
So the fix I applied to build the graphics libraries appears to have worked.

Disassembling the code shows that plot is clamped to 480x128 which is correct.
You do not have the required permissions to view the files attached to this post.
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

Will download the latest build tomorrow morning and try the showlib3d.c - what did you tweak in the showlib?

Thanks
Michal
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

Code I was using follows. Hold down 1 to make the cube bigger and then any other key to redraw - getting a decent screenshot whilst it was refreshing was a bit annoying hence the “hold key down” thing.

Code: Select all

#include <lib3d.h>
#include <graphics.h>
#include <stdio.h>
#include <stdlib.h>


#define MX      240/2
#define MY      128/2

#define MX2     400
#define MY2     64

vector_t cube[8]
= { { -20 ,  20,   20 },
        {  20 ,  20,   20 },
        {  20 , -20,   20 },
        { -20 , -20,   20 },
        { -20 ,  20,  -20 },
        {  20 ,  20,  -20 },
        {  20 , -20,  -20 },
        { -20 , -20,  -20 } };

void main(void)
{
        static vector_t rot;
        static vector_t t;
        static point_t p[8];
        static unsigned c = 0;
        static int i;
        static int zf = 0;

        while(c != 13) {
                c=fgetc_cons();
                switch(c) {
                        case '1':
                                zf -= 10;
                                if(zf < -100) zf = -100;
                                break;
                        case '2':
                                zf += 10;
                                if(zf > 300) zf = 300;
                                break;
                        case '3':
                                exit (0);
                }
                c = 0;
                for(i = 0; i < 8; i++) {
                        ozcopyvector(&t,&cube[i]);
                        ozrotatepointx(&t, rot.x);
                        ozrotatepointy(&t, rot.y);
                        t.z += zf; /* zoom factor */
                        ozplotpoint(&t, &p[i]);
                }
                rot.y = (rot.y+1)%360;
                rot.x = (rot.x+2)%360;
                clg();
                /* top face */
                draw(p[0].x + MX, p[0].y + MY, p[1].x + MX, p[1].y + MY);
                draw(p[1].x + MX, p[1].y + MY, p[2].x + MX, p[2].y + MY);
                draw(p[2].x + MX, p[2].y + MY, p[3].x + MX, p[3].y + MY);
                draw(p[3].x + MX, p[3].y + MY, p[0].x + MX, p[0].y + MY);
                /* bottom face */
                draw(p[4].x + MX, p[4].y + MY, p[5].x + MX, p[5].y + MY);
                draw(p[5].x + MX, p[5].y + MY, p[6].x + MX, p[6].y + MY);
                draw(p[6].x + MX, p[6].y + MY, p[7].x + MX, p[7].y + MY);
                draw(p[7].x + MX, p[7].y + MY, p[4].x + MX, p[4].y + MY);
                /* side faces */
                draw(p[0].x + MX, p[0].y + MY, p[4].x + MX, p[4].y + MY);
                draw(p[1].x + MX, p[1].y + MY, p[5].x + MX, p[5].y + MY);
                draw(p[2].x + MX, p[2].y + MY, p[6].x + MX, p[6].y + MY);
                draw(p[3].x + MX, p[3].y + MY, p[7].x + MX, p[7].y + MY);
                /* top face */
                draw(p[0].x + MX2, p[0].y + MY2, p[1].x + MX2, p[1].y + MY2);
                draw(p[1].x + MX2, p[1].y + MY2, p[2].x + MX2, p[2].y + MY2);
                draw(p[2].x + MX2, p[2].y + MY2, p[3].x + MX2, p[3].y + MY2);
                draw(p[3].x + MX2, p[3].y + MY2, p[0].x + MX2, p[0].y + MY2);
                /* bottom face */
                draw(p[4].x + MX2, p[4].y + MY2, p[5].x + MX2, p[5].y + MY2);
                draw(p[5].x + MX2, p[5].y + MY2, p[6].x + MX2, p[6].y + MY2);
                draw(p[6].x + MX2, p[6].y + MY2, p[7].x + MX2, p[7].y + MY2);
                draw(p[7].x + MX2, p[7].y + MY2, p[4].x + MX2, p[4].y + MY2);
                /* side faces */
                draw(p[0].x + MX2, p[0].y + MY2, p[4].x + MX2, p[4].y + MY2);
                draw(p[1].x + MX2, p[1].y + MY2, p[5].x + MX2, p[5].y + MY2);
                draw(p[2].x + MX2, p[2].y + MY2, p[6].x + MX2, p[6].y + MY2);
                draw(p[3].x + MX2, p[3].y + MY2, p[7].x + MX2, p[7].y + MY2);
        }
}
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

Now we are in the business!

Before I used last night build:
before.jpg
After using fresh build:
after.jpg
And now I can play finally :)
ray.jpg
Big thanks for help!
M
You do not have the required permissions to view the files attached to this post.
User avatar
RobertK
Well known member
Posts: 420
Joined: Mon Feb 26, 2018 12:58 pm

Re: Graphics library on NC200

Post by RobertK »

@dom: I see that you are using MAME for testing, what is the easiest way to load an NC100/200 program there? The wiki is missing this information.

@vagant: That maze game looks interesting!
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

Because it’s small test programs I use the card8k subtype and then load it with -cart

We should be able to create an msdos disc that can be loaded but I’ve not needed it yet.
User avatar
RobertK
Well known member
Posts: 420
Joined: Mon Feb 26, 2018 12:58 pm

Re: Graphics library on NC200

Post by RobertK »

Ok, but is the MAME option really called -cart? Because that one isn't available for the nc200.
In the UI, you can only attach "printout" and "floppydisk", or the slot devices "centronics", "serial", "pcmia" and "fdc".
I'm using the latest MAME 0.278.
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

For me on 0.250 it is:
Screenshot 2025-07-08 at 14.42.24.png
But on 0.255 I can see that it's no longer present and it's been switched to pcmcia with only a couple of ram card options.
You do not have the required permissions to view the files attached to this post.
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

Also interested in MAME - just installed and also trying to upload ROM file. How do you get this File Manager window? TAB is not workng for me? Latest version of MAME 0.278
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

OK, I can open but only such options available:
mame.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

Ah, the nc driver was completely rewritten here: https://github.com/mamedev/mame/commit/ ... b77acbecf5

That's annoying, I'll have to add floppy -subtype.
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

Does it mean there is no cart option anymore? I would prefer to simple run MAME and read the rom file rather than place the file in a disc image and read the disc? In this case it will be quicker to send the file to the real NC200 I guess using RS232 :)
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

There seems to be a way to create bootable nc200 discs. I'll experiment and report back.
User avatar
RobertK
Well known member
Posts: 420
Joined: Mon Feb 26, 2018 12:58 pm

Re: Graphics library on NC200

Post by RobertK »

Ok, I've just downloaded MAME 0.252, and this one still has the -cart option.

How do I run the ROM when it is attached? With the *LOAD command in BASIC, as it is described for the -ram subtype?
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

I use alt-X from the menu to launch the cart.
User avatar
dom
Well known member
Posts: 2319
Joined: Sun Jul 15, 2007 10:01 pm

Re: Graphics library on NC200

Post by dom »

I've just pushed -subtype=floppy and more interestingly -subtype=ncboot options. The latter creates a bootable floppy image that can be launched from the menu using Function+R (LAlt+R).

For reasons that I'm not going to investigate, the floppy image can't be read with Mame250, but does work with Mame252 so hopefully it will also work with the latest.

Let me know how it goes and I'll write it up in the wiki.

Edit: -subtype=ncboot has an issue with graphics - they won't work and may crash the program. I'm working on a fix.
User avatar
RobertK
Well known member
Posts: 420
Joined: Mon Feb 26, 2018 12:58 pm

Re: Graphics library on NC200

Post by RobertK »

dom wrote: Tue Jul 08, 2025 7:31 pm I use alt-X from the menu to launch the cart.
Excellent, that's easy to use with MAME 0.252.

The -subtype=ncboot created floppy image does work with the current 0.278 MAME, although the use of graphics (low-res in my case) currently makes the program crash, as you wrote.

However, the image can't be attached using -flop1 with 0.249, 0.250 or 0.252, it says: "Fatal error: Device 5.25" double density floppy drive load failed: Unable to identify the image format". I wonder if it is a problem that the created image is 720K in size?
vagant
Member
Posts: 25
Joined: Mon Jun 30, 2025 9:33 am

Re: Graphics library on NC200

Post by vagant »

How would you create a floppy format with the file you want to run on NC200?
Post Reply