Jin X information 596 glöps
- 512b MS-Dos HerbaKaif by 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).
- isokadded on the 2021-04-03 09:46:47
- 512b MS-Dos HerbaKaif by Jin X
- Added link to last fpb module version ;)
- isokadded on the 2021-04-03 09:43:31
- 512b MS-Dos HerbaKaif by Jin X
- Quote:I think it can be useful for 256b intros too.
Interesting idea ! I guess that makes mostly sense for heavy 512/1024 Byte FPU-focused intro stuff compared to other compressors ?
Not for each of course. - isokadded on the 2021-03-30 11:43:05
- 512b MS-Dos HerbaKaif by Jin X
- This intro also contains some tricks of setting Unreal Mode (if you are interested in this) ;)
- isokadded on the 2021-03-29 23:15:46
- 512b MS-Dos HerbaKaif by Jin X
- 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! ;) - isokadded on the 2021-03-29 23:04:22
- 256b game MS-Dos hect!c by Sensenstahl
- Awesome idea for a game! ;)
- rulezadded on the 2021-03-22 20:41:40
- 4k MS-Dos 4k shameless plug by xylem
- Very good for the 1st demo :)
- rulezadded on the 2021-03-22 20:26:50
- 4k MS-Dos Moments by Abaddon [web]
- He-he. Interesting.
I'd also add transitions and names (in the corner). - rulezadded on the 2021-03-22 20:24:19
- 1k MS-Dos paleozoa by fsqrt [web]
- Very impressive for 1kb!
- rulezadded on the 2021-03-22 20:05:00
- 1k MS-Dos spiral by xylem
- Good song ;)
- rulezadded on the 2021-03-22 18:40:17
account created on the 2018-01-24 19:46:37
