

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Building your own traps This program will take the ASCII to binary & binary to ASCII routines you know & love so well, and implement them as traps. We want to add one new input trap & one new output trap to handle numeric i/o: the existing LC-3 traps GETC (trap x020) and OUT (trap x021) simply read & write a single ASCII character to/from R0. The new traps, GETNUM and OUTNUM will read and write decimal numbers: GETNUM will allow the user to enter a positive or negative decimal number, from one to four digits, terminated by a cr/lf, at the keyboard, and will return the corresponding two's complement binary number in R0. OUTNUM will take a two's complement binary number in R0 and output the corresponding decimal number to the screen, including the sign character. Input validation checking is not required, but if you are using exisiting code, it should already be built in. You may use either your own code from earlier assignments, or code from the published solutions; you may also use the existing i/o TSRs (as listed in the text) as a starting point. Trap vectors: use any location between x0030 and x Load the TSRs anywhere between xFA00 and FD Memory-mapped registers: KSR xFE KDR xFE DSR xFE DDR xFE You can load the Trap vectors as the initial lines of your program (since we don't have access to boot routines that load the trap vector table at start-up). Grading policy: Possible points: 10 Program assembles without errors: 3 Program runs correctly on LC-2 simulator 5 Well commented code: 2
Assignment submitted without name and SSN:-5 points (if we can figure out who you are!)