CPCWiki forum

General Category => Programming => Topic started by: cpcitor on 08:10, 20 December 14

Title: A programming library that displays a CPC screen's content.
Post by: cpcitor on 08:10, 20 December 14
Hello all, happy Christmas.

I thought there was a library that you can use on a modern OS (typically SDL-based) that could display some memory portion just like the CPC "MODE 0" "MODE 1" and "MODE 2" would.

That's useful when writing software in C for the CPC on a PC and running the code as regular PC code. One benefits from all the modern comfort (C-level debugger etc). This library would allow to see what's on the screen, too. :-)

The library would just need to be informed about memory area, mode and palette and that's it. Just a matter of a few function calls. I'm not talking about cycle-accurate die-hard demo raster etc, that definitely needs a full emulator.


This assumes that enough code is in C so that this becomes interesting. That's how I program anyway. :-)

But I can't find such a library.




Why cross-programming from a more powerful platform ?

Doom was cross-programmed on NeXT workstations, under the NEXTSTEP operating system (ref. Development of Doom (http://en.wikipedia.org/wiki/Development_of_Doom#Programming)).

Why writing portable C code ? Won't it hurt performance ?

Doom was originally written in reasonably portable C, with only about 200 lines of DOS-specific assembly to draw horizontal/vertical lines of pixels.

Running sloccount on ftp://ftp.idsoftware.com/idstuff/source/doomsrc.zip (http://ftp://ftp.idsoftware.com/idstuff/source/doomsrc.zip) yields:

SLOC   Directory   SLOC-by-Language (Sorted)
36293   doomsrc         ansic=36103,asm=190


You might consider this interesting article about Doom3 source code: The Exceptional Beauty of Doom 3's Source Code (http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code). Id practiced some simplifications that are considered evil in a pure general context but are actually good for high-performance and code readability.




I nearly remember seeing some web page a few years ago describing such a CPC screen library.
Does such a cpc screen lib exist or has my memory flipped some bits ?
Title: Re: A programming library that displays a CPC screen's content.
Post by: cpcitor on 08:28, 20 December 14
Here is what I found closest to what I describe:

* a tool that read a file and displays it using SDL cpcVideo - cpcsdk - CPC file viewer and video effects prototyping engine with (https://code.google.com/p/cpcsdk/wiki/cpcVideo) . Does a lot of other things and is an executable not a library,
* but it appears to use a library written in C++ /trunk/cpctools/tools/cpcVideo/libVideoCPC/ - cpcsdk - Collection of tools for (https://code.google.com/p/cpcsdk/source/browse/trunk/cpctools/tools/cpcVideo/libVideoCPC/)

If that library is suitable I might write a C wrapper for it suitable to be called from a portable C code when it runs on the PC.

If you have any other idea or suggestion you're welcome to share.  :)
Powered by SMFPacks Menu Editor Mod