Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- message1 .asciz "Please enter your team: "
- message2 .asciz "Please enter your name: "
- message3 .asciz ""*****Print Name*****"
- TMP .asciz "" @以下都全域變數@
- TEAM .asciz ""
- NAME1 .asciz ""
- NAME2 .asciz ""
- NAME3 .asciz ""
- ID1: .word 0
- ID2: .word 0
- ID3: .word 0
- num: .word 0 @以上都全域變數@
- @------------------NAME-----------------@
- i: .word 0
- NAME:
- LDR R1, i
- LOOP: @while i<4
- CMP R1, #4 @while i<4
- BGE DONE @>4跳出
- CMP R1, #0 @if i==0
- BEQ MSG1 @Print message1
- LDR R0, =STNG @Scanf不知道怎麼讀
- LDR R2, =TMP @Scanf到TMP
- BL scanf @Scanf不知道怎麼讀
- ???? @TEAM = TMP
- CMP R1, #0 @if i!=0
- BNE MSG2 @Print message2
- LDR R0, =STNG @Scanf不知道怎麼讀
- LDR R2, =TMP @Scanf到TMP
- BL scanf @Scanf不知道怎麼讀
- CMP R1, #1 @if i==1
- BEQ ???? @NAME1 = TMP
- CMP R1, #2 @if i==2
- BEQ ???? @NAME2 = TMP
- CMP R1, #3 @if i==3
- BEQ ???? @NAME3 = TMP
- ADD R1, 1, R1 @i++
- BL LOOP
- DONE:
- ???? @cout << "*****Print Name*****" << endl;
- ???? @cout << team << endl;
- ???? @cout << name1 << endl;
- ???? @cout << name2 << endl;
- ???? @cout << name3 << endl;
- ???? @cout << "*****End Print*****" << endl;
- MSG1:
- LDR R0, =message1
- BL printf
- MSG2:
- LDR R0, =message2
- BL printf
- MSG3:
- LDR R0, =message3
- BL printf
- STNG: .string "%s" @SCANF要用的!?
- @------------------NAME-----------------@
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ID@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ID:
- i: .word 1 @int i=1;
- ???? @cout << "*****Input ID*****" << endl;
- LDR R1, i @LOAD i=1;
- LOOP: @while i<4
- CMP R1, 1 @while i<4
- BGE DONE2 @>4跳出
- LDR R0, =STNG @Scanf不知道怎麼讀
- LDR R2, =NUM @Scanf到NUM
- BL scanf @Scanf不知道怎麼讀
- CMP R1, #1 @if i==1
- BEQ ???? @ID1 = NUM
- CMP R1, #2 @if i==2
- BEQ ???? @ID2 = NUM
- CMP R1, #3 @if i==3
- BEQ ???? @ID3 = NUM
- ADD R1, 1, R1 @i++
- BL LOOP
- DONE2:
- ADD NUM, ID1, NUM @NUM = NUM + ID1;
- ADD NUM, ID2, NUM @NUM = NUM + ID2;
- ADD NUM, ID3, NUM @NUM = NUM + ID3;
- ???? @cout << "** Please Enter Command **" << endl;
- LDR R0, =STNG @Scanf不知道怎麼讀
- LDR R2, =TMP @Scanf到TMP
- BL scanf @Scanf不知道怎麼讀
- CMP TMP, "p" @ if(tmp == "p")
- BEQ printf @ printf
- ???? @cout << "*****Print Team Member ID and ID Summation*****" << endl;
- ???? @cout << ID1 << endl << ID2 << endl << ID3 << endl;
- ???? @cout << "ID Summation = " << num << endl;
- ???? @cout << "*****End Print*****" << endl;
- STNG: .string "%s" @SCANF要用的!?
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ID@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- @-----------------MAIN-----------------@
- MAIN:
- .string INPUT @String input;
- LOOP:
- CMP ???? @while(true)????
- BNE printf @while(true)????
- ???? @cout <<" Press 0 to quit" << endl;
- ???? @cout << "Press 1 to do Function 1(NAME)" << endl;
- ???? @cout << "Press 2 to do Function 2(ID)" << endl;
- ???? @cout << "Press 3 to do Main Function" << endl;
- LDR R0, =STNG @Scanf不知道怎麼讀
- LDR R2, =INPUT@Scanf到INPUT
- BL scanf @Scanf不知道怎麼讀
- CMP INPUT, #0 @if(input == 0)
- BEQ DONE3 @Break;
- CMP INPUT, #1 @if(input == 1)
- BEQ NAME @NAME()
- CMP INPUT, #2
- BEQ ID @ID()
- CMP INPUT, #3
- BEQ printf @printf
- ???? @cout << "*****Print All*****" << endl;
- ???? @cout << team << endl ;
- ???? @cout << ID1 << " " << name1 << endl;
- ???? @cout << ID2 << " " << name2 << endl;
- ???? @cout << ID3 << " " << name3 << endl;
- ???? @cout << "ID Summation = " << num << endl;
- ???? @cout << "*****End Print*****" << endl;
- CMP INPUT, #? @else 怎麼比?
- ???? @cout << "Please try again." << endl;
- DONE3:
- LDR R1, #0 @return 0
- LDR PC, LR @return 0
- STNG: .string "%s" @SCANF要用的!?
- @-----------------MAIN-----------------@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement