Lab9_Extra_45-1 - LOOP TRAP x20;Reads the keyboard(Your...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Satyajit Balial, Lab 9 Extra Credit 1 Print[ToString[#0][]]&[] This function prints itself. Print prints whatever is the expression, and ToString gives a string corresponding to the printed form of the expression in OutputForm. It is called with zero arguments, then the pure function is evaluated. #0 represents the function itself, so the argument of the function is printed. If ToString was not there, the Print function would just be evaluated, over and over again, meaning it would be in recursion. Extra Credit 2 ;Extra Credit Problem 2 ;Satyajit Balial ;Print[ToString[#0][]]&[] .ORIG x3000 ;Start at location x3000 LEA R0,INST ;Load the string INSERT TRAP x22 ;Print on console LEA R3,VALUE ;How many bits you can type
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; ; LOOP TRAP x20 ;Reads the keyboard (Your input) TRAP x21 ;It sends it to the console LD R1,OKAY ;Loads OKAY(the enter function) into R1 STR R0,R3,0 ;Stores R3 to R0 ADD R3,R3,1 ;Adds one to R3, into R3 ADD R1,R0,R1 ;Adds R1 to R0, into R1 BRnp LOOP ;Branch back to again if R1 is not 0 AND R0,R1,0 ;Clears R1, stores in R0 STR R0,R3,-1 ;Stores R3-1 into R0 LEA R0,VALUE ;Loads the .BLKW into R0, ;meaning you have that many bits to input. ; TRAP x22 ;Prints what is typed HALT ;Halt processor (0 arguments) INST .STRINGZ “ ” ;String = Nothing. You can type here OKAY .FILL xFFF6 ;Fills OKAY with the ENTER function. VALUE .BLKW 1 ;How many memory values are used. .END ;End program...
View Full Document

This note was uploaded on 01/12/2010 for the course BME 14345 taught by Professor Orlyalter during the Fall '09 term at University of Texas.

Ask a homework question - tutors are online