Pro-1000 API

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Pro-1000 API

Postby Ian » Fri May 06, 2016 3:50 am

Bart wrote:Hey Ian, I saved you some work and figured out the polygon header bits from the API header files :) We were right all along about many of them, including specular. A few are clearly not used in Model 3, such as the extra texture Y address bits (Pro-1000 supported more texture RAM). And translucency is a bit different. Looks like you nailed fixed shading and smooth shading,though!

Give this bad boy a spin:

Code: Select all
/*
 * Real3D Pro-1000 polygon header definition
 */

#include <cstdio>
#include <cstring>
#include <cstdint>

class PRO_MCW1
{
public:
  // header[5]:7-0
  unsigned long _y_memory_map_start           :  7 ; // 6-0
  unsigned long _x_memory_map_start_bit_0     :  1 ; // 7
   
  // header[4]:7-0
  unsigned long _x_memory_map_start_bits_6_1  :  6 ; // 5-0
  unsigned long _even_bank_select             :  1 ; // 6
  unsigned long _translator_map_select        :  1 ; // 7

  // header[3]:7-0
  unsigned long _map_size_y                   :  3 ; // 2-0
  unsigned long _map_size_x                   :  3 ; // 5-3
  unsigned long _y_wrap_smoothing             :  1 ; // 6
  unsigned long _x_wrap_smoothing             :  1 ; // 7
 
  // header[2]:7-0
  unsigned long _y_mirror                     :  1 ; // 0
  unsigned long _x_mirror                     :  1 ; // 1
  unsigned long _microtexture_min_lod         :  2 ; // 3-2
  unsigned long _microtexture_enable          :  1 ; // 4
  unsigned long _microtexture_map_select      :  3 ; // 7-5
} ;

class PRO_MCW2
{
public :
  // header[6]
  unsigned long _translucency_mode            :  3 ; // 2-0
  unsigned long _layered_polygon              :  1 ; // 3
  unsigned long _high_priority                :  1 ; // 4
  unsigned long _shininess                    :  2 ; // 6-5
  unsigned long _texture_mode                 :  3 ; // 9-7
  unsigned long _enable_texture_modulation    :  1 ; // 10
  unsigned long _light_modifier               :  5 ; // 15-11
  unsigned long _luminous_feature             :  1 ; // 16
  unsigned long _translucency_pattern_select  :  1 ; // 17
  unsigned long _polygon_translucency         :  6 ; // 23-18
  unsigned long _translator_map_offset        :  7 ; // 30-24
  unsigned long _contour_texture_enable       :  1 ; // 31
} ;

class PRO_HW_Polygon
{
public:
  // header[0]
  unsigned long _use_prev_vert0               :  1 ; // 0
  unsigned long _use_prev_vert1               :  1 ; // 1
  unsigned long _use_prev_vert2               :  1 ; // 2
  unsigned long _use_prev_vert3               :  1 ; // 3
  unsigned long _smoothing                    :  1 ; // 4
  unsigned long _polygon_is_points            :  1 ; // 5
  unsigned long _vertex_count                 :  1 ; // 6
  unsigned long _enable_specular              :  1 ; // 7
  unsigned long _discard_2                    :  1 ; // 8
  unsigned long _discard_1                    :  1 ; // 9
  unsigned long _node_id                      : 15 ; // 24-10
  unsigned long _clockwise_data               :  1 ; // 25
  unsigned long _specular                     :  6 ; // 31-26

  // header[1]
  unsigned long _no_los_return                :  1 ; // 0
  unsigned long _actual_color                 :  1 ; // 1
  unsigned long _last_polygon                 :  1 ; // 2
  unsigned long _smooth_shading               :  1 ; // 3
  unsigned long _double_sided                 :  1 ; // 4
  unsigned long _fixed_shading                :  1 ; // 5
  unsigned long _texture_address_scale        :  1 ; // 6
  unsigned long _edge_on_translucency         :  1 ; // 7
  unsigned long _normal_x                     : 24 ; // 31-8

  // header[2]
  unsigned long _mcw1_bits_24_31              :  8 ; // 7-0
  unsigned long _normal_y                     : 24 ; // 31-8

  // header[3]
  unsigned long _mcw1_bits_16_23              :  8 ; // 7-0
  unsigned long _normal_z                     : 24 ; // 31-8

  // header[4]
  unsigned long _mcw1_bits_8_15               :  8 ; // 7-0
  unsigned long _color                        : 24 ; // 31-8

  // header[5]
  unsigned long _mcw1_bits_0_7                :  8 ; // 7-0
  unsigned long _texture_np                   : 24 ; // 31-8
 
  // header[6]
  PRO_MCW2      _mcw2 ;
};

static_assert(sizeof(PRO_HW_Polygon) == 7*4, "Polygon header is not 7 words long");

int main()
{
  PRO_HW_Polygon p;
  memset(&p, 0, sizeof(p));
 
  // Test out some bits!
  p._enable_specular = 1;
  p._fixed_shading = 1;
  p._contour_texture_enable = 1;

  // Print them out as they would appear on Model 3
  uint32_t *data = reinterpret_cast<uint32_t *>(&p);
  for (int i = 0; i < 7; i++)
    printf("%d: %08x\n", i, data[i]);
  return 0;
}


If this is correct, our transparency bit is wrong ? :)
Ian
 
Posts: 1646
Joined: Tue Feb 23, 2016 9:23 am

Re: Pro-1000 API

Postby Shekel » Sat May 28, 2016 3:22 pm

Bart, would you one day be able to make a video of these demos, the cities and stuff? There's barely any good footage on YouTube.
User avatar
Shekel
 
Posts: 345
Joined: Wed Mar 16, 2016 12:45 pm

Re: Pro-1000 API

Postby Bart » Sat May 28, 2016 6:27 pm

It would require emulating the Pro-1000. I would like to do it one day -- obviously, Supermodel already contains the bulk of what's required. The difficult part will be figuring out how to integrate it with a PC emulator or write some sort of Windows NT4 SCSI driver that can communicate with a standalone emulator from a VM.
User avatar
Bart
Site Admin
 
Posts: 2347
Joined: Thu Sep 01, 2011 2:13 pm
Location: Santa Clara, California

Re: Pro-1000 API

Postby Shekel » Sun May 29, 2016 3:03 am

Oh, I thought you were running it on an old version of Windows somehow. That's ok. Surely more, difficult, time-consuming work.
User avatar
Shekel
 
Posts: 345
Joined: Wed Mar 16, 2016 12:45 pm

Re: Pro-1000 API

Postby Bart » Sun May 29, 2016 9:46 am

Shekel wrote:Oh, I thought you were running it on an old version of Windows somehow. That's ok. Surely more, difficult, time-consuming work.


That was just to run the self-extracting installer for the SDK, which won't run on modern Windows. The SDK itself just contains header files and libraries, drivers for communicating with the Pro-1000 via SCSI, documentation, and the demos (executables, source code, and assets). You need an actual Pro-1000 hooked up to the PC for these demos to work. And that's what we would need to emulate.

The SDK has been useful to Ian and I because it describes the layout of various data structures used by the Pro-1000 graphics subsystem (and which our renderers have to understand). Sometimes it's right there in the header files, other times, we need to disassemble the x86 library code to understand how various parameter values are being manipulated and inserted into those data structures to get a sense of what the values might actually mean.
User avatar
Bart
Site Admin
 
Posts: 2347
Joined: Thu Sep 01, 2011 2:13 pm
Location: Santa Clara, California

Re: Pro-1000 API

Postby Ian » Sun May 29, 2016 11:20 am

Here's one for you Bart, from the SDK

#define PRO_RET_DAT_MAGIC 0xbeefbabe

beefbabe ? :)
Ian
 
Posts: 1646
Joined: Tue Feb 23, 2016 9:23 am

Re: Pro-1000 API

Postby Bart » Sun May 29, 2016 12:46 pm

Of course. Beef and babes -- two things a man can't live without!

This reminds me of 7th grade and the 'boobless' calculator trick. E.g.:

Dolly Parton has 9 pounds of boobs. She thinks it's 2, 2 much. So on the 9th at 6 she goes to 68th Street, where Dr. X gives her 6 operations. She ends up BOOBLESS.

9229668 * 6 = 55378008 (hold calculator upside down)


And those of us who discovered the TI-34's hex mode took endless pleasure in leaving clever messages on our less tech-savvy classmates' calculators: a55face, b00bface, etc. The 90's were a simpler time.
User avatar
Bart
Site Admin
 
Posts: 2347
Joined: Thu Sep 01, 2011 2:13 pm
Location: Santa Clara, California

Previous

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 2 guests

cron