Daily Archive for July 22nd, 2010

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).