====== Riscv - how to use prinf from assembler ==== The following link explains how to setup and run RiscV Debian in qemu on Linux in order to complete the assembler task below:- [[https://www.codeproject.com/Tips/5383029/Run-Debian-RISC-V-In-QEMU-Virtual-Environment-For]] This link was so useful, I have reproduced it here for future reference:- [[RiscV-Qemu-Debian]] All work has been carried out using Ubuntu as the host for qemu which then runs Riscv Debian . assemble with: as test2.s -o test2.o then compile with: gcc test2.o -o test2 run with: ./test2 {{:screenshot_from_2025-02-03_15-34-32.png?400|}} .section .rodata prompt: .asciz "Value of t0 = %ld and value of t1 = %ld\n" .globl main .section .text main: addi sp, sp, -8 sd ra, 0(sp) la a0, prompt li t0,44 li t1,88 mv a1, t0 mv a2, t1 call printf ld ra, 0(sp) addi sp, sp, 8 ret == interesting links == [[https://fraserinnovations.com/risc-v/risc-v-instruction-set-explanation/]] [[https://www.riscvschool.com/2022/04/28/risc-v-assembly-tutorial/]] [[https://opentitan.org/book/doc/contributing/style_guides/asm_coding_style.html]] [[https://mcyoung.xyz/2021/11/29/assembly-1/]] [[https://operating-system-in-1000-lines.vercel.app/en/04-boot]] [[https://riscvasm.lucasteske.dev/#]] online emulator [[https://godbolt.org/]] online emulator