3 bitplanes
yu Alone Coder
I came up with a clever algorithm that on a standard screen can
output 3 bitplanes with any shifts relative to each other (with
in 2 pixel increments).
In theory, you need a megabyte of memory for this task, but you can limit yourself to
128K. We have bitplane maps in pages (or in one page) and
4 different horizontal graphics shifts on different pages. Maps
each bitplane also needs 4 to provide any shift along
verticals.
The top bitplane is first viewed, and based on it in the stack
a sequence of calls is constructed to output it. In addition,
a bitmap is built that describes what is covered by the foreground, and
that no. Then the average, the table is adjusted (familiarity,
which are covered by the top are not processed). Then the bottom one
(familiar places that are closed by the upper and middle ones are not
processed). Then the output procedures are called on the stack
order bottom, middle,upper. The problem is that the output
should go exclusively to the 0th screen (since the graphics are in
pages). And at the same time, the update process will be visible, even if
process all 3 bitplanes in each line.
Opaque familiar places (always 768) take 113 to process
clock cycles + in the output 201 clock cycles.
Transparent familiar places (about 100, only in the upper
bitplans along the perimeter of objects) = 110 + 345.
All other familiar places are unused (transparent or
not covered by overlying bitplanes) = 67 (on the upper bitplane
60) + 24.
Total approximately 240000 + 46000 + 129000 = 415000 clock cycles (8 fps per
non-turbo).
For comparison, LDIR of three screens (without overlay at all) would take
387000 cycles.
middlelayerloop:
ld a,(de) ;busy in bitmap? 0/#ff
and (hl) ;transparent inбитnланe?
jnz middlelayerused:
push af ;#0054
push af ;#0054
dec l
dec l
inc e
jp nz,middlelayerloop
middlelayernextline:
inc d
ld a,d
ср `конец_биткарты
jnc middlelayerloop
ret
middlelayerused:
ldb,a
dec l
ld с,(hl)
dec l
push ьс
ср `maskedgfx
jnc middlelayermasked
хог a
ld (de),a ;занято в биткартe
ld a,`A1
push af ;#ххЧЧ
inc e
jp nz,middlelayerloop
jp middlelayernextline
middlelayermasked:
ld ьс,A2
push ьс
inc ejp nz,middlelayerloop
jp middlelayernextline
#0054:
рор af
inc e
ret nz
jp slice
A1:
рор hl
dup 8
ld a,(hl)
inc l
ld (de),a
inc d
edup
org $-1
ld d,binc e
ret nz
jp slice
A2:
рор hl
dup 8
ld a,(de)
and (hl)
inc l
хог (hl)
inc l
ld (de),a
inc d
edup
org $-1
ld d,b
inc e
ret nz
slice:
ld a,d
add a,8
ld d,a
ld b,a
Wed #58
ret with
QUIT:
You can add separate branches for pure black and pure white
familiarity (winning 88 clock cycles on the output of each, but losing 14
clock cycles for each of 768+~100 middlelayerused passes).
Good acceleration - familiar spaces 8(X)x16(Y), but then you need 8 cards
for each bitplane, not 4.
Different implementations for games and demos. In the demo you can calculate the time
drawing each frame and somehow defeating the beam due to this. B
You can't do this in games. In addition, sprites are needed, and for them
you need to select the whole layer. Moreover, the graphics of all the shiftssprites
must be on the same page (4K graphics including
mask). And sprites cannot overlap each other. You can
make a shadow screen, play 70,000 ticks on it (but
win 40,000 ticks of transparent familiarity in the sprite layer) and
12K lower memory (LD:PUSH, cleverly sorted to
make a shadow screen, play 70,000 cycles on it (but
win 40,000 ticks of transparent familiarity in the sprite layer) and
12K lower memory (LD:PUSH, cleverly sorted to
display there by inc h) - you can occupy the 0th screen with this code. Or
90000 cycles and 7K (POP:PUSH). But the screen will update
entirely, and you can overlay sprites, inscriptions on top of them, etc.
But will the game be spectacular in black and white? Most likely not. Need color
to the point. But there, you probably need to draw not with familiar places, but
long continuous vertical lines. In color per point
theoretical minimum time (1/2 pop de:ld (hl),e/d:inc h *
24576) ~ 400000 cycles (8 fps in turbo). And this is the case
graphics are NOT on the page. What if from the page via a chunk buffer?
(maximum size 224*128), then an extra 160768 clock cycles. Again
should I do it interlaced? (up to 224*192). Interlaced - not for games.In Livingstone 2 and other games on the same engine there were about 5
fps, familiar, in color.
How to step over #3dxx, which is buggy on Pentagons with the old one
firmware? You can fill it out as usual
(...,#Зсхх,#3dxx,#3exx,...), then output the data from there to
screen with external pin.
Share your thoughts about the article