0815.txt - brcon2024-hackathons - Bitreichcon 2024 Hackathons (HTM) git clone git://bitreich.org/brcon2024-hackathons git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/brcon2024-hackathons (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags --- 0815.txt (6265B) --- 1 ¤0815 2 3 0815 - Language details 4 5 0815 is based around a queue and 3 registers. It understands 6 hexadecimals only, so every numeric input and output are in 7 hexadecimals. It also ignores everything that is not one of its 8 instructions, for that matter: everything that is not an instruction 9 is a comment. 10 11 Registers 12 13 0815 has 3 signed integers 64 bit wide registers: X, Y, and Z. All 14 three are initialized with 0. X is a write only register and Z is a 15 read only register. Y is a helper register and cannot be accessed by 16 the programmer. 17 18 Parameters 19 20 Some of 0815 instructions need parameters. All parameters must be 21 surrounded by colons, e.g.:3c: 22 Labels are also considered parameters; therefore they also need the 23 surrounding colons. 24 If a parameter is needed but any is found the instruction will simply 25 be ignored, no error message will be displayed. 26 27 Jumps 28 29 In 0815 you find 2 kinds of jumps: if Zero( #) or if not Zero( ^). 30 Jumps' labels can contain any character, except the language reserved 31 symbols, e.g.:_loop: or:34: 32 If the label that the jump is pointed to is not found, the program 33 terminates. 34 35 New lines 36 37 Either ASCII 10 or 13 will be interpreted as a new line. 38 39 Instructions 40 41 +-----------+---------+---------------------------------------------------------------------------+ 42 | | |<:2: will move'2' to register X | 43 | move | < |(parameter is mandatory) | 44 | | | | 45 +-----------+---------+---------------------------------------------------------------------------+ 46 | | |swaps register X and Y | 47 | swap | x | | 48 | | | | 49 +-----------+---------+---------------------------------------------------------------------------+ 50 | | |}:_loop: this creates a label called'_loop' | 51 | label |} |(parameter is mandatory) | 52 | | | | 53 +-----------+---------+---------------------------------------------------------------------------+ 54 | input | |inputs a signed 64 bit integer and stores it into X | 55 | number | | |(hexadecimal base) | 56 | | | | 57 +-----------+---------+---------------------------------------------------------------------------+ 58 | input | |inputs an ASCII char and stores it into X | 59 | ASCII |! | | 60 | | | | 61 +-----------+---------+---------------------------------------------------------------------------+ 62 | print | |prints a signed 64 bit integer stored in Z | 63 | number | % |(hexadecimal base) | 64 | | | | 65 +-----------+---------+---------------------------------------------------------------------------+ 66 | print | |prints an ASCII char stored in Z | 67 | ASCII | $ | | 68 | | | | 69 +-----------+---------+---------------------------------------------------------------------------+ 70 | roll | |rolls all registers to the left: X <- Y <- Z | 71 | registers | ~ |after roll: X = Y, Y = Z and Z = X | 72 | left | | | 73 +-----------+---------+---------------------------------------------------------------------------+ 74 | roll | |rolls all registers to the right: X -> Y -> Z | 75 | registers | = |after roll: X = Z, Y = X and Z = Y | 76 | right | | | 77 +-----------+---------+---------------------------------------------------------------------------+ 78 | jump | |^:_loop: jumps to label _loop if Z is not 0 | 79 | if not | ^ |(parameter is mandatory) | 80 | zero | | | 81 +-----------+---------+---------------------------------------------------------------------------+ 82 | jump | |#:_loop: jumps to label _loop if Z is 0 | 83 | if | # |(parameter is mandatory) | 84 | zero | | | 85 +-----------+---------+---------------------------------------------------------------------------+ 86 87 Queue instructions 88 89 +-----------+---------+---------------------------------------------------------------------------+ 90 | | |clears the queue | 91 | clear |? | | 92 | | | | 93 +-----------+---------+---------------------------------------------------------------------------+ 94 | | |enqueue the number stored in Z | 95 | enqueue |> | | 96 | | | | 97 +-----------+---------+---------------------------------------------------------------------------+ 98 | | |dequeue a number and stores it into X | 99 | dequeue | { | | 100 | | | | 101 +-----------+---------+---------------------------------------------------------------------------+ 102 | roll | |rolls the queue to the left: the first value becomes the 103 last, the second | 104 | queue | @ |will be first and so on. If no parameter is found, it 105 will roll the queue | 106 | left | |once, otherwise rolls it parameter times. e.g. @:a: rolls 107 the queue ten | 108 | | |times to the left. | 109 +-----------+---------+---------------------------------------------------------------------------+ 110 | roll | |the same as'@' just that the roll will go to the right: | 111 | queue | & |the last will be the first, the first will be the second 112 and so on. | 113 | right | | | 114 +-----------+---------+---------------------------------------------------------------------------+ 115 116 Arithmetic instructions 117 118 +-----------+---------+---------------------------------------------------------------------------+ 119 | | |Z = X + Y | 120 | add | + | | 121 | | | | 122 +-----------+---------+---------------------------------------------------------------------------+ 123 | | |Z = X - Y | 124 | sub | - | | 125 | | | | 126 +-----------+---------+---------------------------------------------------------------------------+ 127 | | |Z = X * Y | 128 | multipl. | * | | 129 | | | | 130 +-----------+---------+---------------------------------------------------------------------------+ 131 | | |Z = X / Y | 132 | division | / |Y = rest | 133 | | | | 134 +-----------+---------+---------------------------------------------------------------------------+ 135 136 Interpreter 137 138 I re-wrote my Brainfuck interpreter to run 0815 programs. This version 139 just runs (interprets) 0815 programs. 140 Probably, I'll write another version that can interpret both 141 languages, but for now, this will do. 142 There is another issue that I should mention: In this version, the 143 Queue will only show its first 2070 items. 144 0815 Interpreter 145 146 0815 Programming examples 147 148 • Hello World! 149 • Cat 150 • Odd or Even 151 • Binary representation of an integer 152 • Factorial sequence (0 - 14h) 153 • Arithmetic mean(averages) 154 • Fibonacci sequence (0 - a94fad42221f2702h) 155 • 99 bottles of beer (63h bottles of beer) 156 • Prime numbers 157 • Hailstone sequence 158 • Simple randomizer 159 • Sum of squares 160 • Truth machine - numeric 161 • Truth machine - ASCII 162 163 Home | Esolang 164 165 Last updated: Wednesday, 24 August 2016 - 01:00:00 166 ©2004 - 2024 Paulo Jorente 167 Impressum | xhtml | css | cc