Assembly examples for Red-V Thing Plus (SiFive FE310-G002)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
918 B

# macros.s
# 2021 flabbergast <>
# Unlicense:
# designate some RAM memory to a symbol
.macro ramallot Name, Size
.equ \Name, rampointer
.set rampointer, rampointer + \Size
# stack: push, pop
.macro push reg
addi sp, sp, -4
sw \reg, 0(sp)
.macro pop reg
lw \reg, 0(sp)
addi sp, sp, 4
# insert a sized string
.macro sized_string Text
.byte 8f - 7f # Compute length of string.
7: .ascii "\Text"
.if compressed_isa
8: .balign 2, 0 # Realign
8: .balign 4, 0 # Realign
# data stack
# _s11_ used as the data stack pointer!!
.macro pushda reg
addi s11, s11, -4
sw \reg, 0(s11)
.macro popda reg
lw \reg, 0(s11)
addi s11, s11, 4
.macro pushdaconst const
push t0 # yep ... should rethink this
li t0, \const # but it should being used very little
pushda t0
pop t0