trap28.asm
. The
code for the trap service routine will go into this file. The purpose
of trap x28 is to display an asterisk (*) on the console when a
key is pressed on the keyboard.
(This is not an
entirely useless routine...it could be called by a password-checking
program. Each time a character of a password is typed in, it could be
"echoed" as an *). Here are the steps for completing this routine (refer to
Section 8.3.4 in your textbook if you need to):
;; program to test trap x28 ;; this program must be loaded with trap28.obj .orig x3000 loop trap x28 ;read a char and echo a * ;(char comes back in R0) ld r1, NL ;ASCII code for newline not r1, r1 add r1, r1, #1 ;negate the newline... add r0, r0, r1 ;...to subtract it from the char brnp loop ;not a newline, do another halt ;newline detected, so halt NL .fill x0A ;ASCII code for newline .endEnter (or copy/paste) this program into LC3Edit, save it as
lab4.asm
, and assemble it.
.orig x0028 .fill x0700 .endIf you write the third module, save it, assemble it, and load it into memory with the other two modules.
See you next week!