Page 10 of 10

Re: SCREEN1 = SYSVAR @ JSROM

Posted: Sun Jan 12, 2020 1:26 pm
by tcat
Hi,

Completed stipple patterns, now thinking about relative versus absolute address pointers. My code works with relative so far, e.g. this just stores DOT element, x,y - coord, c - colour.

Code: Select all


210 REMark off - relative offsets, gfx - graphics memory store, top - last offset, ptr - address pointer
220 off=ALCHP(255*2): gfx=ALCHP(2*1024): top=0: POKE_W off+top,4
...
2330 DEFine PROCedure StoreD(x, y, c)
2340  LOCal ptr
2350  ptr=PEEK_W(off+top)+gfx
2360  POKE ptr,CODE('d')
2370  POKE ptr+1,x: POKE ptr+2,y
2380  POKE ptr+3,c: POKE ptr+4,-1
2390  POKE_W off+top+2,PEEK_W(off+top)+4: top=top+2
2400 END DEFine StoreD
Using this scheme I can always delete last element from the store, thus undoing the last piece of draw, without much complication of the code. However reordering of elements is done easier with absolute addresses, as it is just pointer swapping.

So perhaps I may build up relative offsets only on load and save operations, while keeping absolute pointers internally for easy editing?

Tomas