Dreamcast ASM Programming?
-
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Has thanked: 0
- Been thanked: 0
Dreamcast ASM Programming?
Okay, so call me crazy but after programming stuff on the VMU, I've started to like the workflow that ASM gives you. Is there any documentation on ASM for DC?
- BlueCrab
- The Crabby Overlord
- Posts: 5658
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Dreamcast ASM Programming?
These two documents will be your friends... Although, there aren't all that many people who bother with assembly on the Dreamcast for anything major.
The programming manual will probably be the most useful, but the hardware manual is particularly useful if you want to play with any of the on-chip stuff on the CPU.
EDIT: Attachments removed from the post. You can find the latest version of the documents over at the Renesas SuperH website here: http://am.renesas.com/products/mpumcu/s ... tation.jsp . Look for the "SH7750, SH7750S, SH7750R Group User's Manual: Hardware" and the "SH-4 Software Manual" for the hardware and software manuals, respectively.
The programming manual will probably be the most useful, but the hardware manual is particularly useful if you want to play with any of the on-chip stuff on the CPU.
EDIT: Attachments removed from the post. You can find the latest version of the documents over at the Renesas SuperH website here: http://am.renesas.com/products/mpumcu/s ... tation.jsp . Look for the "SH7750, SH7750S, SH7750R Group User's Manual: Hardware" and the "SH-4 Software Manual" for the hardware and software manuals, respectively.
Re: Dreamcast ASM Programming?
Okay thanks, Is there any sort of PowerVR documentation too? I would check myself but i have no clue on how what architecture it uses.
- BlueCrab
- The Crabby Overlord
- Posts: 5658
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Dreamcast ASM Programming?
There is no publicly available low-level documentation of the PVR other than basic descriptions of its operation and some register descriptions. It isn't programmable in the sense of writing assembly-language for it anyway.
Look at the code in KOS to see how it works.
Look at the code in KOS to see how it works.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: Dreamcast ASM Programming?
Kind of funny how I stumbled upon things, but its got me wondering if the DC actually uses the sh-4, or the sh-4a.
I was making sure my vector macros were solid for the inclusion into KOS, and I happened to notice that nVidia posted a slightly different formula for vector normalization than I was using.
Instead of dividing the input vector by the square root of its dot product, as I was doing, nVidia posted code that instead multiplies the input vector by the reciprocal square root of its dot product.
http://http.developer.nvidia.com/Cg/normalize.html
I looked at the SH7750 Series Hardware Manual that BlueCrab posted above, but that manual only mentioned the SH4's fsqrt function, nothing about reciprocal square root. But, I could have swore I saw a reference to the SH4 featuring a function for reciprocal sqrt, so I looked again at the macros included with KOS.
Sure enough, in KOS fmath.h there is a function frsqrt.
At first I thought maybe they were manually fsqrt,fldi1,fdiv to achieve the rsqrt.
But then I looked at fmath_base.h and realized that the sh4 actually contains a fsrra instruction.
I searched the net and found that the sh-4a features a few instructions that the sh-4 does not:
http://documentation.renesas.com/doc/pr ... 3_sh4a.pdf
Even though the output is the same using both approaches for vector normalization, in theory it should be faster to use the fsrra instruction to avoid having to use the fdiv instruction, because according to the hardware manual, fdiv consumes more cycles than fmul.
So far I tested on emulator, and the results are good the DC seems to support the sh-4a instructions. But should this work on real hardware, too?
I was making sure my vector macros were solid for the inclusion into KOS, and I happened to notice that nVidia posted a slightly different formula for vector normalization than I was using.
Instead of dividing the input vector by the square root of its dot product, as I was doing, nVidia posted code that instead multiplies the input vector by the reciprocal square root of its dot product.
http://http.developer.nvidia.com/Cg/normalize.html
I looked at the SH7750 Series Hardware Manual that BlueCrab posted above, but that manual only mentioned the SH4's fsqrt function, nothing about reciprocal square root. But, I could have swore I saw a reference to the SH4 featuring a function for reciprocal sqrt, so I looked again at the macros included with KOS.
Sure enough, in KOS fmath.h there is a function frsqrt.
At first I thought maybe they were manually fsqrt,fldi1,fdiv to achieve the rsqrt.
But then I looked at fmath_base.h and realized that the sh4 actually contains a fsrra instruction.
I searched the net and found that the sh-4a features a few instructions that the sh-4 does not:
http://documentation.renesas.com/doc/pr ... 3_sh4a.pdf
Even though the output is the same using both approaches for vector normalization, in theory it should be faster to use the fsrra instruction to avoid having to use the fdiv instruction, because according to the hardware manual, fdiv consumes more cycles than fmul.
So far I tested on emulator, and the results are good the DC seems to support the sh-4a instructions. But should this work on real hardware, too?
- BlueCrab
- The Crabby Overlord
- Posts: 5658
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Dreamcast ASM Programming?
Actually, it isn't that the SH4A supported the fsrra/fsca instructions while the SH4 didn't, it's just that they weren't documented as supported on the SH4 for the longest time (See here for a post from someone at SuperH Inc. on the subject with regard to binutils).