To modify the operating system for the problems in Chapter 8 of Computer Systems is a six-step process.

(1) Decide on your mnemonic for your new instruction. It will replace one of NOP0, NOP1, NOP2, NOP3, NOP, DECI, DECO, or STRO. Select the menu option

System -> Redefine Mnemonics

to change the mnemonics of one of the instructions. The dialog box requires you to enter a mnemonic and its allowed addressing modes if it is nonunary. For example, change the mnemonic for the unary instruction "NOP0" to "ECHO". Save the change by clicking the Save button.

(2) The source code of the operating system is included with this distribution in the file pep8os.pep. Open it as you would an ordinary program in the Source Code pane.

(3) Modify the trap handler part of the operating system to implement your new instruction. As an example, here is the original NOP0 trap handler.

;******* Opcode 0x24
;The NOP0 instruction.
opcode24:RET0

And here is how you would modify it to implement the new ECHO instruction in place of NOP0.

;******* Opcode 0x24
;The ECHO instruction.
opcode24:CHARI byteBuff,d
         CHARO byteBuff,d
         RET0

Caution: You cannot use any trap instructions in your trap handler.

(4) Select

System -> Assemble/Install New OS

to assemble and install the reprogrammed operating system.

(5) Write an assembly language program to test your new instruction with the new mnemonic. The assembler should recognize the new mnemonic and generate the appropriate object code. For example, your test program might be:

ECHO
STOP
.END

(6) Load and execute your program assembled in step (5). In this example, whatever character is placed in the Input pane should be echoed in the output pane.

The menu selection

System -> Reinstall Default OS

assumes that the object code for the default operating system is contained in the file pep8os.pep. If you do not alter this file, you can always restore the default operating system by selecting

System -> Reinstall Default OS

Executing

System -> Assemble/Install New OS

does not alter the pep8os.pep file.