SARCASM

From Esolang
Jump to navigation Jump to search
SARCASM
Designed by RainbowDash
Appeared in 2025
Memory system Counters
Computational class Turing complete
Reference implementation Python
File extension(s) .asm


SARCASM stands for Some Assembly Required For Clear Assembly. SARCASM is an esoteric programming language inspired by some crazy assembly instructions within the 86x architecture. But instead of you being handed the instructions, you either have to search for them or program them yourself to then find the instruction.

Architecture

This assembly programming language runs on a virtual CPU with an infinite instruction set. The CPU uses 16-bit memory addresses. It features an accumulator and a single register named RegisterA. It also includes two memory pointers and a program counter which can be modified. It is most like a counter machine, because it does not support binary instructions. Binary instructions however can be encoded using base10 math.

Programming

Every program consists of one or more instructions. Each instruction can be any string of letters of any length. SARCASM is case insensitive while everything else is ignored.

Microinstructions

Each full instruction consists of one or more microinstructions. Here is the full list of microinstructions. A $ in this list represents the address at that location, without the $ it simply represents the value stored in that.

SARCASM MICROINSTRUCTION ISA
Opcode Psuedo Asm Description
1 INC PTR1 Increments the first pointer
2 INC PTR2 Increments the second pointer
3 MOV PTR1, ACC Sets the first pointer to the value of the accumulator
4 MOV PTR2, ACC Sets the second pointer to the value of the accumulator
5 MOV PTR1, $PTR1 Sets the first pointer to the value stored in memory at the first pointer
6 MOV PTR2, $PTR1 Sets the second pointer to the value stored in memory at the first pointer
7 MOV $PTR1, $PTR2 Copies the value from memory at the second pointer to memory at the first pointer
8 MOV $PTR2, $PTR1 Copies the value from memory at the first pointer to memory at the second pointer
9 SWAP $PTR1, $PTR2 Swaps the values stored at memory locations pointed to by the first and second pointers
10 CLR $PTR1 Clears (sets to 0) the memory location pointed to by the first pointer
11 CLR $PTR2 Clears (sets to 0) the memory location pointed to by the second pointer
12 ADD ACC, REGA Adds the value of register A to the accumulator
13 SUB ACC, REGA Subtracts the value of register A from the accumulator
14 MUL ACC, REGA Multiplies the accumulator by the value of register A
15 DIV ACC, REGA Divides the accumulator by the value of register A (integer division)
16 MOV ACC, REGA Moves the value of register A into the accumulator
17 SQR ACC Squares the value in the accumulator
18 MOV REGA, $PTR1 Moves the value from memory at the first pointer into register A
19 MOV REGA, $PTR2 Moves the value from memory at the second pointer into register A
20 MOV $PTR1, REGA Moves the value of register A into memory at the first pointer
21 INC $PTR1 Increments the value stored in memory at the first pointer
22 INC $PTR2 Increments the value stored in memory at the second pointer
23 DEC $PTR1 Decrements the value stored in memory at the first pointer
24 DEC $PTR2 Decrements the value stored in memory at the second pointer
25 JMP ADD PC, ACC Adds the value of the accumulator to the program counter (jump forward)
26 JMP SUB PC, ACC Subtracts the value of the accumulator from the program counter (jump backward)
27 MOV $PTR1, ACC Moves the value of the accumulator into memory at the first pointer
28 MOV $PTR2, ACC Moves the value of the accumulator into memory at the second pointer
29 IN $PTR1 Reads an input character into memory at the first pointer
30 OUT $PTR1 Outputs the character stored in memory at the first pointer
31 CMP EQ ACC, REGA Sets checkFlag to 1 if accumulator equals register A, else 0
32 CMP LT ACC, REGA Sets checkFlag to 1 if accumulator less than register A, else 0
33 MOV ACC, FLAG Moves the checkFlag value into the accumulator
34 NOT FLAG Inverts the checkFlag value (1 becomes 0, 0 becomes 1)
35 NOP No Operation
36 NOP There are two No Ops for expansion. It also increases the chance that English words do sort of useful things.

Each instruction gets converted into a list of opcodes which are then ran into the CPU and interpreted as a series of microinstructions. Each instruction runs on its own program counter, that being said you can not change the program counter to go back and read another instruction, all densely useful instructions are expected to carry their own weight when it comes to looping.

SARCASM Instruction Set

This is not a full list, but rather a list of useful instructions in the set. When you find a useful instruction you can add it here aswell. That being said there is an infinite amount of instructions so this is obviously only a small snippet of the instruction set.

Useful Instructions In the SARCASM ISA.
Instruction Description Warnings Mmemonic
AIJE Puts $PTR1 into the accumulator, and puts $PTR1 into Register A. No Side Effects. Assign Inputs (to) Juxtaposed Elements
GOLAIKNSDNWHUNYFXVMSYR CAT program Do not store any important data into CPU memory or at $PTR1. Get One Line And Immediately Keep New Stream Data, Now While Handling User's New Yielded Flow, Xactly Via Memory Stream, Yield Respond.
ACTMECMCJVXLPM Load 48 into $PTR1. This constant is used to later convert ASCII digits into their respected value or vice versa. Do not store any important data into CPU memory or at $PTR1. Assign Constant To Memory, Enabling Character Math. Constant Just Values Xtracting Literal Plain Meaning.
JUDYZKQNUYREWVBOWIHCNAUFMCRUSGS Load a single digit of user input into ADDR 0 Do not store any important data into the CPU. Pointer one and two are reset to zero. Do not store any data into ADDR1 OR ADDR2. This instruction is suggested to be used at the start of a program to cause the least amount of damage. Just Use Digits, You Zero-load Known Quantities Neatly, Until You Reach Essentiality. Write Value Below On Write-in Index. Hold Character Now At User-facing Front Memory Cell. Register Uses Starting General Slot!
GUIITVBFELARGSOMHMEDHBGESBOTLP Run a truth-machine given one character of user input. This loops forever if the user input is not ASCII 48 (0). Do not store any important data into CPU memory or at $PTR1 or at $(PTR2+1). PTR2 is incremented once. Get User Input; Increase Temporary Value By Forty Eight; Load A Register; Give Same Output Memory Holds; Make Equality Decision; Having Been Given Equality, Skip Branching; Otherwise, Trigger Looping Process

Multiple of these instructions can be combined into a much longer program. For example you could have an instruction that sets an address to 120 then another instruction to print that as unicode.