Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A = ld(i) means load the ith address into A
- // st(i) = A means write A to the ith address
- // ld(2) is the place where the current index is
- // It must start at 8
- // ld(3) is the place where the current maximum is
- // It must start at 0
- @loop
- A = ld(2) // what address to go to next?
- A = A + 1
- ld(2) = A
- B = ld(3)
- if (A < B) goto @loop
- // if you haven't jumped by now, then A >= B
- // this means we have a new max
- A = ld(2) // what was the index of the new max again?
- A = ld(A) // what was the new max again?
- // the above uses the loada command
- st(3) = A
- goto @loop
Advertisement
Add Comment
Please, Sign In to add comment