Last active
June 3, 2020 19:14
-
-
Save sciguyryan/258be7cb9f46c4a9554f3172b8806ce2 to your computer and use it in GitHub Desktop.
Nested Subroutines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
push $0xAAA ; Should remain in place once the stack is restored | |
push $0xC ; TESTER Argument 3 | |
push $0xB ; TESTER Argument 2 | |
push $0xA ; TESTER Argument 1 | |
push $3 ; The number of arguments for the subroutine | |
call !TESTER | |
mov $0x123, R1 | |
hlt | |
TESTER: | |
mov $0x34, &FP, R3 | |
mov $0x30, &FP, R2 | |
mov $0x2C, &FP, R1 | |
add R1, R2 | |
add R3, AC | |
push $0xCC ; TESTER2 Argument 3 | |
push $0xBB ; TESTER2 Argument 2 | |
push $0xAA ; TESTER2 Argument 1 | |
push $3 ; The number of arguments for the subroutine | |
call !TESTER2 | |
ret ; return to main | |
TESTER2: | |
mov $0x34, &FP, R3 | |
mov $0x30, &FP, R2 | |
mov $0x2C, &FP, R1 | |
add R1, R2 | |
add R3, AC | |
ret ; return to TESTER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment