16 bits, 256 bytes

From Esolang
Jump to navigation Jump to search

16 bits, 256 bytes is an Esolang designed by PSTF, and his new AI friend DeepSeek-R1 671b.

It is to be not a joke, just like 6 bits, 12 bytes. It is second x-bits, y-bytes, non-joke langugage.

16 bits, 256 bytes
Designed by User:PrySigneToFry and DeepSeek-R1 671b
Appeared in 2025
Memory system Unknown
Dimensions one-dimensional
Computational class Turing complete
Reference implementation Unimplemented
Influenced by 6 bits, 12 bytes
Influenced None
File extension(s) .pasm

Overview

16 bits, 256 bytes uses a 16 bit CPU and 256 bytes memory. There is also infinity memory mode.

Charmap

We use this charmap. It is modified ASCII.

. 0123456789ABCDEF
0 □┌┐└┘○●▲►▼◄◊☺☻♀♂
1 ♠♣♥♦♪♫♯←↑→↓↔↕░▒▓
2  !"#$%&'()*+,-./
3 0123456789:;<=>?
4 @ABCDEFGHIJKLMNO
5 PQRSTUVWXYZ[\]^_
6 `abcdefghijklmno
7 pqrstuvwxyz{|}~⌂
8 €‹›ẞƒ…†‡ˆ‰ŠſŒİŽı
9 fffiflffifflſtst—˜™šəœ⁴žŸ
A █¡¢£¤¥¦§¨©ª«¬▄®¯
B °±²³´▀¶·¸¹º»¼½¾¿
C ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ
D ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß
E àáâãäåæçèéêëìíîï
F ðñòóôõö÷øùúûüýþÿ

Memory type

We use registers and memory. All operations are 16-bit. We may also support variable in Unshackled dialect.

There are eight registers, they're AX, BX, CX, DX(originally A, B, C, D by DeepSeek), EX, FX, GX and HX. There are three flags. ZF indicates whether the result is 0 or not. It is a boolean value, and if the result is 0, it is true. SF is the symbol for the result. It is an integer, 1 is positive, 0 is 0, and -1 is negative. CF indicates whether a borrow or carry has occurred. CS and IP are instruction pointer, DS and DP are data. Stack may appear in future.

In assembled script, the numbers are base 16. Normal written numbers are base 10, B suffix means base 2, H means base 16(a000H is 0a000H instead, lowercase). In Unshackled dialect, you would also use decimals.

Commands

We use Shackled dialect. * means only Unshackled dialect.

Data moving

0A0B: Move the data in the register B into register A.
1ABB: Move the immediate number B to the register A.
2ABB: Move the content in memory address B to the register A.
3AAB: Move the content in register B to the memory address A.

Symbol form

MOV A, B
MOV A, IMM
MOV A, [B]
MOV [A], B

Arithmetic

From here, data in register B is shortened by B, data in register A also becomes A.

40AB: Add B into A. May occupy four words if in Unshackled dialect.
41AB: Multiply A by B.
42AB: Multiply A by A over and over for B times. If B is 0, set A to 1.
50AB: Subtract B from A.
51AB: Divide A by B, result in integer(or float if Unshackled).
52AB: Modulo A by B.
53AB*: Get the result of A^(1/B).
54AB*: Set the value of A to the logarithm of A with B as the base. If B is not specified, it is treated as a natural base (e) by default.
550A*: Rounds A towards 0.
560A*: Rounds A away from 0.
570A*: Rounds A as usual.
600A: Increase A by 1.
700A: Decrease A by 1.

Symbol form

ADD A, B
MUL A, B
EXP A, B
SUB A, B
DIV A, B
MOD A, B
NRT A, B
LOG A, B
FLR A
CEI A
RND A
INC A
DEC A

Variable*

This chapter is only for Unshackled.

61AB: Define a variable "A" with value B. Currently only supports integer.
62AB: Set A to B.

Symbol form

LET A, B
SET A, B

Logic

80AB: B = A AND B
90AB: B = A OR B
a0AB: B = A XOR B
b00A: A = ~A

Symbol form

AND A, B
OR  A, B
XOR A, B
NOT A

Jump

c0AA: Jump to address A with no condition.
c1AA: Jump to address A if ZF is 1.
c2AA: Jump to address A if ZF is 0.
c3AA: Jump to address A if SF is -1.
c4AA: Jump to address A if SF is 1.
c5AA: Jump to address A if ZF is 1 or SF is 1.
c6AA: Jump to address A if ZF is 1 or SF is -1.

Symbol form

JMP A
JEQ A
JNE A
JLT A
JGT A
JGE A
JLE A

Extension for Shackled

d0AB: Compare A with B, result in S.
f000: Halt.

Symbol form

CMP A, B
HLT

I/O

f1RP: Input R from the port P.
f2PR: Output R to the port P.
f3RP: Input R as character from the port P.
f4PR: Output R as character to the port P. Characters are quoted in ''.

Symbol form

IN  R, P
OUT P, R
REA R, P
WRT P. R

Function*

eBAA: Allocate address A with a function named "B". Arg_list are unshackled, and code block do so.
c7AA: Call the function at address A.

Examples

Hello, world!

Normal

DATA SEGMENT
    ALLOC BYTE 'Hello, world!', 13, 10, 0
DATA ENDS
CODE SEGMENT
START: 
    MOV DP, 0
GO: 
    MOV AX, DS
    WRT 1, AX
    INC DP
    CMP DS, 0
    JEQ GO
OK: 
    HLT
CODE ENDS
END START

Encoded

Dump: 48 65 6C 6C 6F 2C 20 77-6F 72 6C 64 21 0D 0A 00
Code: 19 00 00 08 F4 10 60 09-D0 80 C1 02 F0 00 00 00

Book from the sky style

Dump: Hello, world!☻◄□
Code: →□□►ô♠@▼ЀÁ┐ð□□□

Assembled(in UTF-16LE)

Dump: 效汬Ɐ眠牯摬ഡ
Code: �ࠀჴॠ胐ˁð

A+B Problem

Normal

DATA SEGMENT
    ALLOC BYTE DUP(16) 0
DATA ENDS
CODE SEGMENT
START:
    NOP
MAIN:
    IN  AX, 0
    IN  BX, 0
    ADD AX, BX
    OUT 1, AX
OK: 
    HLT
CODE ENDS
END START

Encoded

Dump: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
Code: 00 00 F1 00 F1 10 40 01 F2 10 FF 00 00 00 00 00

Book from the sky style

Dump: □□□□□□□□□□□□□□□□
Code: □□ñ□ñ♠@┌ò♠ÿ□□□□□

Assembled

Dump: 
Code:  ñჱ၀ŀჲÿ

Calculate 1 + 2 + ... + 100

Normal

DATA SEGMENT
    ALLOC BYTE DUP(16) 0
DATA ENDS
CODE SEGMENT
START:
    MOV BX, 1
    MOV EX, 100
GO:
    ADD AX, BX
    CMP BX, EX
    JEQ GO
OK:
    OUT 1, AX
    HLT
CODE ENDS
END START

Encoded

Dump: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
Code: 11 01 14 64 40 01 D0 14-C1 04 F2 10 FF 00 00 00

Book from the sky style

Dump: □□□□□□□□□□□□□□□□
Code: ♣┌♪d@┌Ð♪Á┘ò♠ÿ□□□

Assembled

Dump: 
Code: đ搔ŀᓐӁჲÿ

Categories and References