http:^^www.cs.cornell.edu^info^courses^spring-95^cs314^hw^hw4.html
来自「This data set contains WWW-pages collect」· HTML 代码 · 共 108 行
HTML
108 行
MIME-Version: 1.0
Server: CERN/3.0
Date: Monday, 16-Dec-96 23:18:52 GMT
Content-Type: text/html
Content-Length: 2373
Last-Modified: Monday, 13-Mar-95 14:33:34 GMT
<html><head><title> CS 314: Homework Number 4 </title></head><body><h1> Homework Number 4 </h1><h3>Date Assigned: February 21, 1995<br>Date Due: February 28, 1995</h3><h3> To submit your answer </h3>Drop by the consulting office (305 Upson) during consulting hours toget your homework graded and recorded.<p>In the problems below, you are asked to write several 68000 assemblylanguage routines. While it is not required, we strongly suggest thatyou use BasePak to solve this problem set. In grading this problem set,we will forgive minor syntactic errors, but many occurrences of thesame error will be penalized. All programs should be well commented,listing any assumptions you made about the problem and how theregisters are used. Unless otherwise specified, assume callee-saveconventions are being used. All problems count equally in the finalgrade.<h3> Problem 1: Bit counting</h3>Write a 68000 code fragment that counts the number of bits thatare set (i.e., equal one) in the number stored in register D0. Theresult should be placed in register D1. For example, if<code> D0 = 1101 0100 1000 0011 </code> on entry to the code fragment,then D1 should contain 7 on exit. The contents of D1 may be destroyedby the fragment.<h3>Problem 2: Machine Code </h3><ol><li> Give the machine code representation (in hexadecimal) of thefollowing instructions in 68000 assembler.<PRE> MOVE.L D0,-(A6)</PRE><li> What 68000 assembly language instruction is encoded in thefollowing machine code?<PRE> 5C5F</PRE></OL><h3>Problem 3: Control Structures</h3>For each of the following Pascal control structures, give the 68000assembler equivalent. Assume the variable i is stored in register D0and x is stored in register D1.<ol><li> the for-loop<PRE> <B>for</B> i := 1 to n do <B>begin</B> x := x + 1; <B>end</B>;</PRE><li> the while loop<PRE> <B>while</B> (i <> 0) <B>do begin</B> i := i-1; x := x+1; <B>end</B>;</PRE><li> the repeat-until loop<PRE> repeat i := i-1; <B>until</B> (i = 0);</PRE><li> the if-then-else structure<PRE> <B>if</B> (i < 0) <B>then</B> begin x := i; end else begin x := -i; end</PRE><li> the case statement<PRE> <B>case</B> i <B>of</B> 1: x := -x; 2: x := 0; 3: x := x + 1; <B>end</B>;</PRE></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?