{"id":16361440,"url":"https://github.com/kirlovon/tiq","last_synced_at":"2025-07-26T12:33:33.407Z","repository":{"id":96129740,"uuid":"296943923","full_name":"Kirlovon/tiQ","owner":"Kirlovon","description":"Tiny 16bit fantasy console written in TypeScript 🕹","archived":false,"fork":false,"pushed_at":"2023-07-19T20:36:09.000Z","size":482,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T11:37:00.406Z","etag":null,"topics":["compiler","console","fantasy-console","ts","typescript","virtual-machine","vm","webpack"],"latest_commit_sha":null,"homepage":"https://kirlovon.dev/tiQ/web/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kirlovon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-19T20:10:07.000Z","updated_at":"2025-02-28T15:00:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"96f8f0b3-9f4f-4698-855a-092be426ed10","html_url":"https://github.com/Kirlovon/tiQ","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kirlovon/tiQ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirlovon%2FtiQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirlovon%2FtiQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirlovon%2FtiQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirlovon%2FtiQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kirlovon","download_url":"https://codeload.github.com/Kirlovon/tiQ/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kirlovon%2FtiQ/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267168760,"owners_count":24046707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","console","fantasy-console","ts","typescript","virtual-machine","vm","webpack"],"created_at":"2024-10-11T02:14:01.678Z","updated_at":"2025-07-26T12:33:33.362Z","avatar_url":"https://github.com/Kirlovon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/Kirlovon/tiQ/master/assets/logo.png\" alt=\"tiQ Logo\" width=\"256\"\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003etiQ\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\u003ci\u003eTiny 16bit fantasy console written in TypeScript\u003c/i\u003e\u003c/p\u003e\n\n\u003cbr\u003e\nA simple virtual console I made for training purposes. The project consists of a 16bit virtual machine, compiler, decompiler, CLI and web GUI.\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Table of Contents\n* [Specifications](#Specifications)\n* [Web GUI](#Web-GUI)\n* [CLI](#CLI)\n* [Instruction Set](#Instruction-Set)\n* [Assembly Syntax](#Assembly-Syntax)\n\n\u003cbr\u003e\n\n## Specifications\n* Display: **32x32 Black \u0026 White**\n* Input: **6 buttons**\n* Supports **16 Instructions**\n* Memory: **8kb** *(Can store up to 4096 instructions)*\n\n\u003cbr\u003e\n\n## Web GUI\n\nThe `/web` folder contains the web gui, through which you can run executable files. Also, GUI available here:\n\n#### [Try it here!](https://kirlovon.dev/tiQ/web/)\n\nThe console screen is rendered on Canvas element and the VM logs are printed in the DevTools console. Also, you can interact with the VM by stopping it, executing one step, or starting it up again.\n\n\u003cbr\u003e\n\n## CLI\n\nThis repository contains a CLI that you can use to compile source code and decompile binary files. Since CLI is written in TypeScript, you need to compile it first, or use `ts-node` utility.\n\nFor more information, type:\n```\nts-node ./source/cli.ts help\n```\n\n_Examples:_\n```\nts-node ./source/cli.ts compile source.tiq executable.bin\nts-node ./source/cli.ts decompile executable.bin source.tiq\n```\n\n\u003cbr\u003e\n\n## Instruction Set\n\nEach instruction consists of **16 bits**. **4 bits** used to store opcode *( type of instruction )*, and other **12 bits** to store arguments.\n\n* Algorithm used for building instructions: `(4096 * opcode) + argument`\n* Algorithm for draw instruction: `(4096 * 15) + (128 * x) + (4 * y) + (1 * color)`\n\n\n#### 0. NOTHING\nStore number from 0 to 4095.\n\n#### 1. LOAD, address\nLoad the number from the specified address into the accumulator.\n\n#### 2. SAVE, address\nSave accumulator value to specified memory address.\n\n#### 3. ADD, address\nAdd a number from the specified address to the accumulator.\n\n#### 4. SUBSTRACT, address\nSubtract from the accumulator the number from the specified address.\n\n#### 5. EQUAL, address\nSet accumulator value to 1 if the current accumulator value is the same as the value in the specified address. Otherwise, accumulator value will be set to 0.\n\n#### 6. LESS, address\nSet accumulator value to 1 if the current accumulator value less than value in the specified address. Otherwise, accumulator value will be set to 0.\n\n#### 7. GREATER, address\nSet accumulator value to 1 if the current accumulator value greater than value in the specified address. Otherwise, accumulator value will be set to 0.\n\n#### 8. AND, address\nSet accumulator value to 1 if the current accumulator and address values are positive _(greater than 0)_. Otherwise, accumulator value will be set to 0.\n\n#### 9. OR, address\nSet accumulator value to 1 if the current accumulator and address values equals to 0. Otherwise, accumulator value will be set to 0.\n\n#### 10. JUMP, address\nSet the counter _(current execution address)_, to the specified address.\nThe specified address will be executed on the next tick.\n\n#### 11. TRUE, address\nIf accumulator value is positive, set the counter to the specified address.\nThe specified address will be executed on the next tick.\n\n#### 12. FALSE, address\nIf accumulator value equals to 0, set the counter to the specified address.\nThe specified address will be executed on the next tick.\n\n#### 13. RANDOM, maximum\nSet the accumuator to random number between 0 and the specified maximum.\n\n#### 14. INPUT, key\nSet the accumulator to 1 if the specified button is pressed. If not pressed, the accumulator will be set to 0.\n\n#### 15. DISPLAY, x, y, color\nChange pixel color on specified coordinates. X and Y arguments must be between 0 and 31. Color argument must be 1 or 0.\n\n\u003cbr\u003e\n\n## Assembly Syntax\nThe best way to write tiQ programs is to use the **tiQ Assembler**, which can be translated into vm instructions using a compiler.\n\nSource code files must have the extension `.tiq`. For executable files it is best to use the `.bin` extension. \n\n### comments\nCompiler supports single line comments. Any text between `//` and the end of the line will be ignored.\n\n### begin \u0026 end\nEvery tiQ program begins and ends with these key words. Anything not in between will be ignored.\n\n_Example:_\n```js\nJust information, will not be processed\n\nbegin\n\t// Your code goes here\nend\n```\n\n### finish\nIndicates the end of program execution. During compilation this keyword will translate to 0. The result is the same as from `nothing, 0` or just `0`. \n\n### raw\nThe compiler supports raw instructions. You can specify an instruction as a number between 0 and 65535.\n\n_Example:_\n```js\nbegin\n\t0 // Same as finish keyword\n\t4098 // Same as load, 2 (Since 4096 * 1 + 2 will be 4098)\nend\n```\n\n### declare, _address_, _value_\nYou can declare a raw instruction or number at a specified address using the keyword `declare`. All declarations must be at the beginning of the program, since they will be processed only at compilation time. \n\n_Example:_\n```js\nbegin\n\tdeclare, 500, 1000 // Declare number 1000 on address 500\nend\n```\n\n### :_label_\nYou can specify the label using the format `:string`. To jump to label address, use the label as an argument instead of the address.\n\n_Example:_\n```js\nbegin\n\tjump, :here \n\tfinish // Will not be executed\n\n\t:here\n\t// Your code\nend\n```\n\n### nothing, _number_\nYou can declare a number using this keyword. The number must be between 0 and 4095.\n\n_Example:_\n```js\nbegin\n\tnothing, 100 // Declare number 100\nend\n```\n\n### load, _address_\nLoad the number from the specified address into the accumulator.\n\n_Example:_\n```js\nbegin\n\tdeclare, 1000, 99\n\tload, 1000 // Load value from address 1000 (Accumulator will be 99)\nend\n```\n\n### save, _address_\nSave accumulator value to specified address.\n\n### add, _address_\nAdd a number from the specified address to the accumulator.\n\n### substract, _address_\nSubtract from the accumulator the number from the specified address.\n\n### equal, _address_ \nSet accumulator value to 1 if the current accumulator value is the same as the value in the specified address. Otherwise, accumulator value will be set to 0.\n\n### less, _address_\nSet accumulator value to 1 if the current accumulator value less than value in the specified address. Otherwise, accumulator value will be set to 0.\n\n### greater, _address_\nSet accumulator value to 1 if the current accumulator value greater than value in the specified add\n\n### and, _address_\nSet accumulator value to 1 if the current accumulator and address values are positive _(greater than 0)_. Otherwise, accumulator value will be set to 0.\n\n### or, _address_\nSet accumulator value to 1 if the current accumulator and address values equals to 0. Otherwise, accumulator value will be set to 0.\n\n### jump, _address / label_\nSet the counter _(current execution address)_, to the specified address or label.\nThe specified address will be executed on the next tick.\n\n_Example:_\n```js\nbegin\n\t:start\n\tjump, :here\n\tnothing, 0 // Never will be executed\n\n\t:here\n\tjump, 0 // Jump to start label, because 0 is the beginning of the code.\nend\n```\n\n### true, _address / label_\nSame as jump, but will be executed only when current accumulator value is positive _(greater than 0)_.\n\n### false, _address / label_\nSame as jump, but will be executed only when current accumulator value equals to 0.\n\n### random, _maximum_\nSet the accumuator to random number between 0 and the specified maximum. Maximal possible value is 4095.\n\n### input, _key_\nSet the accumulator to 1 if the specified button is pressed. If not pressed, the accumulator will be set to 0.\n\n_Possible keys:_\n* **0** - arrow up.\n* **1** - arrow down.\n* **2** - arrow left.\n* **3** - arrow right.\n* **4** - key Z.\n* **5** - key X.\n\n### display, _x_, _y_, _color_\nChange pixel color on specified coordinates. X and Y arguments must be between 0 and 31. Color argument must be 1 or 0.\n\n_Example:_\n```js\nbegin\n\tdisplay, 0, 0, 1 // Set top left pixel to black\n\tdisplay, 31, 31, 1 // Set bottom right pixel to black\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirlovon%2Ftiq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirlovon%2Ftiq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirlovon%2Ftiq/lists"}