News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

WinCPCTelera simulate the video offset with R13 register

Started by Arnaud, 20:43, 02 March 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
i'm trying to simulate correctly the video offset applied with the R13 register.

To understand how it works, i used the cpctelera example (tilemap_hwscroll) and i keep only the part of code with the cpct_setVideoMemoryOffset.

[attachimg=2]
In this picture the offset = 2

As you see in the red rectangle, there's an offset of 8 pixels on Y axis.
So in my wincpctelera code, i tried to simulate this offset directly in my image buffer, with a move of 8 pixels to the top of the part of image.

But if it works for the cpctelera example, it doesn't works for the game "Fitzroy and the power wells" Fom Awergh:
[attachimg=1]
The offset simulated is present and create an image cut off.

It seems i have not understand how works this R13 register and how code it.

How works the R13 register ? Is a simple offset applied on memory start ?

Thanks,
Arnaud.

Ast

If you use a hud, you need to make a splitscreen.
If you don't do that, all your screen will scroll.
I don't really know cpctelera and i can't tell you if 
it's possible to split your screen.
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Arnaud

Some context explanation are missing in my message.

WinCpcTelera in a implementation of the API of cpctelera (C lib for SDCC) for Windows (https://github.com/Arnaud6128/wincpctelera).
The goal is to compile the same C sources of cpc game code under Windows environment (with Visual C++ for example) and have a Windows executable.

In the previous example, the first picture is from the emulator, an image with an offset of 2 on R13, it's what i'm trying to simulate in my own windows code.

The second picture in from the windows executable with my own implementation of the cpctelera function cpct_setVideoMemoryOffset (http://lronaldo.github.io/cpctelera/files/video/cpct_setVideoMemoryOffset-s.html) and we can see a problem because the screen is misaligned.

Then i'm trying to understand how the R13 modify the screen displayed in order to integrate this functionality in my own code.

Here some  pictures to help me to understand :
[attachimg=1]
If this is simplifed memory of the video CPC

[attachimg=2]
it's how i understand how is applied the offset of 2

I know the video memory on CPC in non linear but it's for understand.



Powered by SMFPacks Menu Editor Mod