Docsity

CS 061 Assignment 8: Building Custom Input and Output Traps, Assignments of Computer Science

Toggle sidebar
bg1
CS 061 โ€“ Computer Org. & Assembly Lang. Fall - 2003
Assignment 8 โ€“ due Friday 12/5, 11 pm (secure server turnin)
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 x0040
Load the TSRs anywhere between xFA00 and FD00
Memory-mapped registers:
KSR xFE00
KDR xFE02
DSR xFE04
DDR xFE06
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
pf2

Partial preview of the text

Download CS 061 Assignment 8: Building Custom Input and Output Traps and more Assignments Computer Science in PDF only on Docsity!

CS 061 โ€“ Computer Org. & Assembly Lang. Fall - 2003

Assignment 8 โ€“ due Friday 12/5, 11 pm (secure server turnin)

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!)