{"id":19297197,"url":"https://github.com/jserv/full-stack-hello","last_synced_at":"2025-04-22T08:31:12.955Z","repository":{"id":119593856,"uuid":"92198893","full_name":"jserv/full-stack-hello","owner":"jserv","description":"minimal instruction set and assembler/compiler for \"Hello World\" execution","archived":false,"fork":false,"pushed_at":"2020-12-28T14:42:53.000Z","size":77,"stargazers_count":115,"open_issues_count":6,"forks_count":51,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-14T03:52:46.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jserv.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-23T17:07:01.000Z","updated_at":"2025-03-27T06:23:27.000Z","dependencies_parsed_at":"2023-06-02T15:30:21.085Z","dependency_job_id":null,"html_url":"https://github.com/jserv/full-stack-hello","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Ffull-stack-hello","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Ffull-stack-hello/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Ffull-stack-hello/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Ffull-stack-hello/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jserv","download_url":"https://codeload.github.com/jserv/full-stack-hello/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250206144,"owners_count":21392194,"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","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":[],"created_at":"2024-11-09T23:01:47.469Z","updated_at":"2025-04-22T08:31:12.949Z","avatar_url":"https://github.com/jserv.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# full-stack-hello\n\n`full-stack-hello` is a minimal virtual machine kit capable of performing\ntasks at any level of the technical stack on which a typical 'Hello World'\nprogram execution depends. It means:\n* Instruction Set Architecture (ISA);\n* Virtual machine implementing the ISA;\n* Assembly and/or Compiler following the ISA;\n* Runtime support such as standard libraries and ELF;\n\n## Instruction set\n\n| Opcode  | Description |\n| ------------- | ------------- |\n| OP_ADD | sum two operands |\n| OP_SUB | subtract two operands |\n| OP_MUL | multiply two operands |\n| OP_DIV | divide two two operands |\n| OP_MOD | Modulo, remainder of operand 1 divided by operand 2 |\n| OP_PRINT | print integer or string |\n| OP_JLT | jump to specified address (in operand 2) if operand 1 is less than 0 |\n| OP_JLE | jump to specified address (in operand 2) if operand 1 is less than or equal to 0 |\n| OP_JZ | jump to specified address (in operand 2) if operand 1 is equal to 0 |\n| OP_JGE | jump to specified address (in operand 2) if operand 1 is greater than or equal to 0 |\n| OP_JGT | jump to specified address (in operand 2) if operand 1 is greater than 0 |\n| OP_JNZ | jump to specified address (in operand 2) if operand 1 is not equal to 0 |\n| OP_JMP | jump to specified address |\n| OP_CALL | call to specified address |\n| OP_RET | return to where called from |\n| OP_HALT | terminate VM |\n\n## Assembly Notation\n\n* Registers are specified by `#` as temporary storage.\n    * `print #1` dumps the content of register `#1`.\n* An immediate value (or simply an immediate or imm) is a piece of data that\nis stored as part of the instruction itself instead of being in a memory\nlocation or a register.\n    * `mul $-2 $2 #4` stores the result of `(-2) * (2)` into register `#4`.\n* A valid Label name ends with `:` and is referred as `:X` in any JMP/CALL\n  instructions to jump to label `X`.\n    ```\n    A:\n    print $1\n    jmp :A\n    ```\n    * Infinite loop that dumps constant `1`.\n\n## Build and Verify\n\n```shell\n$ make\ncc -Wall -std=gnu99 -g -c -o vm.o -MMD -MF .vm.o.d vm.c\ncc -Wall -std=gnu99 -g -c -o as.o -MMD -MF .as.o.d as.c\ncc -Wall -std=gnu99 -g -c -o driver.o -MMD -MF .driver.o.d driver.c\ncc -Wall -std=gnu99 -g -o as_exec vm.o as.o driver.o\n$ make check\n42\ntests/halt.s pass\n\nHello World\ntests/hello.s pass\n\n42\n50\n150\ntests/test.s pass\n\n$ make test\npython tests/run_tests.py\n..\n----------------------------------------------------------------------\nRan 4 tests in 0.002s\n\nOK\n```\n\n## Assembler Usage\nSpecify -h to obtain the description of the assembler.\n```\n$ ./as_exec -h\nUsage: as_exec [-w] [-x] [-o \u003cout_file\u003e] \u003cin_file\u003e\n       -w Assemble \u003cin_file\u003e and write to an ELF file, see -o below\n       -o if -w is specifed, \u003cout_file\u003e is used to store the object code\n       -x Load \u003cin_file\u003e and execute it\n\n       \u003cin_file\u003e the file name to be used by commands above\n```\nFor example, if the assembly file in concern is tests/coverage.s\n1. Assemble an assembly source file and evaluate (execute) it.\n   ```\n   ./as_exec tests/hello.s\n   ```\n2. Assemble an assembly source file and write to default ELF file tests/hello.o.\n   ```\n   ./as_exec -w tests/hello.s\n   ```\n3. Assemble an assembly source file and write to default ELF file tests/temp.o.\n   ```\n   ./as_exec -o tests/temp.o -w tests/hello.s\n   ```\n4. Laod an assembled ELF file tests/hello.o and evaluate (rexcute) it.\n   ```\n   ./as_exec -x tests/hello.o\n   ```\nThe common ELF tools, such as objdump, can be applied to the output ELF file.\n```\nobjdump -x tests/hello.o\n```\nCurrently, the ELF support is very limited and could be improved.\n\n## Licensing\n`full-stack-hello` is freely redistributable under the two-clause BSD License.\nUse of this source code is governed by a BSD-style license that can be found\nin the `LICENSE` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Ffull-stack-hello","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjserv%2Ffull-stack-hello","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Ffull-stack-hello/lists"}