News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Arnaud

How convert CPC memory address to screen coordinates

Started by Arnaud, 18:53, 02 October 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Hello,
i need a little help to convert CPC memory address to PC window screen coordinates.

Ex : 0xC0EB the byte is at (1,16) (i think)

But i wasn't able to create a formula from the table "Video memory starting location for all pixel lines" of CPCTelera documentation.

Thanks

ZbyniuR

After MODE command first byte of first pixel line is start at &c000.
Next pixel line is start 2048 bytes away from start of first line. The same next 6 lines, 2048 bytes away from previous line. But line 9 is start at 80 bytes from first one line. Next one 2048 bytes from line 9 etc. Line 17 start at 160 bytes from line 1.

start line 1 = start address of video memory + 0*80 + 0*2048
start line 2 = start address of video memory + 0*80 + 1*2048
... 3 = ... + 0*80 + 2*2048
... 4 = ... + 0*80 + 3*2048
... 5 = ... + 0*80 + 4*2048
... 6 = ... + 0*80 + 5*2048
... 7 = ... + 0*80 + 6*2048
... 8 = ... + 0*80 + 7*2048

... 9 = ... + 1*80 + 0*2048
... 10 = ... + 1*80 + 1*2048
... 11 = ... + 1*80 + 2*2048
... 12 = ... + 1*80 + 3*2048
... 13 = ... + 1*80 + 4*2048
... 14 = ... + 1*80 + 5*2048
... 15 = ... + 1*80 + 6*2048
... 16 = ... + 1*80 + 7*2048

... 17 = ... + 2*80 + 0*2048
... 18 = ... + 2*80 + 1*2048
... (...)
... 24 = ... + 2*80 + 7*2048

... 25 = ... + 3*80 + 0*2048

(...) (...)
line 200 (last one) = ... + 24*80 + 7*2048

I hope it's will help. :)
If after MODE screen was scroll, all this is more complicated. :D
In STARS, TREK is better than WARS.

Arnaud

Finally i understood how works this table.

Thanks for help, my function works now.

Powered by SMFPacks Menu Editor Mod