mardi 30 novembre 2021

Writing a program in OAM Assembly Code which gets seven positive numbers and prints the highest one

Title really says it all. I need to write a program in OAM Assembly Code which gets seven positive numbers and prints the highest one. I am using OAMulator. The pseudocode I am supposed to follow is

Set highest to 0
Set count to 7
While count > 0
     Get newScore
     Print newScore
     If newScore > highest
            Set highest to newScore
     Set count to count - 1
Print highest
Stop

I was able to get it to where it prints all the numbers but I can't figure out how to get it to print the highest. Here is that code:

SET 7
STA 12
loopStart, LDA 0
STA 0
LDA 12
DEC
STA 12
BRP loopstart
HLT

Please help.

Aucun commentaire:

Enregistrer un commentaire