z88dk / z88dk

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

(classic) KC and ZX81 (384 rows) graphics not fully ix independent #2564

Closed zx70 closed 3 months ago

zx70 commented 3 months ago

The KC target required the ixiy workaround. I recently adjusted the w_draw calls which were we bound to the 'narrow' portable versions rather than the 'wide' ones.

We still need to adjust the stencil calls, e.g. w_stencil_add_side is still bound to the w_line->w_line_r.

zx70 commented 3 months ago

I managed to refresh w_line_r to use a single index register, apparently it is the only function using IY (-ixiy eventually does the swap). I'm saving the value in the bss_graphics section, I think it is correct ?

This probably fixes also new the ZX81 library in 384 rows mode.

suborb commented 3 months ago

Yeah bss_graphics is the right section since it'll be shunted up high as necessary for some targets.

I thought +kc was using the compiled C implementation of the drawing primitives to avoid the index register issues.

zx70 commented 3 months ago

I thought +kc was using the compiled C implementation of the drawing primitives to avoid the index register issues.

It was doing it in most of the cases, but the stencil part calls wline* directly and skips the portable primitives.

For what I could see we had only one file in the 'wide' folder dealing with IY, I thought it was worth to changing it.

suborb commented 3 months ago

It was doing it in most of the cases, but the stencil part calls wline* directly and skips the portable primitives.

Ah.....I missed that path.

zx70 commented 3 months ago

The new wide-rez optimized code fits perfectly on the Microbee :) I know I'm ignoring the color attributes topic but they'd be too many changes at once for me.

I could restore the original library on the KC85, I think the only IY dependent routines were the line and perhaps the circle drawing ones.

zx70 commented 3 months ago

The new clga() etc optimized code runs very well on the Microbee.

w_stencil_render can be probably replaced with the new one, it contains unfinished opts: https://github.com/z88dk/z88dk/blob/6168e808601c14bc693c882472df5cec1f06063c/libsrc/target/bee/graphics/w_stencil_render.asm#L207

(w_pixeladdress is what the memory banking mess just above is trying to avoid).

EDIT: the new w_stencil_render is not enough generic to work in this configuration, this thing must stay. It performs well by the way.

zx70 commented 3 months ago

@suborb , I have a question regarding the colour attributes. If Inunderstood correctly they are inherited by the graphics from the same value of foreground+background used in the console text, right? supposing it affect plot() it should be applied to all the graphics functions, like putsprite() is it correct?

suborb commented 3 months ago

Yes, that's right, it was easiest to take the attribute value from there.

It should affect all graphics functions yes.