z88dk / z88dk

The development kit for over a hundred z80 family machines - c compiler, assembler, linker, libraries.
https://www.z88dk.org
Other
898 stars 170 forks source link

(classic) Graphics should work in any mode #1274

Open suborb opened 4 years ago

suborb commented 4 years ago

To the end-user it should be transparent - so we should by default link in drivers for all available screen modes - these can be pruned out manually using pragmas.

The following have already been done:

The following haven't been done:

The following won't be done:

suborb commented 4 years ago

~It looks like I changed the semantics of pixeladdress for several ports with the result that the generic putsprite/stencil no longer work: I had the screen address being returned in hl rather than de.~

I did, but putsprite2 is a better option for those machines since we've got mode switching - I can't get putsprite3 to work it seems

zx70 commented 3 months ago

I'm possibly colliding a little here, I just sorted out the TS2068 library to gain speed. I noticed only in a second moment that "@target/ts2068/gfx2068hr.lst" was not in the loop anymore and that it was replaced with "@target/zx-common/timex_zxn_graphics.lst".

I'm re-including gfx2068hr, putsprite() and clga() are noticeably faster. My new rework on clga() evolved it to clga_callee() making it a valid customization of the "wide graphics" library set, no need of the retrofit trick. Sorry for any inconvenience, I think it could be an interesting improvement for the zxn target, too.

zx70 commented 3 months ago

I think it is now fixed. New MODE6 specific code for clga(), xorclga() and fillb(), fat pixels are supported. Currently some game runs faster in MODE6 with fat pixels than in MODE0 ! Adding code optimized for MODE0 requires a lot of redundant code,I think it is better to leave it on the classic ZX Spectrum library only.

I noticed that the attribute specifiers like: -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0x3e ..are kept it the __zx_screenmode variable. I'm masking it out with "and 7" but I noticed doesn't happen elsewhere in zx_common, also the CLIB_ZX_CONIO32 mode fails.

zx70 commented 3 months ago

Faster putsprite() on MODE0 and MODE6. It is an halfway integration, stencil_render() can probably donate the whole colour and video addressing support for all the video modes.

zx70 commented 2 months ago

I've finally sorted out some of the generic HR graphics functions in wide mode. The main impacted files are: w_stencil_render, w_clga_callee_smc, w_xorclga_callee_smc, w_fill_callee_smc, w_putsprite (w_putsprite is SMC code too, the filename is the historical one).

They are all require w_putsprite() and the usual horizontal bytes display arrangement but they are generic enough to run on all the VEB KC85 computers family, featuring different fancy video memory address maps.

This new code logic allows a quick optimization which can be easily put in the target specific folder, in example, supposing we have adiacent horizontal bytes:

` PUBLIC __generic_w_incx SECTION code_graphics

__generic_w_incx: inc hl inc de ret `

zx70 commented 1 month ago

The latest pull merges the "next column" code originally in stencil_render() reusing it on w_putsprite.

The subroutines mention "MODE6", which is not totally right, but it happened because I'm splitting the improvement in small tasks. At this stage we have two parallel subroutines to move to the next column in the video memory .

w_putsprite with the introduction of color support now has an out of range problem on the rightmost edge when in mode0, probably the loops need to be trimmed