{"id":13411430,"url":"https://github.com/docandrew/YOTROC","last_synced_at":"2025-03-14T17:30:52.242Z","repository":{"id":133213279,"uuid":"232169141","full_name":"docandrew/YOTROC","owner":"docandrew","description":"Assembler/Emulator for Fictional YOTROC Architecture","archived":false,"fork":false,"pushed_at":"2020-01-06T19:26:23.000Z","size":158,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:45:48.729Z","etag":null,"topics":["ada","gtkada"],"latest_commit_sha":null,"homepage":null,"language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docandrew.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}},"created_at":"2020-01-06T19:21:32.000Z","updated_at":"2022-03-11T22:29:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"f53071f0-4078-4f06-8647-13b9d3e983b8","html_url":"https://github.com/docandrew/YOTROC","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/docandrew%2FYOTROC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docandrew%2FYOTROC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docandrew%2FYOTROC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docandrew%2FYOTROC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docandrew","download_url":"https://codeload.github.com/docandrew/YOTROC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618632,"owners_count":20320268,"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":["ada","gtkada"],"created_at":"2024-07-30T20:01:13.612Z","updated_at":"2025-03-14T17:30:51.900Z","avatar_url":"https://github.com/docandrew.png","language":"Ada","funding_links":[],"categories":["Applications"],"sub_categories":["Shells, Interpreters and Emulators"],"readme":"Introduction\r\n============\r\n\r\n![YOTROC Logo](YotRoc.jpg \"An architecture as full and rich as Michael McDonald's Beard.\")\r\n\r\n**YOTROC** is a CPU architecture that powers the next generation of\r\nover-priced toys for the discerning luxury shopper. Cost is no object,\r\nand power consumption is somebody else's problem. Inspired by\r\nYacht Rock Radio on SiriusXM.\r\n\r\nThe **YOTROC** IDE, assembler and virtual machine were created by Jon\r\nAndrew for Syracuse CIS655, Fall 2019.\r\n\r\n**YOTROC** offers:\r\n64 general-purpose registers,\r\n64 floating-point registers and 64-bit-ish arithmetic.\r\n\r\nThe YOTROC IDE\r\n==============\r\n\r\n![YOTROC Screenshot](YOTROCScreenshot.jpg \"Relax, and enjoy the cool ocean breeze.\")\r\n\r\nThe **YOTROC** IDE allows you to open, save files and assemble them to object\r\ncode for execution in the **YOTROC** Virtual Machine. In the **YOTROC** VM,\r\nyou can inspect registers and step through instructions.\r\n\r\nAssembly syntax:\r\n================\r\n\r\nComments\r\n--------\r\nComments start with `;` and stop at the end of a line.\r\n\r\n    ; this is a comment\r\n\r\nAssembly directives start with `%`.\r\n-----------------------------------\r\n\r\n    %define myvar 1234  ; defines an identifier called \"myvar\" with value 1234.\r\n    add R1 R2 myvar     ; adds value 1234 to R2, places result in R1.\r\n\r\nLabels\r\n------\r\nLabels start with `@` and have an identifier and can be used as a destination\r\nfor jump instructions. You can think of it as defining an identifier with\r\nvalue of whatever address it is at.\r\n\r\n    @loop               ; defines a label at this address\r\n    ; other stuff\r\n    cmp R1 R2           ; compare contents of R1 and R2\r\n    jne loop            ; if they aren't equal, jump to @loop\r\n\r\nNote that `%define`d identifiers and labels cannot use the name of a register,\r\nmust start with a letter and contain only letters and numbers. Identifiers \r\nand labels are case-*insensitive*.\r\n\r\nLiterals\r\n========\r\nThe **YOTROC** assembler supports numeric literals only, and must be in Ada format\r\nfor bases other than 10. So 0xFFFF needs to be written as `16#FFFF#`. 0b10101 \r\nwould be written as `2#10101#`. Decimal (base 10) numbers are used by default, \r\nso `1042` and `12.4` are both valid numeric literals. Note that underscores are \r\nignored, and can be used to make reading long numeric literals easier. For \r\nexample: `16#FFFF_8000_0000_0000#` is a valid 64-bit numeric literal in \r\nYOTROC assembler.\r\n\r\nAddressing Modes\r\n================\r\n\r\nImmediate Addressing (limited to signed 32-bit values)\r\n------------------------------------------------------\r\nUse a constant value, or value previously assigned to an identifier or label.\r\n\r\n    l32 R1 1000       ; load register R1 with 1000\r\n    l32 R2 myvar      ; load register R2 with contents of \"myvar\" identifier.\r\n\r\nRegister Addressing\r\n-------------------\r\nUse the contents of a register, or store into a register\r\n\r\n    l64 R1 R2         ; load the contents of R2 into R1\r\n\r\nRegister Indirect\r\n-----------------\r\nIndirect addressing uses the register value as a pointer to memory. For\r\nfamiliarity, the **YOTROC** assembler uses C-style pointer syntax. Note that\r\nthis is just a short-hand for the offset address `*(Rx + 0)`.\r\n\r\n    l32 R1 16#BEEF#;  ; load R1 with the value 0xBEEF.\r\n    s32 42 *R1        ; store the value 42 into the memory address 0xBEEF.\r\n\r\nDisplacement\r\n------------\r\nDisplacement (or Offset) addressing uses a base address + displacement, \r\nwhere the base address must be a value\r\nin a register. The syntax is `*(\u003cGPR\u003e + \u003cOFFSET\u003e)`, where GPR is a \r\ngeneral purpose register, and offset is a 32-bit immediate.\r\n\r\n    l32 R1 16#CAFD#   ; load R1 with the value 0xCAFD\r\n    s32 42 *(R1 + 1)  ; store the value 42 into the memory address 0xCAFE.\r\n\r\nInstruction Reference\r\n=====================\r\n\r\nZero operand instructions (J TYPE)\r\n----------------------------------\r\n        relax       ; just chill. Called \"nop\" in less luxurious architectures.\r\n        avast       ; pull this Yacht back into port and shut down.\r\n        ret         ; return from function to address in link register (R63)\r\n\r\nLOAD/STORE instructions (A,B,C,D TYPE, depending on operands)\r\n-------------------------------------------------------------\r\nLOAD: TO: Register, FROM: register, register indirect, displacement, immediate\r\n\r\n        l8\r\n        l16\r\n        l32         ; load lower half (for immediates)\r\n        l32u        ; load upper half (for immediates)\r\n        l64\r\n\r\nSTORE: FROM: Register, TO: register indirect, displacement\r\n\r\n        s8          ; R1 \u003clocation\u003e -- Put lower 8 bits of R1's contents in \u003clocation\u003e\r\n        s16\r\n        s32\r\n        s64         ; R1 \u003clocation\u003e -- Put all 64bits of R1's contents in \u003clocation\u003e\r\n\r\nSingle-Bit instructions (G TYPE)\r\n--------------------------------\r\n        btc         ; R1 bit   -- R1 = R1 and (not 1 \u003c\u003c bit) (bit clear)\r\n        bts         ; R1 bit   -- R1 = R1 or (1 \u003c\u003c bit)      (bit set)\r\n        tb          ; R1 bit   -- test bit, sets Zero flag \r\n\r\nArithmetic (3 operand) instructions (E TYPE)\r\n--------------------------------------------\r\n        add         ; R1 R2 R3 : R1 = R2 + R3\r\n        sub         ; R1 R2 R3 : R1 = R2 - R3\r\n        mul         ; R1 R2 R3 : R1 = R2 * R3\r\n        div         ; R1 R2 R3 : R1 = R2 / R3\r\n\r\nFloating-Point Arithmetic Operations (E TYPE)\r\n---------------------------------------------\r\n        fadd        ; f1 f2 f3 (FP)\r\n        fsub        ; f1 f2 f3 (FP)\r\n        fmul        ; f1 f2 f3 (FP)\r\n        fdiv        ; f1 f2 f3 (FP)\r\n\r\n(Note: append 'b' here for \"bitwise\", but also because they're keywords in Ada.)\r\n\r\n        modb        ; R1 R2 R3 : R1 = R2 mod R3\r\n        orb         ; R1 R2 R3 : R1 = R2 or R3  (bitwise)\r\n        andb        ; R1 R2 R3 : R1 = R2 and R3 (bitwise)\r\n        xorb        ; R1 R2 R3 : R1 = R2 xor R3 (bitwise)\r\n\r\nYACHT instructions\r\n------------------\r\nCalculate compound interest:\r\n\r\n        int         ; R1 R2 R3 : R1 = Principal, R2 = interest rate (float),\r\n                    ;  R3 = time. Assumes annual compounding. Stores result back in\r\n                    ; R1.\r\n\r\nArithmetic (2 operand) instructions (F TYPE)\r\n--------------------------------------------\r\n2-operand YACHT instructions\r\n\r\n        knots       ; f1 f2   : convert R1 miles per hour into R1 knots.\r\n        miles       ; f1 f2   : convert R2 knots to R1 miles per hour.\r\n\r\nFLOATING-POINT CONVERSIONS\r\n\r\n        itd         ; f1 R1   : convert integer value in R1 to a double in f1.\r\n        std         ; f1 f2   : f1 = f2, f2 has a single-precision FP value, and f1 will be double-precision.\r\n\r\nCOUNT BITS\r\n\r\n        cb          ; R1 R2   : R1 = # of bits set in R2\r\n\r\nLOGICAL SHIFTS\r\n\r\n        shll        ; R1 R2   : R1 \u003c\u003c R2\r\n        shrl        ; R1 R2   : R1 \u003e\u003e R2\r\n\r\nCOMPARISON\r\n\r\n        cmp         ; R1 R2   : compare contents in registers\r\n\r\nOne-Operand Instructions (I-Type)\r\n---------------------------------\r\nBITWISE NOT\r\n\r\n        notb        ; R1      : R1 = ~R1 (bitwise)\r\n\r\nBRANCHES\r\n\r\n        jmp         ; R1      : jump unconditional\r\n        jz          ; R1      : jump to address in R if zero flag set\r\n        jeq         ; R1      : jump to address in R if if comparison was equal\r\n        jne         ; R1      : jump to address in R if not equal\r\n        jlt         ; R1      : jump to address in R if less than\r\n        jgt         ; R1      : jump to address in R if greater than\r\n\r\nFUNCTION CALLS\r\n\r\n        call        ; R1       : call function (jump and link, set R63 to next instruction on return.)\r\n\r\nOne-Operand Immediate Instructions (H-Type)\r\n-------------------------------------------\r\n\"Jump Absolute\"\r\n\r\n        jmpa        ; immed. address\r\n        jza        \r\n        jeqa       \r\n        jnea       \r\n        jlta       \r\n        jgta \r\n\r\nLimitations \u0026 Known Issues\r\n==========================\r\n\r\nYOTROC Virtual Machine\r\n----------------------\r\nDirect address jumps are limited to 32-bit absolute addresses for now. It would\r\nbe nice to support an option for PC-relative addressing in the future, perhaps\r\nby using one of the reserved opcode bits.\r\n\r\nThe YOTROC architecture is strictly 64-bit *word* addressable for the time being.\r\nThis is strictly a limitation of the VM. Future releases should change to be \r\nbyte-addressable.\r\n\r\nFloating-point immediates are all limited to single-precision, but arithmetic\r\noperations all require and expect double-precision operands. You can use the\r\n\"std\" instruction to convert single-precision FP values in registers to\r\ndouble-precision. The \"itd\" instruction converts integer values to\r\nfloating-point values.\r\n\r\nThe YOTROC VM is set up to use 256 words of memory, this limitation is\r\nbaked in to the source code.\r\n\r\nYOTROC IDE\r\n----------\r\nThe file menu doesn't support adding your own name for new files, so you\r\nneed to create an empty file first, and then select it when you Save As.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocandrew%2FYOTROC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocandrew%2FYOTROC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocandrew%2FYOTROC/lists"}