Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a Pep/9 coding problem. I need to code the following problem in Pep/9 (I

ID: 3862920 • Letter: T

Question

This is a Pep/9 coding problem. I need to code the following problem in Pep/9 (I can convert from Pep/8 if that is easier)

THE ANSWER MUST BE IN PEP AND NOT IN ANY OTHER LANGUAGE

The goal is to take 10 user inputted scores, and to compare the total of the 10 to 3 different circumstances in which the student can pass. If it does not meet the criteria for any of those circumstances, the student fails.

If the sum of all 10 inputs is > 500, the student passes.

If the sum of all 10 inputs minus the lowest score is > 495, the student passes

If the sum of all 10 inputs minus the lowest score minus the second lowest score is > 480, the student passes.

Else the student fails.

I have written the proper code in C if that helps:

http://pastebin.com/5xKqfnTK

Explanation / Answer

Answer:

MIPS Assembly Langauge Code:

score:
        .zero   4
low:
        .long   100
secLow:
        .long   100
total:
        .zero   4
i:
        .zero   4
.LC0:
        .string "Score: "
.LC1:
        .string "%d"
.LC2:
        .string "Pass"
.LC3:
        .string "Fail"
main:
        push    rbp
        mov     rbp, rsp
.L5:
        mov     eax, DWORD PTR i[rip]
        cmp     eax, 9
        jg      .L2
        mov     edi, OFFSET FLAT:.LC0
        mov     eax, 0
        call    printf
        mov     esi, OFFSET FLAT:score
        mov     edi, OFFSET FLAT:.LC1
        mov     eax, 0
        call    scanf
        mov     edx, DWORD PTR score[rip]
        mov     eax, DWORD PTR low[rip]
        cmp     edx, eax
        jge     .L3
        mov     eax, DWORD PTR low[rip]
        mov     DWORD PTR secLow[rip], eax
        mov     eax, DWORD PTR score[rip]
        mov     DWORD PTR low[rip], eax
        jmp     .L4
.L3:
        mov     edx, DWORD PTR score[rip]
        mov     eax, DWORD PTR secLow[rip]
        cmp     edx, eax
        jge     .L4
        mov     eax, DWORD PTR score[rip]
        mov     DWORD PTR secLow[rip], eax
.L4:
        mov     edx, DWORD PTR total[rip]
        mov     eax, DWORD PTR score[rip]
        add     eax, edx
        mov     DWORD PTR total[rip], eax
        mov     eax, DWORD PTR i[rip]
        add     eax, 1
        mov     DWORD PTR i[rip], eax
        jmp     .L5
.L2:
        mov     eax, DWORD PTR total[rip]
        cmp     eax, 500
        jle     .L6
        mov     edi, OFFSET FLAT:.LC2
        mov     eax, 0
        call    printf
        jmp     .L7
.L6:
        mov     edx, DWORD PTR total[rip]
        mov     eax, DWORD PTR low[rip]
        sub     edx, eax
        mov     eax, edx
        cmp     eax, 495
        jle     .L8
        mov     edi, OFFSET FLAT:.LC2
        mov     eax, 0
        call    printf
        jmp     .L7
.L8:
        mov     edx, DWORD PTR total[rip]
        mov     eax, DWORD PTR low[rip]
        sub     edx, eax
        mov     eax, DWORD PTR secLow[rip]
        sub     edx, eax
        mov     eax, edx
        cmp     eax, 480
        jle     .L9
        mov     edi, OFFSET FLAT:.LC2
        mov     eax, 0
        call    printf
        jmp     .L7
.L9:
        mov     edi, OFFSET FLAT:.LC3
        mov     eax, 0
        call    printf
.L7:
        mov     eax, 0
        pop     rbp
        ret

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote