[Instructions] [Search] [Current] [Syllabus] [Handouts] [Outlines] [Assignments] [Code]
Question 2 of the final used a standard JUMP label
instruction, rather than Appel's more sophisticated indexed JUMP.
Here's the program rewritten to use that more sophisticated instruction.
CALL printInt 10 LABEL L40 CALL readInt MOVE T(100) RV JUMP 1 L(L50) LABEL L51 CALL readInt MOVE T(102) RV CALL readInt MOVE T(103) RV CJUMP LT T(102) T(103) L(L52) L(L53) LABEL L52 JUMP 1 L(L53) LABEL L50 CALL readInt MOVE T(101) RV JUMP 1 L(L51) LABEL L53 MOVE T(200) MAXINT # The maximum integer MOVE T(201) MAXINT # The maximum integer LABEL L200 MOVE T(300) T(100) MOVE T(555) 1 JUMP 1 L(L300) LABEL L201 MOVE T(300) T(101) MOVE T(555) 2 JUMP 1 L(L300) LABEL L202 MOVE T(300) T(102) MOVE T(555) 3 JUMP 1 L(L300) LABEL L203 MOVE T(300) T(103) MOVE T(555) 4 JUMP 1 L(L300) LABEL L204 JUMP 1 L(L400) LABEL L(L300) CJUMP LT T(300) T(201) L(L301) L(L302) LABEL L301 MOVE T(201) T(300) CJUMP LT T(201) T(200) L(L303) L(L302) LABEL L303 MOVE T(50) T(201) MOVE T(201) T(200) MOVE T(200) T(50) LABEL L302 JUMP T(555) L(L201) L(L202) L(L203) L(L204) LABEL L400 BINOP PLUS T(200) T(201) MOVE T(500) ACC BUILTIN printInt T(500) CJUMP LT T(500) 10 L(L500) L(L501) LABEL L500 JUMP 1 L(L40) LABEL L501 END
[Instructions] [Search] [Current] [Syllabus] [Handouts] [Outlines] [Assignments] [Code]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Fri Dec 11 10:48:39 1998.
This page generated on Fri Dec 11 10:50:49 1998 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu