Portability

Requests for features
Post Reply
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Portability

Post by Fabrizio »

Please think of some input/output APIs (conio/ncurses or anything else) to make coding a cross-platform
game/program possible.

By input I mean at least a way to read the keyboard without waiting for it and without the cursor showing up.
By output I mean at least character graphics with no cursor showing up.

I would like to see something like conio implemented as macros to the fastest possible equivalent routines for each target.
I am not in love with conio but they are used in the other two CMOC (for 6809) and CC65 (for 6502)
that together with Z88DK cover 99% of all 8-bit computers. So conio could be a reasonable standard for basic input and output.

Alternatively provide some other common APIs for all Z88DK targets.

Additional nice to have features:
- some non-textual graphical common API
- some common joystick API

Whatever solution is chosen, it should be possible to write simple games for most targets with no extra code and no effort.

Regards

Fabrizio
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Fabrizio, it is probably still unsatisfacrory for you, but some portable graphics game exists. Please look at microman.c, wall.c or dstar.c
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Post by Fabrizio »

Thanks Stefano!

I will look into them!
I hope more portability will be provided in the future.
I mean something like common APIs for basic (e.g., character) input and output for most targets.
For instance character input/output:
1. a common API to directly (no wait, no cursor) read the keyboard input with the same APIs and
2. a common API to write a character if a given color c at x,y (no cursor shown).

These common APIs should use the most efficient implemented method.
conio.h as it is now, is very slow even if better native implementations are available.

Fabrizio
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

My intention was to provide, where possible, the ansi vt emulation and the getk + fgetc-console funtions behaving ideally the same. As you noticed this is a goal still to be reached, but dom recently made the vt option much more flexible and smooth. The vt engine is generic and easily reusable for new ports. A joystick api is available, but some target uses a generic getk based shortcut.
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Post by Fabrizio »

@stefano,
ansi vt seems to me slow. I hope it gets better.

Isn't it used by conio?
If that is the case either conio wrapper code or ansi vt are way too slow to be used for any kind of animation.

Even simple static text is printed by conio very slowly on the screen. You can see subsequent lines being printed with the naked eye. In some cases (e.g., VG-5000) you see the cursor on the screen.

This is the case for the targets I have used so far: Spectrum, VG-5000 and CPC.

So, I am resorting to some native, low level or firmware routines in my ports.

Z88DK is a huge wonderful project.
I am not complaining at all!
I thank you guys for the nice support provided! I am enjoying using it a lot.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

You're right, the text was originally thought for.. text.
Initially it was a slow alternative for my Spectrum to get more vt compatibility (80 columns, odd attributes, full msdos font) on terminal applications eg telnetting windows nt and running msdos'edit.com. the slowness was a problem to deal with..
The z88dk adaptions came years later :)
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Post by Fabrizio »

Maybe my wish was not well expressed:
I meant just common API for character graphics (no scrolling text):
- common API to draw a character at pos x,y on the most common or standard resolution (no scrolling please)
- common API to read keyboard input without waiting
Fabrizio
Member
Posts: 115
Joined: Tue Jul 11, 2017 9:28 pm

Post by Fabrizio »

A game that solely uses character graphics should compile on all targets. This can be done for example through simple macros that point to the best available implementation.


By character-graphics I mean low level calls to whatever is necessary to just display characters without scrolling/buffering.
Post Reply