diff options
author | bd <bdunahu@operationnull.com> | 2025-04-21 23:01:49 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-21 23:01:49 -0400 |
commit | 7728beb94092f93f708af42feee3eab327749f32 (patch) | |
tree | ec654a27b33d70d6adfb1c553585bf8a21d187e5 /input/dominative-functions.asm | |
parent | 0d844b06301d8356706b2ac837033a93c0fe256a (diff) |
Fix dominative-functions example with simulator feedback
Diffstat (limited to 'input/dominative-functions.asm')
-rw-r--r-- | input/dominative-functions.asm | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/input/dominative-functions.asm b/input/dominative-functions.asm index 0931918..2ff242a 100644 --- a/input/dominative-functions.asm +++ b/input/dominative-functions.asm @@ -15,22 +15,28 @@ MAIN: jal SUB23 pop $6 store $6 answer($0) + nop + nop + nop + quot $0 $0 $0 SUB23: push $5 ; push old frame pointer addi $5 $2 0x0 subi $2 $2 0x1 addi $6 $0 -23 - store $6 -4($5) + store $6 -1($5) - load $7 +4($5) ; access argument - load $6 -4($5) + load $7 +1($5) ; access argument + load $6 -1($5) add $6 $6 $7 + push $1 ; save off our old ret push $6 jal ADD76 pop $6 ; retrieve and pass along - store $6 +4($5) + pop $1 ; restore our old ret + store $6 +1($5) addi $2 $5 0x0 ; restore stack pointer pop $5 ; restore frame pointer @@ -41,14 +47,18 @@ ADD76: subi $2 $2 0x1 addi $6 $0 +76 - store $6 -4($5) + store $6 -1($5) - load $7 +4($5) ; access argument - load $6 -4($5) + load $7 +1($5) ; access argument + load $6 -1($5) add $6 $6 $7 - store $6 +4($5) + store $6 +1($5) addi $2 $5 0x0 pop $5 ret + nop + nop + nop + nop |