pouët.net

HerbaKaif by Jin X
[nfo]
screenshot added by Jin X on 2021-03-29 23:02:45
platform :
type :
release date : march 2021
release party : Chaos Constructions Winter 2021
compo : pc 512b
ranked : 2nd
  • 14
  • 1
  • 0
popularity : 51%
 51%
  • 0.93
alltime top: #20804
  • Jin X Jin X [code, sound, fpb]
added on the 2021-03-29 23:02:45 by Jin X Jin X

popularity helper

increase the popularity of this prod by spreading this URL:

or via: facebook twitter pinterest tumblr bluesky threads

comments

Video: https://youtu.be/X-1iEVeMQjg

Code:+----------------------------------------------------------------------------------------------------------------------------------------------+ | I don't smoke and don't advise you too!!! Я не курю и вам не советую!!! | |----------------------------------------------------------------------------------------------------------------------------------------------| | Author does not call anybody for any illegal actions, including the use and distribution of substances prohibited by law! | | Remember that smoking and use of alcohol and drugs is harmful to health and may violate the law of your country! | | Image generated but this program is only a demonstration of Floating-Point Instruction Bytecode Generator & Recompiler. | |----------------------------------------------------------------------------------------------------------------------------------------------| | Автор ни в коем случае не призывает к каким-либо противоправным действиям, в т.ч. употреблению и распространению запрещённых законом веществ! | | Помните, что курение и употребление алкоголя и наркотических веществ вредно для здоровья и может нарушать законодательство вашей страны! | | Изображение, генерируемое программой, является лишь демонстрацией работы генератора и рекомпилятора байткода инструкций FPU. | +----------------------------------------------------------------------------------------------------------------------------------------------+

Hi everybody!
I'm glad to present my new development to you!
Read below...

Quote:
WHAT IS THIS?
=============

Floating-point Instruction Bytecode Generator & Recompiler, v1.0.0.

In fact, this is a packer of x86 FPU instructions with ≈ 3-4x efficiency (not taking into account recompiler code and constants).
All you need is just define some symbolic constants, include this file in your fasm project, use a few macros and perform a call to recompiled function.
Macros allow you:
- to check module version compatibility;
- to declare set of bytecode instructions (used FPU instructions and their aliases);
- to insert code of bytecode recompiler;
- to generate bytecode (replacing native x86 FPU code);
- to define constants/variables and their aliases (names);

>>> FEATURES <<<

• Definition of FPU operations in easy to read format of Reverse Polish Notation (RPN).
• Flexibly customizable recompiler which creates native x86 function from bytecode (that is, fast for execution).
• Native code copier (so you can mix FPU instructions with native x86 code inside bytecode block).
• Declaration of up to 11-13 bytecode instructions associated with 2-byte FPU (...or not only FPU?...) instructions (this number is sufficient for most purposes).
• Definition of up to 17 2-byte integer and floating-point constants.
• Definition of up to 16 4-byte floating-point variables.
• Declaration of unlimited subfunctions with custom names inside bytecode block.
• Possibility to override some predefined bytecode instructions associated with native x86 instructions.
• The size of recompiler is ≈ 50..74 bytes (for 1..13 types of bytecode instructions, with no support of native code copier, variables and subfunctions)
to ≈ 65..85 / 76..96 bytes (for 1..11 types of bytecode instructions, with max functionality) including writting of input stream offset to register.
This size can vary depending on used options of macro 'fpb_recompile!'.

>>> WHAT DOES THE CODE LOOK LIKE? <<<

* Let's first consider the simplest variant...

Code:define fpb_copy_support 0 ; disable native code copier support define fpb_var_support 0 ; disable variable support include 'fpb.inc' ; include fpb generator & recompiler fpb_check_version 1,0,0 ; check fpb module version compatibility ; Declare fpb bytecode instructions declare_fpb *, fmulp declare_fpb sincos, fsincos ; . . . mov di,$200 ; destination offset for recompilation fpb_recompile! fpb_nibbles, bh=0 ; insert recompiler code here (doesn't require 'call') ; . . . mov bx,consts ; constant array (doesn't require offset correction because fpb_data_offset is not defined) call $200 ; call recompiled function ; . . . fpb_nibbles: fpb_start consts ; start of bytecode generation fpb rad * sincos ; convert degrees to radiants and calc sin & cos fpb_end ; end of bytecode generation consts = $-2 ; don't define this symbolic constant as label here, otherwise an error can be generated (-2 is required because the 1st constant is float, not integer, see below) fpb_flt rad, 0.0174533 ; define 2-byte float constant with name 'rad' and value pi/180

* Not so hard, really? :))
* And now let's consider more complex case...

Code:define fpb_copy_support 1 ; enable native code copier support define fpb_var_support 1 ; enable variable support define fpb_before_ret salc ; one-byte native instruction before 'ret' in recompiled function fpb_data_offset = vars-consts ; offset of constants and variables include 'fpb.inc' ; include fpb generator & recompiler fpb_check_version 1,0,0 ; check fpb module version compatibility ; Declare fpb bytecode instructions declare_fpb +, faddp declare_fpb ^2, fmul st0,st0 declare_fpb 0, fldz declare_fpb sin, fsin ; . . . mov di,bp ; destination offset for recompilation fpb_recompile! fpb_nibbles, bh=0, ax=0 ; insert recompiler code here (doesn't require 'call') ; . . . mov bx,consts-fpb_data_offset ; constant and variable arrays (with offset correction) call bp ; call recompiled function ; . . . fpb_nibbles: fpb_start consts ; start of bytecode generation fpb x pi + sin ^2 0 ; list of bytecode aliases (sequence of RPN-operations in fact) fpb_copy_start ; start of native code block fcomp fstsw ax sahf jnb @F lea ax,[bp+fpb_offset_subfn_lt0] ; offset of subfunction 'lt0' jmp ax @@: fpb_copy_end ; end of native code block fpb =res ; store value to variable 'res' fpb_subfn lt0 ; declare new subfunction (and its offset as 'fpb_offset_subfn_lt0' relative to start of native code block (bp)) fpb 2 + =res fpb_end ; end of bytecode generation consts = $ ; don't define this symbolic constant (and 'vars' too) as label here, otherwise an error can be generated fpb_int 2 ; define 2-byte integer constant with name and value '2' fpb_flt pi, 3.1415927 ; define 2-byte float constant 'pi' with specified value vars = $ fpb_var x, 0.0 ; declare 4-byte float variable 'x' with initial value 0.0 fpb_var res ; declare 4-byte float variable 'res' without initial value

>>> BYTECODE FORMAT <<<

Bytecode is just a sequence of bytecode instructions (encoded as a sequence of opcodes with their operands). Each opcode is encoded as nibble (the 1st nibble is encoded in higher
4 bits, the 2nd one is encoded in lower 4 bits). So bytecode is nibblecode in fact :).

>>> NOTES <<<

See 'fpb_demo.fasm' and HerbaKaif + HK256 intros as examples and enjoy! ;)
Short statistics of HerbaKaif intro:
- bytecode contains 244 nibbles (= 122 bytes = 169 opcodes; average length of 1 bytecode instruction ≈ 1.44 nibbles ≈ 0.72 bytes);
- size of recompiled function = 413 bytes (compression ratio = 3.39x; average length of 1 unpacked native x86 instruction ≈ 2.44 bytes);
- size of recompiler = 74 bytes (including writting of input stream offset to register, although this is partly part of another code);
- compression ratio including bytecode recompiler = 413/(122+74) = 2.11x.

More information you can find in "sources\fpb.inc".
Enjoy! ;)
added on the 2021-03-29 23:04:22 by Jin X Jin X
This intro also contains some tricks of setting Unreal Mode (if you are interested in this) ;)
added on the 2021-03-29 23:15:46 by Jin X Jin X
Impressive!
rulez added on the 2021-03-29 23:45:29 by HellMood HellMood
ok
rulez added on the 2021-03-30 03:56:11 by g0blinish g0blinish
Cool idea!
rulez added on the 2021-03-30 06:49:54 by 42Bastian 42Bastian
Interesting idea ! I guess that makes mostly sense for heavy 512/1024 Byte FPU-focused intro stuff compared to other compressors ?
rulez added on the 2021-03-30 08:25:56 by Kuemmel Kuemmel
Coolerio *puff*
rulez added on the 2021-03-30 09:20:07 by leGend leGend
Neat!
rulez added on the 2021-03-30 09:24:36 by zerothehero zerothehero
Nice colours
rulez added on the 2021-03-30 09:57:59 by Emod Emod
nice!
rulez added on the 2021-03-30 11:16:03 by aolvos aolvos
Quote:
Interesting idea ! I guess that makes mostly sense for heavy 512/1024 Byte FPU-focused intro stuff compared to other compressors ?
I think it can be useful for 256b intros too.
Not for each of course.
added on the 2021-03-30 11:43:05 by Jin X Jin X
Cool idea!
rulez added on the 2021-03-30 12:39:08 by Dresdenboy Dresdenboy
Cool! And good idea for the bytecode packer.
rulez added on the 2021-03-31 14:05:42 by Optimus Optimus
BB Image
rulez added on the 2021-04-01 18:32:29 by Frozzy Frozzy
nice file size. bytecode is interesting.
rulez added on the 2021-04-02 15:26:02 by TomCatAbaddon TomCatAbaddon
nothing wrong with the herb!
rulez added on the 2021-04-02 15:36:12 by sensenstahl sensenstahl
Added link to last fpb module version ;)
added on the 2021-04-03 09:43:31 by Jin X Jin X
New versions can always be downloaded from the specified link (if suddenly it won't work, see link section of information block on top).
added on the 2021-04-03 09:46:47 by Jin X Jin X
hmm... thanks for fpb! :)
rulez added on the 2021-12-02 00:09:12 by T$ T$

submit changes

if this prod is a fake, some info is false or the download link is broken,

do not post about it in the comments, it will get lost.

instead, click here !

[previous edits]

add a comment