News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

[CPCTelera] Overscan

Started by Arnaud, 10:04, 27 March 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
i'm trying to display an image in overscan and of course something goes wrong  ::) .

I converted my image with convImgCpc 0.14 in overscan with default values (96x272).
I configured the CRTC in order to set 32k video at 0x8000, disabled firmware and move stack to 0x8000

Here a picture of the problem, there are black lines in the middle of the screen :
[attach=2]

When i filled memory at 0x8000 to 0xBFFF and 0xC000 to 0xFFFF with two colors it's not symetrical and i don't understand why.
[attach=3]

Here an extract of my code :
void main(void) {
    cpct_disableFirmware();
    cpct_setStackLocation((void*)0x8000);
    cpct_setVideoMode(0);
       
    SetCRTC(CRTC_R02, 50);
    SetCRTC(CRTC_R07, 35);
    SetCRTC(CRTC_R01, 48); // 96 CARA
    SetCRTC(CRTC_R06, 34); // 34*8 = 272 LINES
    SetCRTC(CRTC_R12, 0x2C); // Set video 32k from 0x8000

    cpc_UnExo(G_overscan, (u8*)0x8000);
   while (1);
}


Thanks and Happy easter  ;)

arnoldemu

#1
@Arnaud, This is normal. I often compensate for this by changing the address of the screen so that the problem is on the left side of the screen. This also makes it easier for drawing sprites over this problem area.

Now I found two values that work well depending on width of screen:

// 0x0188 for 46 wide. 0x01a0 for 48 wide
#define SCR_BASE 0x0188

Now you can locate your code at around &8000 and with disabling firmware you can use it all the way up to &ffff.

You may ask why are they not symetrical? Well it's how the CPC decodes the screen. There is max 2048 bytes per line. This is not divisible by the screen width, so this problem happens. So adjust the base of the screen so the problem is moved . The screen is 22KB so we can do this ok.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Arnaud

#2
Thanks @arnoldemu

Is the modification to do ?

cpc_UnExo(G_overscan, (u8*)0x8000 + SCR_BASE);
...
SetCRTC(CRTC_R12, 0x2C); // Set video 32k from 0x8000
SetCRTC(CRTC_R13, SCR_BASE); // Offset
...


Edit :
With SCR_BASE = 0x1FF it's almost good :) , there's only a little glitch at the left part
[attach=2]

arnoldemu

You will need to re-output the screen I think (not sure how it's possible to set screen position in convimgcpc).

Your code is almost correct. The screen base is the byte address for crtc it needs to be divided by 2. This should be more correct.

When I used overscan with C I used my own tools to output the screen and my own C libraries.


SetCRTC(CRTC_R12, (SCR_BASE>>9)+0x02c); // Set video 32k from 0x8188
SetCRTC(CRTC_R13, (SCR_BASE>>1)); // Offset
...

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Arnaud

Quote from: arnoldemu on 11:53, 27 March 16
You will need to re-output the screen I think (not sure how it's possible to set screen position in convimgcpc).

That means i can't ajust exactly my picture ?

arnoldemu

Quote from: Arnaud on 20:57, 27 March 16
That means i can't ajust exactly my picture ?
It seems this way.

I looked at convimgcpc. On my laptop the display is too tall and I can't resize it. I did move the window to see if there is a method to define it but I didn't see one.

I tried to build it from source but only found v0.4 and it didn't compile with visual studio 2013.

I will ask demoniak about it.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod