GithubHelp home page GithubHelp logo

belivenn / hello-solana-asm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deanmlittle/hello-solana-asm

0.0 0.0 0.0 7 KB

Hello, World! - written in sBPF (Solana eBPF) assembly.

Assembly 4.84% TypeScript 63.91% Makefile 31.25%

hello-solana-asm's Introduction

Hello, Solana!

A simple SBF (Solana eBPF) Assembly program that prints "Hello, Solana!" using sol_log. Includes fully-annotated code below, along with a Makefile, linker file, build, deploy and test scripts.

.globl e                     ; e - "entrypoint" but 9 bytes cheaper!
e:
    lddw r1, message         ; load address of "message" into r1
    lddw r2, 14              ; load "14" (our string length) into r2
    call sol_log_            ; call sol_log_ - this reads from r1 and r2
    # r0 = 0                 ; r0 is already 0 (SUCCESS). Let's save 1 CU.
    exit
.extern sol_log_             ; declare external symbol "sol_log_"
.section .rodata             ; read-only data section
message:
    .ascii "Hello, Solana!"  ; define "message" as used above

The program and its linker file have been reasonably well-optimized to remove junk we don't need, leading to a compiled program size of just 1,168 bytes, and consuming just 104 CUs.

hello-solana-asm's People

Contributors

deanmlittle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.