You are on page 1of 1

Übung 3 zur Vorlesung "Rechnerarchitektur"

Aufgabe 1:

Apply the GNU assembler on the Nvidia Jetson system (10.154.35.132 respectively
iwi-lkit-jetsonagx-01.hs-karlsruhe.de) to the code below to create a simple image of x-mas tree in
“ASCII graphics” to be displayed on the console.

.data // portion of an object file or the corresponding virtual address space


// of a program that contains initialized static variables,
// that is, global variables and static local variables

string1: .ascii "\n"


.ascii " |\n"
.ascii " | |\n"
.ascii " | |\n"
.ascii " | |\n"
.ascii " | |\n"
.ascii " | | | | | | | | | |\n"
.ascii " |\n"
.asciz " |\n"

.text // portion of an object file or the corresponding section of the


// program's virtual address space that contains executable instructions
// is stored and is generally read-only and fixed size

.global main // .global declares the symbol main to be global in scope


// (i.e. can be shared with other files); multiple definitions of
// a defined global symbol are not allowed

.extern printf // .extern indicates that this label won't be found in the
// current source file and that is must be declared as a
// 'global' elsewhere

main:
stp x29, x30, [sp, #-0x10]! // allocate 16 bytes on the stack and then
// store frame pointer and link register
ldr x0, =string1 // initialize argument for printf
// (start of string1)
bl printf // call printf
ldp x29, x30, [sp], #0x10 // restore frame pointer and link register
// from stack and increment stack pointer
ret // return to caller: unconditional branch to
// link register

Vorlesung Rechnerarchitektur WS 2022/23 Dr. P. Altevogt

You might also like