Chipish

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Language

Registers

Name Definition Short-hand
General Purpose 16 registers (byte) R1 to R16
Flag 12 registers (bit) F1 to F4, FT1 to FT8
Program Counter A register (3 bytes) PC
Index A register (3 bytes) I
Timer 8 registers (2 bytes) F1 to F8

Flag

Register Defintion
Greater (Comparison) If the first is greater than the second.
Equal (Comparison) If the first is equal than the second.
Underflow/Overflow (Math) If it resulted in an underflow or overflow.
Intersection (Sprite) If a sprite overlapped drawn pixels.

Timers

The remaining 8 flags are reserved for timers, Every flag is set by default since every timer is zero by default.

A timer flag is set if its assosiated timer has reached zero, otherwise not set. Every timer decreases by one every time the program ticks (causing it to wait 1/60 of a second) excluding timers that are zero.

Memory

Font memory

Each character sprite is 8x16 (128 pixels)

Font memory consists of 2048 unmodifiable bytes, that cannot be accessed normally and are used for displaying text character sprites.

Each character is stored as 16 bytes, in order.

Character Data
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 7E, 81, A5, 81, 81, BD, 99, 81, 81, 7E, 00, 00, 00, 00
00, 00, 7E, FF, DB, FF, FF, C3, E7, FF, FF, 7E, 00, 00, 00, 00
00, 00, 00, 00, 6C, FE, FE, FE, FE, 7C, 38, 10, 00, 00, 00, 00
00, 00, 00, 00, 10, 38, 7C, FE, 7C, 38, 10, 00, 00, 00, 00, 00
00, 00, 00, 18, 3C, 3C, E7, E7, E7, 18, 18, 3C, 00, 00, 00, 00
00, 00, 00, 18, 3C, 7E, FF, FF, 7E, 18, 18, 3C, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, 18, 3C, 3C, 18, 00, 00, 00, 00, 00, 00
FF, FF, FF, FF, FF, FF, E7, C3, C3, E7, FF, FF, FF, FF, FF, FF
00, 00, 00, 00, 00, 3C, 66, 42, 42, 66, 3C, 00, 00, 00, 00, 00
FF, FF, FF, FF, FF, C3, 99, BD, BD, 99, C3, FF, FF, FF, FF, FF
00, 00, 1E, 0E, 1A, 32, 78, CC, CC, CC, CC, 78, 00, 00, 00, 00
00, 00, 3C, 66, 66, 66, 66, 3C, 18, 7E, 18, 18, 00, 00, 00, 00
00, 00, 3F, 33, 3F, 30, 30, 30, 30, 70, F0, E0, 00, 00, 00, 00
00, 00, 7F, 63, 7F, 63, 63, 63, 63, 67, E7, E6, C0, 00, 00, 00
00, 00, 00, 18, 18, DB, 3C, E7, 3C, DB, 18, 18, 00, 00, 00, 00
00, 80, C0, E0, F0, F8, FE, F8, F0, E0, C0, 80, 00, 00, 00, 00
00, 02, 06, 0E, 1E, 3E, FE, 3E, 1E, 0E, 06, 02, 00, 00, 00, 00
00, 00, 18, 3C, 7E, 18, 18, 18, 7E, 3C, 18, 00, 00, 00, 00, 00
00, 00, 66, 66, 66, 66, 66, 66, 66, 00, 66, 66, 00, 00, 00, 00
00, 00, 7F, DB, DB, DB, 7B, 1B, 1B, 1B, 1B, 1B, 00, 00, 00, 00
00, 7C, C6, 60, 38, 6C, C6, C6, 6C, 38, 0C, C6, 7C, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, 00, FE, FE, FE, FE, 00, 00, 00, 00
00, 00, 18, 3C, 7E, 18, 18, 18, 7E, 3C, 18, 7E, 00, 00, 00, 00
00, 00, 18, 3C, 7E, 18, 18, 18, 18, 18, 18, 18, 00, 00, 00, 00
00, 00, 18, 18, 18, 18, 18, 18, 18, 7E, 3C, 18, 00, 00, 00, 00
00, 00, 00, 00, 00, 18, 0C, FE, 0C, 18, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 30, 60, FE, 60, 30, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, C0, C0, C0, FE, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 28, 6C, FE, 6C, 28, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 10, 38, 38, 7C, 7C, FE, FE, 00, 00, 00, 00, 00
00, 00, 00, 00, FE, FE, 7C, 7C, 38, 38, 10, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 18, 3C, 3C, 3C, 18, 18, 18, 00, 18, 18, 00, 00, 00, 00
00, 66, 66, 66, 24, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 6C, 6C, FE, 6C, 6C, 6C, FE, 6C, 6C, 00, 00, 00, 00
18, 18, 7C, C6, C2, C0, 7C, 06, 06, 86, C6, 7C, 18, 18, 00, 00
00, 00, 00, 00, C2, C6, 0C, 18, 30, 60, C6, 86, 00, 00, 00, 00
00, 00, 38, 6C, 6C, 38, 76, DC, CC, CC, CC, 76, 00, 00, 00, 00
00, 30, 30, 30, 60, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 0C, 18, 30, 30, 30, 30, 30, 30, 18, 0C, 00, 00, 00, 00
00, 00, 30, 18, 0C, 0C, 0C, 0C, 0C, 0C, 18, 30, 00, 00, 00, 00
00, 00, 00, 00, 00, 66, 3C, FF, 3C, 66, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 18, 18, 7E, 18, 18, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, 00, 00, 18, 18, 18, 30, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, FE, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 18, 18, 00, 00, 00, 00
00, 00, 00, 00, 02, 06, 0C, 18, 30, 60, C0, 80, 00, 00, 00, 00
00, 00, 38, 6C, C6, C6, D6, D6, C6, C6, 6C, 38, 00, 00, 00, 00
00, 00, 18, 38, 78, 18, 18, 18, 18, 18, 18, 7E, 00, 00, 00, 00
00, 00, 7C, C6, 06, 0C, 18, 30, 60, C0, C6, FE, 00, 00, 00, 00
00, 00, 7C, C6, 06, 06, 3C, 06, 06, 06, C6, 7C, 00, 00, 00, 00
00, 00, 0C, 1C, 3C, 6C, CC, FE, 0C, 0C, 0C, 1E, 00, 00, 00, 00
00, 00, FE, C0, C0, C0, FC, 06, 06, 06, C6, 7C, 00, 00, 00, 00
00, 00, 38, 60, C0, C0, FC, C6, C6, C6, C6, 7C, 00, 00, 00, 00
00, 00, FE, C6, 06, 06, 0C, 18, 30, 30, 30, 30, 00, 00, 00, 00
00, 00, 7C, C6, C6, C6, 7C, C6, C6, C6, C6, 7C, 00, 00, 00, 00
00, 00, 7C, C6, C6, C6, 7E, 06, 06, 06, 0C, 78, 00, 00, 00, 00
00, 00, 00, 00, 18, 18, 00, 00, 00, 18, 18, 00, 00, 00, 00, 00
00, 00, 00, 00, 18, 18, 00, 00, 00, 18, 18, 30, 00, 00, 00, 00
00, 00, 00, 06, 0C, 18, 30, 60, 30, 18, 0C, 06, 00, 00, 00, 00
00, 00, 00, 00, 00, 7E, 00, 00, 7E, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 60, 30, 18, 0C, 06, 0C, 18, 30, 60, 00, 00, 00, 00
00, 00, 7C, C6, C6, 0C, 18, 18, 18, 00, 18, 18, 00, 00, 00, 00
00, 00, 00, 7C, C6, C6, DE, DE, DE, DC, C0, 7C, 00, 00, 00, 00
00, 00, 10, 38, 6C, C6, C6, FE, C6, C6, C6, C6, 00, 00, 00, 00
00, 00, FC, 66, 66, 66, 7C, 66, 66, 66, 66, FC, 00, 00, 00, 00
00, 00, 3C, 66, C2, C0, C0, C0, C0, C2, 66, 3C, 00, 00, 00, 00
00, 00, F8, 6C, 66, 66, 66, 66, 66, 66, 6C, F8, 00, 00, 00, 00
00, 00, FE, 66, 62, 68, 78, 68, 60, 62, 66, FE, 00, 00, 00, 00
00, 00, FE, 66, 62, 68, 78, 68, 60, 60, 60, F0, 00, 00, 00, 00
00, 00, 3C, 66, C2, C0, C0, DE, C6, C6, 66, 3A, 00, 00, 00, 00
00, 00, C6, C6, C6, C6, FE, C6, C6, C6, C6, C6, 00, 00, 00, 00
00, 00, 3C, 18, 18, 18, 18, 18, 18, 18, 18, 3C, 00, 00, 00, 00
00, 00, 1E, 0C, 0C, 0C, 0C, 0C, CC, CC, CC, 78, 00, 00, 00, 00
00, 00, E6, 66, 66, 6C, 78, 78, 6C, 66, 66, E6, 00, 00, 00, 00
00, 00, F0, 60, 60, 60, 60, 60, 60, 62, 66, FE, 00, 00, 00, 00
00, 00, C6, EE, FE, FE, D6, C6, C6, C6, C6, C6, 00, 00, 00, 00
00, 00, C6, E6, F6, FE, DE, CE, C6, C6, C6, C6, 00, 00, 00, 00
00, 00, 7C, C6, C6, C6, C6, C6, C6, C6, C6, 7C, 00, 00, 00, 00
00, 00, FC, 66, 66, 66, 7C, 60, 60, 60, 60, F0, 00, 00, 00, 00
00, 00, 7C, C6, C6, C6, C6, C6, C6, D6, DE, 7C, 0C, 0E, 00, 00
00, 00, FC, 66, 66, 66, 7C, 6C, 66, 66, 66, E6, 00, 00, 00, 00
00, 00, 7C, C6, C6, 60, 38, 0C, 06, C6, C6, 7C, 00, 00, 00, 00
00, 00, 7E, 7E, 5A, 18, 18, 18, 18, 18, 18, 3C, 00, 00, 00, 00
00, 00, C6, C6, C6, C6, C6, C6, C6, C6, C6, 7C, 00, 00, 00, 00
00, 00, C6, C6, C6, C6, C6, C6, C6, 6C, 38, 10, 00, 00, 00, 00
00, 00, C6, C6, C6, C6, D6, D6, D6, FE, EE, 6C, 00, 00, 00, 00
00, 00, C6, C6, 6C, 7C, 38, 38, 7C, 6C, C6, C6, 00, 00, 00, 00
00, 00, 66, 66, 66, 66, 3C, 18, 18, 18, 18, 3C, 00, 00, 00, 00
00, 00, FE, C6, 86, 0C, 18, 30, 60, C2, C6, FE, 00, 00, 00, 00
00, 00, 3C, 30, 30, 30, 30, 30, 30, 30, 30, 3C, 00, 00, 00, 00
00, 00, 00, 80, C0, E0, 70, 38, 1C, 0E, 06, 02, 00, 00, 00, 00
00, 00, 3C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 0C, 3C, 00, 00, 00, 00
10, 38, 6C, C6, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, FF, 00, 00
30, 30, 18, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 00, 78, 0C, 7C, CC, CC, CC, 76, 00, 00, 00, 00
00, 00, E0, 60, 60, 78, 6C, 66, 66, 66, 66, 7C, 00, 00, 00, 00
00, 00, 00, 00, 00, 7C, C6, C0, C0, C0, C6, 7C, 00, 00, 00, 00
00, 00, 1C, 0C, 0C, 3C, 6C, CC, CC, CC, CC, 76, 00, 00, 00, 00
00, 00, 00, 00, 00, 7C, C6, FE, C0, C0, C6, 7C, 00, 00, 00, 00
00, 00, 38, 6C, 64, 60, F0, 60, 60, 60, 60, F0, 00, 00, 00, 00
00, 00, 00, 00, 00, 76, CC, CC, CC, CC, CC, 7C, 0C, CC, 78, 00
00, 00, E0, 60, 60, 6C, 76, 66, 66, 66, 66, E6, 00, 00, 00, 00
00, 00, 18, 18, 00, 38, 18, 18, 18, 18, 18, 3C, 00, 00, 00, 00
00, 00, 06, 06, 00, 0E, 06, 06, 06, 06, 06, 06, 66, 66, 3C, 00
00, 00, E0, 60, 60, 66, 6C, 78, 78, 6C, 66, E6, 00, 00, 00, 00
00, 00, 38, 18, 18, 18, 18, 18, 18, 18, 18, 3C, 00, 00, 00, 00
00, 00, 00, 00, 00, EC, FE, D6, D6, D6, D6, C6, 00, 00, 00, 00
00, 00, 00, 00, 00, DC, 66, 66, 66, 66, 66, 66, 00, 00, 00, 00
00, 00, 00, 00, 00, 7C, C6, C6, C6, C6, C6, 7C, 00, 00, 00, 00
00, 00, 00, 00, 00, DC, 66, 66, 66, 66, 66, 7C, 60, 60, F0, 00
00, 00, 00, 00, 00, 76, CC, CC, CC, CC, CC, 7C, 0C, 0C, 1E, 00
00, 00, 00, 00, 00, DC, 76, 66, 60, 60, 60, F0, 00, 00, 00, 00
00, 00, 00, 00, 00, 7C, C6, 60, 38, 0C, C6, 7C, 00, 00, 00, 00
00, 00, 10, 30, 30, FC, 30, 30, 30, 30, 36, 1C, 00, 00, 00, 00
00, 00, 00, 00, 00, CC, CC, CC, CC, CC, CC, 76, 00, 00, 00, 00
00, 00, 00, 00, 00, 66, 66, 66, 66, 66, 3C, 18, 00, 00, 00, 00
00, 00, 00, 00, 00, C6, C6, D6, D6, D6, FE, 6C, 00, 00, 00, 00
00, 00, 00, 00, 00, C6, 6C, 38, 38, 38, 6C, C6, 00, 00, 00, 00
00, 00, 00, 00, 00, C6, C6, C6, C6, C6, C6, 7E, 06, 0C, F8, 00
00, 00, 00, 00, 00, FE, CC, 18, 30, 60, C6, FE, 00, 00, 00, 00
00, 00, 0E, 18, 18, 18, 70, 18, 18, 18, 18, 0E, 00, 00, 00, 00
00, 00, 18, 18, 18, 18, 00, 18, 18, 18, 18, 18, 00, 00, 00, 00
00, 00, 70, 18, 18, 18, 0E, 18, 18, 18, 18, 70, 00, 00, 00, 00
00, 00, 76, DC, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
00, 00, 00, 00, 10, 38, 6C, C6, C6, C6, FE, 00, 00, 00, 00, 00

Regular memory

Regular memory consists of 16777216 bytes. (16 Megabytes) This memory is used for everything including program memory (which is loaded into the beginning of memory).

Persistent memory

Persistent memory also consists of 16777216 bytes. (16 Megabyte) This memory is used for storing data across sessions if needed.

Instructions

Definitions

These definitions apply to instruction arguments unless specified otherwise.

Negative values are represented using 2's complement.

Name Definition
Value 8-bit value.
Register A general purpose register.

Bitwise

Name Rule Example
Bitwise NOT The input bit is not set NOT 01101001
Bitwise AND Both input bits are set 1100 AND 01100100
Bitwise OR Either of the input bits are set 1100 OR 01101110
Bitwise XOR Both input bits aren't set or unset 1100 XOR 01101010
Bitwise LSH Bits are shifted to the left 0110110 LSH 2 → 1011000
Bitwise RSH Bits are shifted to the right 0110110 RSH 2 → 0001101

Index

Name Arguments Definition
Reset I None Set I to zero
Add to I Register Add register to I
Subtract from I Register Subtract register from I
Left shift I None Left shift I by one byte
Set least-byte of I Register Set least-significant byte of I to register
Get most-byte of I Register Set register to most-significant byte of I

Memory & Registers

Name Arguments Definition
Set register (Value) Register, Value Set register to value
Set register (Register) Register, Register Set 1st register to 2nd register
Set byte (Regular) Register Set byte at I to register (in regular memory)
Set byte (Persistent) Register Set byte at I to register (in persistent memory)
Get byte (Regular) Register Set register to byte at I (in regular memory)
Get byte (Persistent) Register Set register to byte at I (in persistent memory)

Timing

Name Arguments Definition
Set timer Timer register, Register Set timer register to register
Get timer Register, Timer Register Set register to timer register
Tick once None Pause execution until next 1/60 of a second, tick down every timer
Tick until timer Timer register Continously tick until the timer has reached zero

Jump

Name Arguments Definition
Get PC None Set I to PC
Set PC None Set PC to I
Set PC if flag Flag Register If flag is set, Set PC to I
Set PC if not flag Flag Register If flag is not set, Set PC to I

Comparison

Name Arguments Definition
Compare register greater (Value) Register, Value Set greater flag if register equals value, otherwise not set.
Compare register greater (Register) Register, Register Set greater flag if 1st register equals 2nd register, otherwise not set.
Compare register equal (Value) Register, Value Set equal flag if register equals value, otherwise not set.
Compare register equal (Register) Register, Register Set equal flag if 1st register equals 2nd register, otherwise not set.

Math

Name Arguments Definition
Add to register Register, Value Add 2nd register to 1st register
Subtract from register Register, Value Subtract 2nd register from 1st register
Subtract from register (Inverse) Register, Register Set 1st register to itself subtracted from 2nd register
Multiply register Register, Register Multiply 1st register by 2nd register
Divide register Register, Register Divide 1st register by 2nd register
Divide register (Inverse) Register, Register Set 1st register to 2nd register divided by itself
Divide register (Remainder) Register, Register, Register Divide 1st register by 2nd register, Set 3rd register to remainder
Divide register (Inverse) Register, Register, Register Set 1st register to 2nd register divided by itself, Set 3rd register to remainder

Bitwise

Name Arguments Definition
Bitwise NOT Register Bitwise NOT 1st register
Bitwise AND Register, Register Bitwise AND 1st register with 2nd register
Bitwise OR Register, Register Bitwise OR 1st register with 2nd register
Bitwise XOR Register, Register Bitwise XOR 1st register with 2nd register
Bitwise LSH Register, Register Bitwise LSH 1st register by 2nd register
Bitwise RSH Register, Register Bitwise RSH 1st register by 2nd register


TODO:

   Categories
   Instructions
       Keyboard
       Maybe Mouse?
       Audio
       Visual (Pixels)
   Add a language section explaining it

This doesn't seem very esolang-y