Menu Selection
BuiltWithNOF

[PHY353/553] [PHY353/553] [Goals] [Prof. Saj Alam] [Syllabus] [Grading Policy] [Books] [Schedule] [Lectures] [Chp 1: History of Computers] [Chp2: Binary Numbers] [Chp3: Conceptual Computer] [Software Model] [Addressing Modes] [Instruction Set] [Assembly Language] [First Program] [ADD16] [SUB16] [MUL16] [DIV16] [CALC16] [CALC32] [Manual] [Exams] [Grades]

MENU SELECTION

a) Since the main program can add, subtract, multiply and divide two numbers, we need a menu slection so that we can do either of these operations or all of the operations.

b) We achieve this by diplaying message saved at MENUMSG in the data segement and shown below.

c) Following the message we have a macro for saving the operation selection typed at the keyboard. The macro reads the selection typed at the keyboard and saves it at MENUINP in the data segement.   At MENUINP, the first “2” states the maximum number of characters to be read, while the next two bytes are reserved for the operator selection.

 The coding is shown below:

MENU SELECTED

a) Once the operation is selected, a “JMP” is made to the address corresponding to the operation. Note, once an operation, say “+” is selected, the program jumps to the address “DOADD.” Then the next line of code checks to see if the request was not “0DH” OR “CR” in which case it goes to the next line and jumps to “DOSUB.”  Thus for “ALL”, the code is set such that it does through all the operations.  But when a specific operation is selected, it goes to the operation and then jumps to the make the next request.

b) This is shown in the code below. Stare at it until you see the logic.