Closed Resia1 closed 5 months ago
Can you send me the code block content for testing?
-
.text
.global AckermannFunc
# Preconditions:
# 1st parameter ($a0) m
# 2nd parameter ($a1) n
# Postconditions:
# result in ($v0) = value of A(m,n)
AckermannFunc:
addi $sp, $sp, -8
sw $s0, 4($sp)
sw $ra, 0($sp)
# move the parameter registers to temporary - no, only when nec.
LABEL_IF: bne $a0, $zero, LABEL_ELSE_IF
addi $v0, $a1, 1
- #card
id:: 65a1ee1c-7715-414c-bbf0-0097bd242da3
-
```mips
lw $t0, 4($gp) # fetch N
mult $t0, $t0, $t0 # N*N
lw $t1, 4($gp) # fetch N
ori $t2, $zero, 3 # 3
mult $t1, $t1, $t2 # 3*N
add $t2, $t0, $t1 # N*N + 3*N
sw $t2, 0($gp) # i = ...
```
-
```mips
# A[i] = A[i/2] + 1;
lw $t0, 0($gp) # fetch i
srl $t0, $t0, 1 # i/2
addi $t1, $gp, 28 # &A[0]
sll $t0, $t0, 2 # turn i/2 into a byte offset (*4)
add $t1, $t1, $t0 # &A[i/2]
lw $t1, 0($t1) # fetch A[i/2]
addi $t1, $t1, 1 # A[i/2] + 1
lw $t0, 0($gp) # fetch i
sll $t0, $t0, 2 # turn i into a byte offset
addi $t2, $gp, 28 # &A[0]
add $t2, $t2, $t0 # &A[i]
sw $t1, 0($t2) # A[i] = ...
# A[i+1] = -1;
lw $t0, 0($gp) # fetch i
addi $t0, $t0, 1 # i+1
sll $t0, $t0, 2 # turn i+1 into a byte offset
addi $t1, $gp, 28 # &A[0]
add $t1, $t1, $t0 # &A[i+1]
addi $t2, $zero, -1 # -1
sw $t2, 0($t1) # A[i+1] = -1
```
-
```mips
lw $t0, 0($gp) # fetch i
lw $t1, 4($gp) # fetch N
slt $t1, $t0, $t1 # set $t1 to 1 if $t0 < $t1, to 0 otherwise
beq $t1, $zero, skip # branch if result of slt is 0 (i.e., !(i<N))
sll $t0, $t0, 2 # i as a byte offset
add $t0, $t0, $gp # &A[i] - 28
sw $zero, 28($t0) # A[i] = 0
skip:
```
I copied and pasted the text from the logseq.
Thanks for the quick feedback. This plugin is now a part of my life, and I appreciate you developing such a great plugin.
Describe the bug A clear and concise description of what the bug is.
The $ character is broken when synchronizing with anki in a logseq code block.
Steps to Reproduce: Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
I want Anki to output the $ character without breaking.
Developer console screenshot: Please add a screenshot of the error in logseq's developer console if applicable. Logseq's developer console can be accessed by pressing
Ctrl + Shift + I
.Device Information (please complete the following information):
Thank you. My God, I have been helped a lot in my studies.