Jupiter
GitHub
EN
EN
  • Jupiter
  • License
  • Installation
    • Linux
    • macOS
      • Option 1: App Image
      • Option 2: Build From Source
    • Windows
      • Option 1: App Image
      • Option 2: Build From Source
    • Docker Image
  • User Guide
    • GUI Mode
    • CLI Mode
  • Assembler
    • Directives
    • Ecalls
    • Instructions
  • External Resources
    • RISC-V Instruction Set Manual
    • RISC-V Green Card (Cambridge)
    • RISC-V Green Card (Berkeley)
    • The RISC-V Reader
Powered by GitBook
On this page
  • .file
  • .zero
  • .string
  • .ascii
  • .byte
  • .half
  • .word
  • .float
  • .align
  • .balign
  • .globl
  • .section
  • .data
  • .text
  • .rodata
  • .bss

Was this helpful?

  1. Assembler

Directives

PreviousCLI ModeNextEcalls

Last updated 5 years ago

Was this helpful?

Jupiter supports most common assembler directives, including some indicated .

.file

Emits filename.

Usage

.file <filename>

Example

.file "/home/ubuntu/Desktop/lab10.s"

Arguments

  • filename: quoted filename

Aliases

  • none

.zero

Reserves the specified number of bytes.

Usage

.zero <value>

Example

.zero 10 # reserves 10 bytes

Arguments

  • value: (should be > 0)

Aliases

  • .space

.string

Stores the string and adds null terminator.

Usage

.string <string>

Example

.string "hello world" 

Arguments

  • string: quoted string

Aliases

  • .asciiz, .asciz

.ascii

Stores the string and does not add null terminator.

Usage

.ascii <string>

Example

.ascii "Hello world"

Arguments

  • string: quoted string

Aliases

  • none

.byte

Store the listed value(s) as 8 bit bytes.

Usage

.byte <list>

Example

.byte 10, 50
.byte 2

Arguments

  • list: 8-bit comma separated bytes

Aliases

  • none

.half

Store the listed value(s) as 16-bit half words.

Usage

.half <list>

Example

.half 1, 2, 3
.half 10

Arguments

  • list: 16-bit comma separated half words

Aliases

  • .short, .2byte

.word

Store the listed value(s)/symbol(s) as 32 bit words.

Usage

.word <list>

Example

.word 1, 3, 5, 7
.word 0xcafe

Arguments

  • list: 32-bit comma separated words or comma separated symbols

Aliases

  • .long, .4byte

.float

Store the listed value(s) as 32 bit float values.

Usage

.float <list>

Example

.float 1e-4, 1.2, 0.005
.float 3.1416

Arguments

  • list: 32-bit comma separated float words

Aliases

  • none

.align

Align next data item to a power of 2 byte boundary.

Usage

.align <alignval>

Example

.align 2 # 2 ^ 2 = 4 (word align)

Arguments

  • alignval: integer, should be >= 0

Aliases

  • .palign

.balign

Align next data item to a byte boundary.

Usage

.balign <alignval>

Example

.balign 4 # 4 bytes (word align)

Arguments

  • alignval: integer, should be > 0

Aliases

  • none

.globl

Store the symbol in the global symbol table.

Usage

.globl <symbol>

Example

.globl foo

Arguments

  • symbol: symbol to store in global symbol table

Aliases

  • .global

.section

Emits the specified section and makes it the current section.

Usage

.section <section>

Example

.section .text
    li a0, 10
.section .data
    msg: .string "hello"
.section .rodata
    num: .word 10 
.section .bss
    array: .zero 40

Arguments

  • section: {.text, .data, .rodata, .bss}

Aliases

  • none

.data

Emits data section and makes it the current section.

Usage

.data

Example

.data
    msg: .string "hello"

Arguments

  • none

Aliases

  • none

.text

Emits text section and makes it the current section.

Usage

.text

Example

.text
    li a0, 10
    ecall

Arguments

  • none

Aliases

  • none

.rodata

Emits read-only data section and makes it the current section.

Usage

.rodata

Example

.rodata
    msg: .string "hello"

Arguments

  • none

Aliases

  • none

.bss

Emits bss section and makes it the current section.

Usage

.bss

Example

.bss
    array: .zero 40

Arguments

  • none

Aliases

  • none

here