Venus supports most common assembler directives, including some indicated here.
Emits filename.
.file <filename>
.file "/home/ubuntu/Desktop/lab10.s"
filename
: quoted filenameReserves the specified number of bytes.
.zero <value>
.zero 10 # reserves 10 bytes
value
: (should be > 0).space
Stores the string and adds null terminator.
.string <string>
.string "hello world"
string
: quoted string.asciiz
, .asciz
Stores the string and does not add null terminator.
.ascii <string>
.ascii "Hello world"
string
: quoted stringStore the listed value(s) as 8 bit bytes.
.byte <list>
.byte 10, 50
.byte 2
list
: 8-bit comma separated bytesStore the listed value(s) as 16-bit half words.
.half <list>
.half 1, 2, 3
.half 10
list
: 16-bit comma separated half words.short
, .2byte
Store the listed value(s)/symbol(s) as 32 bit words.
.word <list>
.word 1, 3, 5, 7
.word 0xcafe
list
: 32-bit comma separated words or comma separated symbols.long
, .4byte
Store the listed value(s) as 32 bit float values.
.float <list>
.float 1e-4, 1.2, 0.005
.float 3.1416
list
: 32-bit comma separated float wordsAlign next data item to a power of 2 byte boundary.
.align <alignval>
.align 2 # 2 ^ 2 = 4 (word align)
alignval
: integer, should be >= 0.palign
Align next data item to a byte boundary.
.balign <alignval>
.balign 4 # 4 bytes (word align)
alignval
: integer, should be > 0Store the symbol in the global symbol table.
.globl <symbol>
.globl foo
symbol
: symbol to store in global symbol table.global
Emits the specified section and makes it the current section.
.section <section>
.section .text
li a0, 10
.section .data
msg: .string "hello"
.section .rodata
num: .word 10
.section .bss
array: .zero 40
section
: {.text
, .data
, .rodata
, .bss
}Emits data section and makes it the current section.
.data
.data
msg: .string "hello"
Emits text section and makes it the current section.
.text
.text
li a0, 10
ecall
Emits read-only data section and makes it the current section.
.rodata
.rodata
msg: .string "hello"
Emits bss section and makes it the current section.
.bss
.bss
array: .zero 40