Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.sinclair > #4928

Re: The Hobbit - Vector Graphics Disassembly?

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Volker Bartheld <news2020@bartheld.net>
Newsgroups comp.sys.sinclair
Subject Re: The Hobbit - Vector Graphics Disassembly?
Date Mon, 1 Feb 2021 10:55:50 +0100
Organization bartheld.net
Lines 71
Message-ID <1q4srjvb453qu.dlg@news.bartheld.net> (permalink)
References <18bn03l2y4afo.dlg@news.bartheld.net>
Mime-Version 1.0
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding 8bit
X-Trace individual.net nO+5KX863fbTItIotf15eQ28PZiYFIYv+anTEa/+1/p455G0RN
Cancel-Lock sha1:Aafvw31mmKIZC5YmcSMlfogA2H4=
User-Agent 40tude_Dialog/2.0.15.41
Xref csiph.com comp.sys.sinclair:4928

Show key headers only | View raw


Addendum:

On Fri, 29 Jan 2021 23:04:46 +0100, Volker Bartheld wrote:
> Somewhere in my stash is a recursive fill algorithm I wrote decades ago
> (was quite fast but with a quite hefty memory footprint)

I ran across a version of the scanline flood fill by John Metcalf
http://www.retroprogramming.com/2017/04/zx-spectrum-scanline-flood-fill.html
that is quite cool and a little easier on the memory side.

To make it work with tniASM [1] (which I highly recommend) and Bin2Tap [2]
to use from Sinclair Basic, just change the initial code to

%include "compat.asm"
fname "floodfill.bin"

ORG     EA60h

  ld hl,(5b00h)
	push hl
	pop de

, then

10 CLEAR 59999
20 LOAD "" CODE 60000
30 CIRCLE 128,96,40
40 POKE 23296,128
50 POKE 23297,96
60 RANDOMIZE USR 60000 

For a pattern fill my best guess would be to create an empty screen buffer
somewhere and also fill this "shadow copy" of it, which could be done by
changing that section of the code:

goright:
  call scrpos
  jr z,rightedge
  ld (hl),a

to

  ld (hl),a
  PUSH AF
  PUSH HL
  EXX
  POP HL
  POP AF
  ld (hl),a
  EXX

(you might get away with using the IX register instead of swapping the set
and call scrpos must be adjusted as well, but you get the point).

You then end up with only the filled portion (not the outline and the rest
of the image) in your buffer. You can then XOR your UDG (=fill pattern)
over it, using a modified version of the print routine in ROM. Then you
would XOR the buffer over to the screen area and voilá: Pattern fill.

Color can be added by calculating the location in the ATTR area (check out
the PO-ATTR entry point in the ROM for pointers [3]) and update it on
every plot.

Needs 6144 bytes extra (256*192/8) and is probably not very fast either.

Greets,
Volker

[1] http://www.tni.nl/products/tniasm.html
[2] https://sourceforge.net/p/zxspectrumutils/wiki/bin2tap/
[3] http://primrosebank.net/computers/zxspectrum/docs/CompleteSpectrumROMDisassemblyThe.pdf

Back to comp.sys.sinclair | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The Hobbit - Vector Graphics Disassembly? Volker Bartheld <news2020@bartheld.net> - 2021-01-29 23:04 +0100
  Re: The Hobbit - Vector Graphics Disassembly? Volker Bartheld <news2020@bartheld.net> - 2021-02-01 10:55 +0100
  A colored pattern fill algorithm for the ZX Spectrum (was: The Hobbit - Vector Graphics Disassembly?) Volker Bartheld <news2020@bartheld.net> - 2021-02-05 01:04 +0100

csiph-web