Running user echo.ASM in PennSim
1) From the Codio File Tree, click on the file: os.asm
This file contains the guts of our operating system for this HW
b. Look in the TRAP vector table, for the line that reads:
Copyright By PowCoder代写 加微信 powcoder
MP TRAP PUTC
Notice that it is the second instruction after the .ADDR x8000 directive.
“loader” loads this line into prog. mem, it will be placed in row x8001
We can call TRAP _PUTC, by using the TRAP instruction followed by x01.
This will be done later in a file called: user echo.asm
Scroll down (approximately 115 lines or so) until you reach the lines that read:
This label marks the start of the PUT Trap (aka OS – subroutine)
d. When the “JMP TRAP PUTC” instruction is run (from the vector table), the
program counter will be advanced to the address labeled by “TRAP PUTC”
Further examine the code that follows; this is the operating system subroutine
(aka – a TRAP) called TRAP PUTC
Notice that this is the program we created in lecture to write 1 character to the
ASCII display device on the LC4
2) From the File Tree, click on the file: user echo.asm
This file is a program to test some of the operating systems TRAPs in os.asm
Scroll down to about the 24th line, look for the lines that read:
The CONST inst. places hex 54 (which is actually the letter ‘T’ in ASCII code) in RO
• This serves as an argument to the TRAP PUTC trap
d. The TRAP ×01 instruction forces the PC be set to x8001, w/ PS[15]=1 (OS mode)
TRAP ×01 is TRAP _PUTC, so this TRAP call will have the effect of
outputting a ‘T’ to the LC4’s screen
Examine the rest of this program, you’ll see that its purpose is to output:
“Type Here»” on the LC4 screen
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com