This is a `big pack` with tools which contains: 4BoD emulator (4BoD-CS); 4BoD `postcompiler`; few `libraries`, which includes: `platform` settings, `binary`, few `definitions` and `40+ macros`, such as ~jump~, ~nib~, ~for~, ~ifn~, ~while~; and few `examples`. So, if you want to develop a `4-bit game`, there is `everything` you need.
Download from this site: 4BoD.zip.
There is a basic documentation of all commands and definitions, but firstly, of course, read main LIOD documentation.
Create a file in the libs' folder. Name it and give it ~.liod~ extension. After creation just import all libraries as shown in example.
To test if everything works just copy code from the top into your file. Then drag and drop your file onto the ~LIOD4BoD.exe~ and close all windows that appeared. Now you got 2 new files: one with ~.lf~ extension and one with ~.b~. To run the program just drag and drop ~.b~ file onto ~4BoD-CS.exe~. You will see a diagonal line.
Constants are defined with ~def~ macro and ~name~, ~value~ as arguments, more in main LIOD documentation. To create multiple constants at once, use ~def:~ and write all names and values after it.
Variables are defined with ~nib~ macro and ~name~ as argument. To create multiple variables at once, use ~nib:~ and write all names after it.
There are 6 maths operators: ~=~, ~++~, ~--~, ~+=~, ~\l\l~, ~>>~. First is assignment. Using this operator you can assign variable to a constant value or to another variable. Second is incremention by 1. Third is decremention by one Fourth is incremention by a constant value, so you can't increment one variable by another. If you need to decrement by a constant value, use the same macro, but subtract this constant value from 16. Fifth operator is shifting left, but also it can be named like multiplication by 2. Sixth is shifting right, or division by 2. Also there are binary numbers, which starts with '$' character. Their maximum length is 4, but you can use with 3, 2, 1 length, so they will be same ~$10 = $0010~. But You can't use with 5, 6, 7, etc length, so ~$01111~ will cause a error.
There is a ~main~ macro with no arguments, you need to define it to make your game work. Usually the structure of a file is:
Library ~4BoD.IO~ includes ~disp~ (display) class and there are 3 macros: ~disp:clear~, ~disp:flip~ and ~disp:read~. Using ~disp:clear~ will clear the whole screen. Using ~disp:flip~ will "flip" a pixel on the screen, the macro uses 2 arguments: ~x~ and ~y~, x and y respectively. Using ~disp:read~ will "read" a pixel's value from the screen, it uses 3 arguments: ~var~ (variable to save in), ~x~ and ~y~.
To define a flag use ~flag*~ macro and give it a name as argument at the same part of code, where variables defined. Also you can define multiple flags at once, using ~flag:~ macro. To place a flag use ~flag~ macro and flag's name. To jump to a flag use ~jump~ macro, and flag's name as argument. Also you can use ~pass~ macro, to skip whole frame.
There are 2 macros to create branching: ~jf~ and ~ifn~. First one jumps to a flag if condition is true, so firstly give it a condition, and then a name of a flag. The second does commands given to a macro if condition is wrong, so firstly give it a condition, and then all commands. There are 3 macros, that can be used as conditions: ~==~, ~\l~, ~>~. First checks if first var equal to second, second - if first less than second and third - if first greater than second. Also you can compare a variable with a number or a costant, but you can't compare 2 number or consts, it will give a error ~#4BoD00~
Library ~4BoD.IO~ contains ~keys~ class which includes 5 properties: ~key:left~, ~key:right~, ~key:up~, ~key:down~ and ~key:any~. First four return values of a buttons which they are responsible for, value can be 0 - not pressed and 1 - pressed. The last one returns value of all keys, from 0 to 15. You can use it to simulate random.
There are 2 macros to create loops: ~for~ and ~while~. Its important, that both of them check condition only after they did commands given to them. First simulates ~for~ behavior in C#, you should give it three arguments and commands. Second simulates ~while~ behavior in C#, you should give it a condition and commands.
There are all macros and definitions of the library. You shouldn't use other commands, so there are no them.