Created
September 14, 2016 22:55
-
-
Save ashquarky/f6ca425bc79c11ec7a82dbdd81de9278 to your computer and use it in GitHub Desktop.
A concept for Not Quite PowerPC; a C-style language to help people learn PowerPC Assembly
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
#global main | |
/*int main(int argc, char** argv)*/ | |
main: | |
//save link register | |
r0 = lr; | |
*8(r1) = r0; | |
compare(lw, r3, 0); //r3 = argc; comparing a logical word (lw) | |
ifgt { // if r3 > 0... | |
r3 = *2(r4); //load memory at argv+2 into r3 | |
goto main_print_finish; //goto does not set lr | |
} | |
ifeq { // if r3 == 0... | |
//get link register back | |
r0 = *8(r1); | |
lr = r0; | |
return; //go to lr | |
} | |
//r3 must be less than 0. There's also an iflt statement; though we don't need it here. | |
r3 = 0; | |
OSGetCoreID(); //calling external function | |
compare(w, r3, 1); //comparing non-logical word (w) | |
ifeq { | |
r0 = *8(r1); | |
lr = r0; | |
return; | |
} | |
#string str_finish "All finished?" | |
main_print_finish: | |
r3 = str_finish; | |
print(); | |
r0 = *8(r1); | |
lr = r0; | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment