archive-edu.com » EDU » H » HWS.EDU

Total: 727

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • pixel is white if that bit is zero and is black if that bit is one The rectangle is 64 pixels wide so each row of dots represents four 16 bit memory locations As the computer executes a program you can watch the dots change as memory is modified This can be particularly nice if you set the Speed pop up menu to Fastest Speed The program simply stores the numbers 1 2 3 in consecutive memory locations starting at location 20 To run the program click the Translate button located below this program Once the computer reappears set the memory display pop up menu to Graphics The program will appear as a few dots at the top of the memory rectangle Set the run speed to Fastest Speed and then click the Run button You should see memory fill up with a rather attractive pattern Note This is a self modifying program an old fashioned but cute idea The commands in locations 2 and 4 are changed as the program runs so that they load and store into different locations each time they are executed lod c 1 Put the starting number in location 20 sto 20 lod 20

    Original URL path: http://math.hws.edu/TMCM/java/xComputer/samples/Graphics.txt (2016-02-07)
    Open archived version from archive



  • the program where you could use a number For example the command JMP start will jump to the location with label start The program in this file uses several labels such as loop doAdd N1 and ANS Some of these label refer to instructions and some of them refer to data Both of these uses are very common Note by the way that the way this program is formatted isn t important as long as there is at most one instruction or data value per line Also you should know that the computer doesn t distinguish between upper and lower case letters in instructions or in label names This program multiplies two numbers stored in locations N1 and N2 The result is left in location number ANS How this works isn t important but essentially it is a loop that looks at the bits in N1 When a bit is found that is 1 N2 is added to ANS In any case each time through the loop N2 is multiplied by 2 For this to give the correct answer the answer must be in the range of numbers that can be represented using 16 bits The program lod c 0 Start by putting a zero into ANS sto ANS loop lod N1 If N1 is zero the process is complete jmz done shr Otherwise shift N1 one bit right sto N1 jmf doAdd If the bit shifted off the end of N1 was a one jump to doAdd to add N2 to the answer shift lod N2 Multiply N2 by 2 by shifting it left shl jmz done If N2 is zero we are done sto N2 jmp loop Proceed to the next iteration doAdd lod N2 This section adds N2 to ANS before add ANS doing the preceding shift

    Original URL path: http://math.hws.edu/TMCM/java/xComputer/samples/Labels.txt (2016-02-07)
    Open archived version from archive


  • 44 labeled by num N and ct which are where all the computational action takes place lod c 1 Let num 1 Num is the starting sto num value for the current sequence lod c 100 100 is location in memory where sto loc first answer is to be stored loop1 lod num Loop1 computes one sequence begin by sto N initializing N to the starting value for the sequence lod c 1 Ct keeps track of the number of terms sto ct in the sequence start counting at 1 loop2 lod N Loop2 computes one term in the sequence dec Test if N 1 by subtracting 1 from it and jmz next testing if the answer is 0 If so this sequence is complete jump to next to get ready for the next sequence and c 1 Compute bitwise logical AND of 1 with N 1 jmz odd If the answer is 0 N is odd jump to location odd to handle that case lod N Otherwise N is even divide N by 2 by shr shifting it right and putting the sto N result back into N Then jump to jmp count count where this term in the sequence is counted odd lod N If N is odd multiply it by 3 by adding it add N it to itself twice Then add 1 jmf error If any of these additions produces a add N result greater than 65535 the FLAG jmf error register is set This indicates an add c 1 error Number too large for this jmf error computer Jump to error if the sto N FLAG is set count lod ct Count this term in the sequence by inc incrementing the value of ct sto ct jmp loop2 Return to start of loop2 to do

    Original URL path: http://math.hws.edu/TMCM/java/xComputer/samples/Three_N_Plus_One.txt (2016-02-07)
    Open archived version from archive

  • xComputer Info
    is the address of the location that contains the first instruction of the program You can set the value in the PC to zero using the Set PC 0 button To set the PC to some other value type the value into the addr box and then click on the Addr To PC button This is important A common frustrating mistake when trying to run a program on xComputer is simply to forget to tell xComputer where in memory the program is located Note If you use the Translate button in programming mode to put a program into memory the PC will automatically be set to zero at the same time However after you run the program once you have to reset the PC manually if you want to run it again Once you have set the PC there are three different ways to run the program Click the Step button This performs one of the several small steps that make up each fetch and execute cycle You have to click on this between five and ten times depending on the instruction to execute each instruction Click the Cycle button This is meant to perform one complete fetch and execute cycle More exactly it performs step operations until the value in the COUNT register is two At that point a new instruction has just been loaded into the IR register Clicking the Cycle button again will execute that instruction Click the Run button This makes the computer execute instructions continually like a real computer The Run button changes into a Stop button which you can use to stop the computer It will also stop if it executes a HLT instruction The speed at which the computer runs is determined by a pop up menu just below the run button At the Fastest Speed the register display is turned off so the computer can run as quickly as possible This speed is especially useful with the Graphics memory display Registers and Control Wires The xComputer has eight registers A register is a memory unit that holds one binary number Different registers holds different numbers of bits Each of the registers has a role to play in fetching and executing instructions Here is a short description of the purpose of each register ADDR register The address register is a 16 bit register that holds the address of a location in memory Whenever data is read from or written to memory this is the address that is used If you turn on the Autoscroll checkbox below the scrolling memory display then any time the value in ADDR changes the memory will be scrolled to show that address at the bottom of the display PC register The program counter is a 10 bit register that contains the address in memory of the next program instruction that is scheduled to be executed The PC is ordinarily incremented by 1 during each fetch and execute cycle Its value can be also be changed by the execution of a jump instruction which tells the computer to jump to a different location in the program and continue execution from there IR register The instruction register is a 16 bit register that holds a program instruction while it is being executed This is where an instruction is put when it is fetched from memory COUNT register This is a 4 bit register that counts off the steps in each fetch and execute cycle At the beginning of each step its value is incremented by one The last step of the cycle resets this register to zero so that the next cycle can begin AC register The accumulator is a 16 bit register that holds a number that is being used in the current calculation When a number is loaded from memory it is put in the AC When a number is added it is added to the value currently in the AC and the result is put back into the AC Etc FLAG register This is a 1 bit register that can give extra information about a calculation For example when two 16 bit numbers are added the final carry into the 17 th column is stored in the FLAG register When a shift operation is performed on the AC the extra bit that is shifted off the end is placed into the FLAG register X and Y registers These are 16 bit registers that hold numbers that are to be used in a calculation For example when two numbers are to be added they are placed into X and Y The Y register is also used as a temporary storage place in a few cases The X and Y registers are connected to the inputs of an Arithmetic Logic Unit or ALU which does all the arithmetic and logical calculations in the computer The outputs of the ALU are connected to the AC and to the FLAG register The ALU is not shown in the xComputer applet The components of the computer including the main memory the registers the clock and the ALU are controlled by turning wires on and off These wires are connected to various components of the computer and they control the operation of those components It is these control wires that make the steps of the fetch and execute cycle happen You can see a list of the control wires in xComputer by selecting the Control Wire option from the memory display pop up menu The wires that are currently turned on are shown in red As a program is executed the wires that are on change during each step of each fetch and execute cycle You can watch how they change in order to learn how each step is accomplished For example in step 1 of each fetch and execute cycle the control wire named Load ADDR from PC is turned on This causes the number stored in the PC which is the location of the instruction that is to be fetched to

    Original URL path: http://math.hws.edu/TMCM/java/xComputer/info.html (2016-02-07)
    Open archived version from archive


  • tag to load the applet This applet tag must refer to the jar file and to the applet class For example the applet class for the xLogicCircuits applet is tmcm xLogicCircuitsApplet class An tag for using this applet has the form The classes for the other applets are named similarly tmcm DataRepsApplet class tmcm xComputerApplet class and so on In addition to these applets which appear right on the web page there are launcher versions of the applets In the launcher version only a button appears on the Web page When the user clicks the button the applet is opened in a separate window The names for the launcher versions are tmcm DataRepsLauncher class tmcm xLogicCircuitsLauncher class and so on For example to use the launcher version of xLogicCircuits you could use the tag Some of the applets can load sample input files Such files can be created using the Save button of one of the applets However this button will generally not be functional when you are running the applet in a Web browser If you want to use the Save button you must run the corresponding jar file as a stand alone application as discussed below To be used by an applet a sample input file should be in the same directory as the HTML source file for the Web page that contains the applet The names of the sample input files must be specified as params in the tag For example the xLogicCircuits applet can read one sample file The file is specified in a param named LOAD For example if you want xLogicCircuits to load a sample file named SampleCircuits txt use the applet tag The param name LOAD must be given in uppercase letters as shown Param names are case sensitive You can also use an input file with the launcher version of the applet The xComputer xTuringMachine xTurtle and xModels applets can load several sample files The files must be specified using the param names URL URL1 URL2 and so on You have to be careful to use the right names without any omissions If there is no URL2 for example the applet won t even check for URL3 For example to use four sample input files with the launcher version of the xComputer applet you could use the following tag on your web page The preceding tags assume that the jar files and sample input files are in the same directory with the HTML source file of the Web page It s possible to put them in other directories If the jar file is not in the directory with the HTML file then you must specify a codebase in the applet tag The codebase in an tag is the directory that contains the compiled Java code for the applet It is specified relative to the directory that contains the Web page For example Here the codebase directory is found by going up to the directory that contains the Web page specified as and

    Original URL path: http://math.hws.edu/TMCM/java/README.txt (2016-02-07)
    Open archived version from archive


  • with the appropriate example files Since you will be running the software outside a Web browser you will be able to use the Save file and Load file capabilities of the software The material in this archive can be freely redistributed and used for non commercial purposes Depending on how Java is installed on your computer you might be able to run TMCM Labs jar simply by double clicking it Alternatively you can try entering one of the following commands on the command line These commands will work for newer versions of Java java jar TMCM Labs jar java cp TMCM Labs jar tmcm Labs If you have only the version of Java that came with Internet Explorer you can try this command in a command window jview cp TMCM Labs jar tmcm Labs Finally if you have a rather old non Microsoft version of Java the command will be more complicated since you will have to specify the location of Java s built in classes For example if you have Java version 1 1 8 installed in the directory C jdk1 1 8 under windows then the command is java classpath TMCM Labs jar C jdk1 1 8 lib

    Original URL path: http://math.hws.edu/TMCM/java/TMCM_Labs_README.txt (2016-02-07)
    Open archived version from archive


  • that you can click to run the examples for each of the applet There are also extra tutorial examples for two of the applets Since you will be running the software outside a Web browser you will be able to use the Save file and Load file capabilities of the software The Web pages associated with each button in the program s main window can be found at the following addresses http math hws edu eck TMCM java DataReps http math hws edu eck TMCM java xLogicCircuits http math hws edu eck TMCM java xComputer http math hws edu eck TMCM java xTuringMachine http math hws edu eck TMCM java xTurtle http math hws edu eck TMCM java xTurtle tutorial html http math hws edu eck TMCM java xSortLab http math hws edu eck TMCM java xModels http math hws edu eck TMCM java xModels tutorial html The material in this archive can be freely redistributed and used for non commercial purposes Depending on how Java is installed on your computer you might be able to run TMCM Applet Tutorials jar simply by double clicking it Alternatively you can try entering one of the following commands on the command line These commands will work for newer versions of Java java jar TMCM Applet Tutorials jar java cp TMCM Applet Tutorials jar tmcm Tutorials If you have only the version of Java that came with Internet Explorer you can try this command in a command window jview cp TMCM Applet Tutorials jar tmcm Tutorials Finally if you have a rather old non Microsoft version of Java the command will be more complicated since you will have to specify the location of Java s built in classes For example if you have Java version 1 1 8 installed in the directory C

    Original URL path: http://math.hws.edu/TMCM/java/TMCM_Applet_Tutorials_README.txt (2016-02-07)
    Open archived version from archive


  • worth The source code is contained in the directory named tmcm All the classes for the applets belong to the package named tmcm and to its sub packages The sub packages correspond to subdirectories in the tmcm directory A directory named manifest files contains manifest files that are used for creating executable jar files These are files that can be run as stand alone applications Very old versions of Java will not be able to create or use these files The applets were written in Java 1 0 so they use many deprecated methods whose use is discouraged in Java 1 1 and later When the source code is compiled you will get warning messages about deprecated methods The warning messages are not errors and will not stop the files from being compiled The code can be compiled with the javac command from the JDK Java Development Kit To use this command with classes that are defined in the tmcm package or one of its sub packages you must be in the directory that contains the tmcm directory and you have to specify the full path to the file or files you want to compile For example to compile all

    Original URL path: http://math.hws.edu/TMCM/java/source/README.txt (2016-02-07)
    Open archived version from archive