SV-302 SSTO Vehicle

I found out that I’ve completly missed out a lot of posts on work that was done on the SV-302 vehicle internal simulation. Instead of making the progress posts, I will post descriptions of the SV-302 systems done so far, but maybe a bit later. I don’t really feel like wording it all right now.

So this post will be just a general overview, something I can later link people to when they ask me “wats sv302″.



SV-302 is a project of writing an internal systems simulation for a single-stage-to-orbit spaceplane – a vehicle that doesn’t require additional boosters or fuel tanks to reach orbit. The aerodynamics are based off the real X-30D project – for the sake of simplicity (and if you want to find out the real reason, scroll back into old posts, and you will find that I really suck at developing waveriders).



It has three types of engines: high-perfomance turbofan engines, which speed up the vehicle to speed of 5 mach (the increased speed is possible due to active internal cooling), switching over to variable geometry scramjet engines, which speed the vehicle up to about 17 mach. After reaching this speed, the vehicle switches over to a linear aerospike rocket engine, and reaches the orbital velocity.

The project concerns detailed physics simulation of all primary systems (for example electric system simulation calculates all voltages and currents flowing through main electric buses, and all the loads that devices are acting on the system).

At the moment of writing this post, I’ve been working for two months rewriting the simulation, and I’ve got electric system, computer systems (and related sensor systems and MDM systems) simulations, power reactant distribution simulation, basic software for the on-board computer system, lots of misc systems (like caution/warning system), and temporary simulations for RCS, GPS, etc.

HL-ZASM details

HL-ZASM compiler is much different from old ZASM2 used with the ZCPU. One major difference is that it doesn’t parse the source code twice to compile it, but instead it splits the compile process into the following steps:

  1. Preprocess stage – the code is preprocessed, all source comments are removed, all macros are satisfied (even the #include macro now works). This also strips all the line breaks, although it retains information on character positions in the source file.
  2. Parse stage – the source code is parsed, and the code tree is generated. Code tree is similar to the one in HybriC, it shows how expressions should be compiled, and all the statements, expressions, opcodes to be included in the final program.
  3. Tree optimize stage – at this stage code tree is optimized by known patterns, before moving on to next stage
  4. Generate stage – this stage will conver the code tree into actual opcodes, although not resolving the constant values yet (constant values like jump offsets, function pointers, etc)
  5. Optimize stage – the intermediate generated code is optimized for known patterns
  6. Resolve stage – all the constant values, function pointers, label pointers, etc are resolved at this stage
  7. Binary stage – at this stage intermediate code is converted into ZCPU binary. It will be then written to the processor itself

It is possible to generate commented assembly listing for every program in two different ways – before labels/constant values are resolved, and after. For example this is before they are resolved:

gvar:
     0 alloc 1
// gfunc()
gfunc:
     1 enter 2
// ptr = &lvar
     4 mov EAX,SS:ESP
     7 add EAX,1
    10 sstack EBP:2,EAX
// lvar = &gvar+15
    14 sstack EBP:1,&gvar+15
    19 leave



And this is after the constant values are resolved:

gvar:
     0 alloc 1
// gfunc()
gfunc:
     1 enter 2
// ptr = &lvar
     4 mov EAX,SS:ESP
     7 add EAX,1
    10 sstack EBP:2,EAX
// lvar = &gvar+15
    14 sstack EBP:1,15
    19 leave

Both source code listings will compile (when stripped of the offsets column though), but the first one is slightly more descriptive.

Zyelios CPU 10 Documentation Handbook

I’m working on a new documentation for the ZCPU. It will be a complete description of all aspects of the processor, and all the features it provides, and finnally, an up to date documentation.

This handbook will be full of various code examples, and will describe all kinds of advanced features. Here is the draft version of what I’ve got so far: zcpuhb_draft.pdf

ZCPU update

I’m planning a large ZCPU update (ZCPU is the processor in Wire addon for Garry’s Mod). This will be a perfomance update (new virtual machine and client-side compiler will make things much more faster and smooth), feature update (new compiler and processor features), and there will even be a new entity (the sound processor).

There are several parts of this update. First there is the new ZCPU virtual machine, which now compiles ZCPU bytecode into blocks of Lua code, which makes everything run much much faster. It will compile up to 8 instructions into single block of instructions executed at once, although branching opcodes may make these blocks smaller.

There are few new ZCPU features, for example introduction of the page table, which allows one to quickly switch page permission and mapping data, and quickly setting them up. Page table is a table which holds all the settings for all the pages in RAM (pages which will be out of this table will use default settings, which can be also specified).

There’s also a new feature which allows to trap page access, which means an interrupt will be generated every time you attempt to access a certain memory location. This also allows user to override result of the memory operation, and create all sorts of interesting programming solutions.

The new compiler adds proper C language support, although it’s not exactly same as a usual C compiler (it does not require a linker, since it’s based on an assembler), it has the same syntax. And you can still use the old ZASM syntax, all the old programs will still compile.

There is a plan of a new entity called the sound processor, which will be a sound equivalent of the GPU. It’s a programmable entity which can play back sound, change pitch, volume, etc. You can easily program a sequencer to play some MIDI-like music with it, it will come with a small bank of music samples (optional for download, but part of wiremod).

HL-ZASM

Sorry for no updates, but updates are not supposed to be at regular intervals in summer anyway.

HL-ZASM is a new project for Wiremod. It’s part of one massive ZCPU update I want to carry out, it’s a new compiler that will replace the ZASM.

HL in HL-ZASM stands for “high level”, and it adds support for most of C language features – you can write C code, and mix it with ZASM code without problems. It will compile all the complex expressions, function and variable definitions, various loops and stuff like that.

For example, it can compile the following code:

int test\n"..
void function(int a, int b) {"..
  int lvar\n"..
  lvar = a*(test+b*(100+lvar+a+b));\n"..
  lvar = lvar + 1;\n"..
  lvar = test-lvar*(-a);\n"..
  lvar = function+15;\n"..
}

And then this is how generated output looks like this:

test:
     0 alloc 1
// function(a,b)
function:
     1 enter 1
// lvar = a*(test+b*(100+lvar+a+b))
     4 rstack EAX,EBP:-2
     8 rstack EBX,EBP:-1
    12 add EBX,EAX
    14 rstack EAX,EBP:1
    18 add EAX,EBX
    20 add EAX,100
    23 rstack EBX,EBP:-2
    27 mul EBX,EAX
    29 mov EAX,#0
    32 add EAX,EBX
    34 rstack EBX,EBP:-1
    38 mul EBX,EAX
    40 sstack EBP:1,EBX
// lvar = lvar + 1
    44 rstack EAX,EBP:1
    48 add EAX,1
    51 sstack EBP:1,EAX
// lvar = test-lvar*(-a)
    55 rstack EAX,EBP:-1
    59 neg EAX
    61 rstack EBX,EBP:1
    65 mul EBX,EAX
    67 mov EAX,#0
    70 sub EAX,EBX
    72 sstack EBP:1,EAX
// lvar = function+15
    76 sstack EBP:1,16
    81 leave
    82 ret

Most of the compiler is based on the HybriC project – in fact all of it, but I found many flaws in the original HybriC architecture, which I will fix later.

XGDC update 6

Added a prototype of a map-based navigation system, so you could use charts/maps, and display them full-screen on airplanes MFD. Right now it’s very blurry because I’m using just one texture for an entire region, but later I’ll break it down into blocks of smaller size, will improve quality a lot:

I need to find some charts in a good format to work with. JPEG preferred, and cylindric projection preferred, maybe anyone knows websites where to get these?

XGDC update 5 + sound synth

Added database subsystem to XGDC. Now you can have a database (like a database of airports), and easily load it/process it in background (it doesn’t lag the OS/simulator). No pictures, because it’s an internal change, but here’s a neat random picture:

Been working more on the synth, now it uses only sine and white noise as sound sources (although I should use a wind sound instead of white noise, or somehow alter it). Still doesn’t sound right, can’t get FMOD to do what I want to: http://brain.wireos.com/wp-content/uploads/1xplanesnd.wav

XGDC update 4

Added WAPI – window API. It’s a set of controls you can place on the MFD, and they will properly work (controls like buttons, list boxes, etc). I’ve rebuilt the FMC with them, and slightly altered the layout to be more sane:

Started also working on creating an engine sound synth for X-Plane – a set of utils that allow one to build engine sound synth. Right now it only uses pre-recorded samples, here’s how it sounds like (not very good right now): http://brain.wireos.com/wp-content/uploads/0xplanesnd.wav