pouët.net

Any 6809 tips for 3D

category: general [glöplog]
 
Its seems to me the 6809 was much less used in computers, of course there is the coco/dragon and a few japanese machines. The Vectrex too, which is what I have been messing with :)

I'm wondering if anyone has any ideas on how the cpu can be best used, I'm thinking mainly that it has some 16bit functionality and a hardware unsigned MUL. But how could this be used to get some 3D maybe combine the MUL with the use of tables?
added on the 2016-08-04 11:43:03 by mikiex mikiex
Don't forget the French Thomson machines!

In particular, 3D on 6809 makes me think of http://dcmoto.free.fr/programmes/anima-3d/index.html for which the source is available: http://pulkomandy.tk/projects/thomson/browser/Thomson/code/3rdparty/sources2-hcl /ANIMA3D.ASM
wanting to do the exact same thing so watching for tips
added on the 2016-08-04 13:26:13 by Fell Fell
mikiex, did you see this?
added on the 2016-08-04 13:39:59 by Fell Fell
@Fell I did see that a while ago , I did find the doc a bit confusing to what he was doing.

It doesn't look quite what I am looking for, I have an idea to make a 3d engine that only has rotation in one axis and has perspective + clipping.
added on the 2016-08-04 16:51:09 by mikiex mikiex
@PulkoMandy looks interesting, maybe there is more Thomson stuff... I have seen a couple of good raycasters around also...
added on the 2016-08-04 16:55:44 by mikiex mikiex
Roids has a couple of tricks:
http://www.6809.org.uk/dragon/demo/
added on the 2016-08-04 18:50:20 by g0blinish g0blinish
Interesting topic, I've been thinking about this myself!
If I've read the specifications correctly, the MUL instruction is 11 cycles, which I guess faster than any of the methods commonly used on 8-bit CPUs which lack multiplication, meaning that the 6809 should be able to do 3D rotations way faster than comparable systems.
However, I don't know if the fact that the MUL is only working on signed values could become a problem? Normally for 3D rotations you work with signed values, so I would guess you would have to compensate for this somehow.
added on the 2016-08-04 22:00:02 by Sdw Sdw
Sdw: i guess your first "signed" should have read "unsigned" -> shouldn´t this be workaroundable via some negativeFlag? Oh, wait, extra-stores&reads...i see.
Isn't signed and unsigned multiplication fully equivalent bit-wise, assuming you don't care about overflow?
added on the 2016-08-04 22:52:52 by FreeFull FreeFull
yep... and if you use an unsigned sin table in your ROM, happy days, very little of yer standard transform/project method actually needs to change.
added on the 2016-08-04 22:57:33 by Fell Fell
to ebay I go, vectrex bidding like a pro
added on the 2016-08-04 22:58:49 by Fell Fell
I thought the unsigned MUL does work as signed... but then I have not fully tested that.
But then I have seen a 6809 routine (A) signed 8bit * (B) unsigned 8bit = signed 16bit

If A is positive it just MUL
If A is negative it made A positive, then MUL, then make the result negative.
added on the 2016-08-04 23:45:18 by mikiex mikiex
Also would it be better to use Log tables, I've not looked into them enough and not seen enough examples of use to understand exactly how they are used:
6502 example : http://codebase64.org/doku.php?id=base:8bit_logarithm_table_generator_routine
added on the 2016-08-04 23:54:41 by mikiex mikiex
Lets narrow this down, how to do the fastest 3d projection on the 6809 ??
added on the 2016-08-04 23:56:47 by mikiex mikiex
Aww yissss, this will be a fun thread I can tell :) Hopefully I'll have some code to share soon, am supposed to be working on... other things ;)
added on the 2016-08-05 00:24:01 by Fell Fell
first off. an simple 3d to 2d-projection formula looks like this:
(where x' and y' are screen coordinates, while x,y and z are object or world-coords)

Code:x' = scalex * x / z y' = scaley * y / z


scale is the field of view and can be found by:

Code:scalex = xres / tan(xang / 2) scaley = yres / tan(yang / 2)


i suppose you could narrow it down to log-table lookup. maybe you dont even need the scale(?) or you could just use one pow2 number for that in case of bit-shifting.
added on the 2016-08-05 00:40:44 by rudi rudi
Hardy: Yes, exactly the 6809 mul is specified as working on *unisgned* values, not signed, that was a typo by me.

FreeFull: Having done some tests, it seems like it actually is exactly equivalent, yeah!
I hadn't even thought that it might be so, since the datasheet specifically stated "unsigned multiplication", I assumed there would be a difference compared to signed!

Then it should be possible to do at least the rotation part of the 3D stuff quickly.
The projection is a bit worse since we have a division there, perhaps a workaround could be done with a table of (1/z) values and then doing:
x'=x*zinvtab[z]
y'=y*zinvtab[z]
added on the 2016-08-05 17:30:20 by Sdw Sdw
Sdw

You mean similar to this:
http://codebase64.org/doku.php?id=magazines:chacking8
search for "Implementation: Projections" on that page
added on the 2016-08-05 20:23:12 by mikiex mikiex
You want 6809 tips for 3D? That's a very specific number of tips that you want ;-)
added on the 2016-08-06 12:01:09 by xeron xeron
the question is very unspecific. on 8bit you usually taylor your whole approach towards of what you want to achieve, a generic approach is too slow.

but codebase64, and especially Steve Judd's genious 3d articles in C= Hacking will give you excellent tips on how to solve all the problems.
added on the 2016-08-09 00:13:18 by Oswald Oswald

login