echo 105 % 0x69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % file: echo.stm % % This stm code tests the new string I/O trap % It prints a prompt and waits for an input % string from the terminal. Upon receiving the input string, % it echos the string back to the terminal. % Sample output: % % % sos.exe echo.stm % >:123 +!!#@! efg % % 123 +!!#@! efg % % Operating Systems Class, Fall 2006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PRINT PROMPT: 0x10F0 0 LOA R15 TWO --- output TRAP 0x10E0 1 LOA R14 TWO --- prompt is 2 chars long 0x14D0 2 LOA R13 PROMPT --- address of prompt (NOTE: addr 0x14 is NOT written backwards) 0xF 3 TRP --- do TRAP READ INPUT: 0xFF0 4 LOA R15 ONE --- input TRAP 0x11E0 5 LOA R14 EIGHTY --- max length of buffer 0x13D0 6 LOA R13 BUFFERONE --- address of buffer+1 0xF 7 TRP --- do TRAP ECHO: 0x10F0 8 LOA R15 TWO --- output trap 0x11E0 9 LOA R14 EIGHTY --- max length of buffer 0x12D0 A LOA R13 BUFFER --- address of buffer 0xF B TRP --- do TRAP HALT: 0xEF0 C LOA R15 ZERO --- halt trap 0xF D TRP --- do TRAP CONSTANTS: 0 E ZERO 1 F ONE 2 10 TWO/* Other global variables */ 80 11 EIGHTY is max length of input string ADDRESSES: 0x18 12 BUFFER 0x19 13 BUFFERONE 0x15 14 PROMPT PROMPT: 62 15 > 58 16 : 32 17 space BUFFER: 10 18 BUFFERONE: 0 19 0 20 0 21 0 22