Hardasm
Jump to navigation
Jump to search
Hardasm is a programming language designed by PSTF to make programmers can program more easily in 硬!!!.
Compare with original version
Arithmetic and Data
Hardasm added these commands to lower the programming difficulcy:
- move a b – transfers the value of b into a.
- add a b – equals to b inc-command.
- sub a b – equals to b dec-command.
- mul a b – equals to b add-command.
- div a b – get a÷b, result in quotient.
- mod a b – get a mod b.
For commands involving one variable and one number, we have the following regulations:
- Variable names (since variable names are also integers, similar to cell numbers in Brainfuck) must be enclosed in square brackets.
- It is allowed to use character literals to represent numbers. Character literals must be enclosed in single quotes.
Control Flow
Added conditional jump and one-time conditional block.
- if a – jump over nearest endif if a is 0.
- endif – must be matched with if-statement, but it does nothing though.
- jzr a label – jump to label if a is 0.
- jnz a label – jump to label if a is NOT 0.
Examples
Since we've regulated the variable name, then we have these examples:
Hello, world!
add [10] 'H' add [11] 'e' add [12] 'l' add [13] 'o' add [14] ',' add [15] ' ' add [16] 'w' add [17] 'r' add [18] 'd' add [19] '!' add [20] 10 putc [10] putc [11] putc [12] putc [12] putc [13] putc [14] putc [15] putc [16] putc [13] putc [17] putc [12] putc [18] putc [19] putc [20] halt
But even so, printing a string still requires a pile of shitty code, especially for long strings(For example, 㐨𗂋𐞐𮏀𥇊睜狊𝍓癱𢐍 � 𝇡㐓擓𠽢𭅋𩤯樞𰲞𬠼� 臀臀𣋭𮣉𑴶𡱎𓏖𖠄).
A+B Problem
read [0] read [1] add [1], [0] write [1]