My original Sam only had 256K. And it really annoyed me later on when
half the stuff on Fred wouldn't work, without warning. I think
Gamesmaster programs were the worst offenders — you'd get the game
clearly working, but with a bunch of monotone grey blocks moving
around instead of the real graphics.
Anyway, I think you're probably right that it makes more sense to
attempt a slow Freescape-style adventure than a fast game. I've
written a whole bunch of emulators that have a z80 core, but I've
never written a substantial z80 program so trying to go all out on
speed isn't realistic. Plus, it's an area that has otherwise been
neglected in the Sam's library and it's a neat fit with my current PC
project.
Anyway, I've had a reasonably productive evening and have eight points
demarking a cube spinning on screen, suggesting that my initial 8.8 x
8.8 -> 8.8 implementation works, that my sine & cosine tables have
come out correctly formed and that what matrix code I have (just two
functions — one to construct a camera matrix from the player's
position and their view rotation in Euler angles, and one to apply the
calculated matrix to points) is functional. I haven't implemented a
divide yet, so there's no perspective. And what I have already takes a
shocking ~105,000 cycles (measured empirically, using the Sim Coupe
debugger) to completely draw a frame. But it's all first go code, so
that probably isn't so bad.
Hopefully I'll get a chance to do some more work sometime this week. I
won't bore everyone with regular updates, but I'll certainly come back
with a video if I get as far as anything graphically interesting, or
if I encounter any problems I can't solve.
On 8 Apr 2008, at 19:19, Colin Piggot wrote:
Thomas wrote:
like only using 4 colours and using
palette switching so that the frame buffer only needs to be 'cleared'
every fourth frame. Or only a quarter needs to be cleared each frame,
if you prefer.
What I did on Stratosphere to clear the previous frame was to draw
over the
previous set of vectors. What I did when a frame was drawn was to
store all
the line co-ordinates in a table, and then when clearing simply rattle
through the table and draw over the lines with palette 0 and not
bothering
about pixel accuracy, just clear the full byte. Far quicker than
attempting
to clear the whole game area.
Attempt at "low framerate" 3d (with Freescape-style interaction).
Obviously I've just been studying the Freescape engine, but I don't
think it's the optimal way of doing things on the Sam — 3d graphics
are a classic time/space trade-off and the Sam has at least 5 times
as
much RAM as the old Spectrum 48 kB,
Easier to ignore programming for the 256K SAM if that's what you
thinking
with 'at least 5 times', always just assume the machine has the full
512K
memory as that's what the sheer majority of software was written to
use.
Although saying that, 256K memory upgrades still sell so there is
probably a
fair few machines still tucked away with just 256K.
In reality, I'll probably just think about it all for a long time and
do nothing. But I'd love to hear other's comments/thoughts in case I
do manage to push through.
Oh don't say that! Give it a go if you have the time :)
Out of the two ideas you came up with, I think the 2nd option - a
freescape
sytle system - with coloured solid walls in MODE4 would look really
spectacular and would be something new on the SAM.
Incidentally, what are good timings for multiply and divide on a z80?
If I can stick to something relatively compact like 8.8 fixed point
then multiplication doesn't seem to be a problem as I can just use
one
of those (x^2)/4 table solutions reducing it all to a couple of table
lookups and two or three adds and subtracts, but dividing looks like
it'll eat quite a few cycles.
I used a lot of data tables and 8.8 fixed point maths on
Stratosphere, and
was going to do the same with Chrome. I'll have to hunt out old
routines and
see what I did come up with back then.
Colin
======
Quazar : Hardware, Software, Spares and Repairs for the Sam Coupe
1995-2008 - Celebrating 14 Years of developing for the Sam Coupe
Website: http://www.samcoupe.com/