Difference between revisions of "CSC231 Schedule 2012"
(→Weekly Schedule) |
|||
(191 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] 11:15, 24 August 2012 (EDT) | --[[User:Thiebaut|D. Thiebaut]] 11:15, 24 August 2012 (EDT) | ||
---- | ---- | ||
+ | |||
+ | =Misc. Links & Information= | ||
+ | |||
+ | * <font color="red">'''NEW'''</font>: [[CSC231 List of All Class Demo Files 2012| All the class demo files, as of 12/12/12]] | ||
+ | * [[CSC231 nasmld script | nasmld script]] | ||
+ | * [[CSC231 Things to Remember when Writing Assembly Programs | Things to remember while programming in assembly]] | ||
+ | * [http://alien.dowling.edu/~rohit/nasmdoc0.html The NASM Manual] (http://alien.dowling.edu/~rohit/nasmdoc0.html) | ||
+ | * Paul Carter's [http://cs.smith.edu/~dthiebaut/classes/231_0405/doc/pcasm-book.pdf assembly language tutorial]. Paul Carter's page can be found at http://www.drpaulcarter.com/. | ||
+ | * [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/artofasm.html The Art of Assembly Language]. It assumes a different assembler, and hence a different syntax, but has a lot of very good information. | ||
+ | * [http://en.wikipedia.org/wiki/X86_instruction_listings The Pentium Instruction Set] on Wikipedia. | ||
+ | * [http://www.dwelch.com/arduino/ Programming the Arduino] in assembly. | ||
=Weekly Schedule= | =Weekly Schedule= | ||
Line 14: | Line 25: | ||
|width="60%"| | |width="60%"| | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Syllabus | ||
+ | ** Class accounts | ||
+ | ** The main players for this semester: | ||
+ | *** PC | ||
+ | *** Processor | ||
+ | *** Memory | ||
+ | *** Disk | ||
+ | ** [[CSC231_FirstProg.asm | First program in assembly]]: recognize the different elements: | ||
+ | *** Structure | ||
+ | *** Presentation | ||
+ | *** Documentation | ||
+ | ** [[CSC231 skeleton program | Skeleton program]] | ||
+ | ** [[CSC231 HelloWorld.asm | '''Hello World!''' ]] on Linux (and its Mac [[CSC231 Hello World on Mac | version]]) | ||
+ | |||
<br /> | <br /> | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 1 Fall 2012 | Homework #1]] Due Monday 9/10/12, 11:00 a.m. |
|| | || | ||
* Reading | * Reading | ||
+ | * Chapter 1 in the [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/artofasm.html Art of Assembly]. | ||
+ | * Also Chapter 3, Sections 0 to 3.1.2. | ||
+ | * Sections 1.3.1, 1.3.2, 1.3.3, 1.3.4, and 1.3.5 in Carter's [http://cs.smith.edu/~dthiebaut/classes/231_0405/doc/pcasm-book.pdf PC Assembly Language]. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 25: | Line 53: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Review of '''Hello World''' | ||
+ | ** Q&A | ||
+ | ** [[CSC231 Lab 1| Mini Lab #1]] to get everybody up to speed. | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Printing a box (solution for [[CSC231 Lab 1| Mini Lab #1]]) | ||
+ | *** [[CSC231 Mini Lab 1 Solution and Discussion | solution programs and discussion]] | ||
+ | **** 2 possible solutions | ||
+ | **** Generating a listing with "-l" (minus ell) | ||
+ | **** Hexadecimal listing of the memory contents | ||
* '''Friday''' | * '''Friday''' | ||
+ | **** Hexdump of the executable | ||
+ | **** Counter-intuitive results (size of the executables vs. size of the code + data) | ||
+ | ***[[CSC231 HexDump Exercise | Exercise: recreating a program from its hexdump]] | ||
---- | ---- | ||
− | * | + | * [[CSC231 Lab 1| Mini Lab #1]] |
+ | * [[CSC231 Homework 2 2012 | Homework 2]] & [[CSC231 Homework 2 Solutions 2012 | solution programs]] | ||
|| | || | ||
* Reading | * Reading | ||
Line 38: | Line 78: | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Q&A | ||
+ | ** [http://www.asciitable.com/ ASCII Table], for reference | ||
+ | **[[CSC231 Review of hexadecimal number system| Review of hexadecimal system]] (counting + adding) | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | [[Image:JacquardLoom.jpg | 200px]][[Image:JacquardLoom2.jpg | 200px]] | ||
+ | ** Get the list of all the assembly programs seen in class: | ||
+ | :::<font FACE="courier" size="+1">ls -ltr ~231a/handout</font> | ||
+ | ** Get one of the files into your 231a-xx account: | ||
+ | :::<font FACE="courier" size="+1">getcopy movStrings1.asm</font> | ||
+ | ** Or use sftp | ||
+ | :::<font FACE="courier" >sftp 231a-xx@beowulf.csc.smith.edu</font> (and then use ''put filename'' or ''get filename'' to transfer files) | ||
+ | ** Architecture of a ''simplified'' Pentium: | ||
+ | *** Registers | ||
+ | *** ALU | ||
+ | *** CU | ||
+ | *** Address and Data buses | ||
+ | ** The mother of all instructions: '''MOV''' (covered [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH04/CH04-3.html#HEADING3-79 here]) | ||
+ | ** byte, word, double-word variables. | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Transferring information from and to memory. | ||
+ | ** [[CSC231 Many Mov Instructions | Example of various mov instructions]] | ||
+ | *** [[CSC231 Moving Strings in RAM | Exercises with moving strings]] | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 3 Fall 2012 | Homework #3]] and [[CSC231 Homework 3 Solutions Fall 2012| Solutions]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH04/CH04-3.html#HEADING3-79 The mov instruction] | ||
+ | ** [http://maven.smith.edu/~dthiebaut/ArtOfAssembly/CH03/CH03-1.html Basic Computer Organization], Sections 3.0, 3.1, 3.3.1 | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 50: | Line 112: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Q&A | ||
+ | ** Solutions to HW #2 posted (see above). | ||
+ | ** The '''ADD''' instruction | ||
+ | |||
+ | int a = 3, b = 5, result = 0; | ||
+ | result = a + b; | ||
+ | |||
+ | ** [[CSC231 DDD Lab | Tutorial on using the DDD debugger]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Computing [[CSC231 Fibonaccis|Fibonacci terms:]] ''Fib<sub>n</sub> = Fib<sub>n-1</sub> + Fib<sub>n-2</sub>'' | ||
+ | *** with double-words | ||
+ | *** with words | ||
+ | *** with bytes | ||
+ | *** [http://www.cafeaulait.org/course/week2/02.html '''Java's''' primitive data types] | ||
+ | ** SUB, INC, DEC, NEG | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** AND, OR, XOR, NOT (review [http://en.wikipedia.org/wiki/Introduction_to_Boolean_algebra Boolean Algebra]) | ||
+ | ** range of unsigned byte, words, dwords, and quadwords. | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 4 2012| Homework 4]] and [[CSC231 Homework 4 Solutions | solution programs]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** Sections 2.2, 2.2.1, 2.2.2, 2.2.3, and 2.2.4 in the [http://alien.dowling.edu/~rohit/nasmdoc/nasmdoc.pdf Nasm Manual] | ||
+ | ** Sections 3.1 to 3.2.1 in the [http://alien.dowling.edu/~rohit/nasmdoc/nasmdoc.pdf Nasm Manual] | ||
+ | ** The [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-2.html#HEADING2-117 INC] instruction. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
Line 61: | Line 142: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Review of two-bit Adder | ||
+ | <center><videoflash>6H62fyZEYsE</videoflash></center> | ||
+ | <br /><br /> | ||
+ | <center><videoflash>xTQDIiSWK_k</videoflash></center> | ||
+ | <br /> | ||
+ | ** [[media:7408-32-04.pdf| The AND, OR, and INVERTER logic gates in one pdf]] | ||
+ | ** Schematics from [http://klabs.org/history/ech/agc_schematics/index.htm NASA], and a [http://klabs.org/history/ech/agc_schematics/logic/a04-1.jpg specific sheet] showing logic gates. | ||
+ | ** [http://en.wikibooks.org/wiki/Microprocessor_Design/ALU Schematics of 2-bit Adder] | ||
+ | ** AND, OR, XOR, NOT (review [[http://en.wikipedia.org/wiki/Introduction_to_Boolean_algebra Boolean Algebra]]) | ||
+ | ** range of unsigned byte, words, dwords, and quadwords. | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Mini problem of the day: Assume you want to swap the top 16 bits of eax with its lower 16 bits. How can you do this? | ||
+ | ** [[CSC231 Exercises with Signed Numbers | Exercises with Signed Numbers]] | ||
+ | ** Playing with int overflow in java: [[CSC231 MultBy3.java Program| MultBy3.java]] | ||
+ | ** Same with Python: [[CSC231 multBy3.py Program | multBy3.py]] | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Review of 2's Complement: [[CSC231 Mystery C Program with signed numbers | Exercise]] in need of a solution... | ||
+ | ** Extending the sign from byte to word, or word to double-word. | ||
+ | *** '''CBW''': ''The CBW (convert byte to word) instruction copies the sign (bit 7) in the source operand (AL) into every bit in the AH register.''<ref name="IntelInstructions">Intel Instruction Set Summary, from http://download.intel.com/design/processor/manuals/253666.pdf</ref> | ||
+ | *** '''CWDE''': ''The CWDE instruction copies the sign (bit 15) of the word in the AX register into every bit position of the high word of the EAX register''<ref name="IntelInstructions" />. | ||
+ | ** Masking with AND, OR, and NOT, an example<br /> | ||
+ | <center>[[Image:CSC231StateDiagramForSoftwareProgram.png|400px]]</center> | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 5 2012 | Homework 5]] and [[CSC231 Homework 5 Solutions | solutions]]. |
|| | || | ||
* Reading | * Reading | ||
+ | :* Section 3.2 on Bit operations (AND, OR, NOT, XOR) in [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Carter's eBook]. Look at the section that follows on bit manipulation in C. The same operations are also [https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html supported in Java]. | ||
+ | :*[http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-86 Logical Operations on Bits], and [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-96 Signed and Unsigned Numbers] in the ''Art of Assembly'' reference. | ||
+ | ** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-1.html#HEADING1-236 The CBW & CWDE instructions] in the ''Art of Assembly'' reference. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
| Week 6 <br /> 10/8<br /> | | Week 6 <br /> 10/8<br /> | ||
+ | <!--[[Image:DancingCalving.gif |100px|right]]--> | ||
|| | || | ||
* '''Monday''': <font color="magenta">'''Fall Break'''</font> | * '''Monday''': <font color="magenta">'''Fall Break'''</font> | ||
+ | [[Image:CSC231SummaryAddressingModes.png|right|100px]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Bitwise operators vs logical operators in Java. [[CSC231 Bitwise Logical Operators in Java| Example]] | ||
+ | ** More Addressing modes: | ||
+ | *** base/indirect | ||
+ | *** base/indirect with diplacement | ||
+ | *** base/inderect indexed | ||
+ | *** base/indirect indexed with displacement | ||
+ | ** The '''Loop''' instruction. [[CSC231 Loop Exercises| Exercises with Loops]] | ||
+ | ** Fibonacci with loops and new addressing modes: [[CSC231 Fibonacci with Loops| Examples]] | ||
* '''Friday''' | * '''Friday''' | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 6 2012| Homework 6]] and [[CSC231 Homework 6 Solutions | solution programs]] |
|| | || | ||
* Reading | * Reading | ||
− | + | ** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-5.html#HEADING5-294 The LOOP Instruction] | |
+ | ** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH04/CH04-2.html#HEADING2-1 Addressing Modes] | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#ffffff" valign="top" | |- style="background:#ffffff" valign="top" | ||
Line 84: | Line 199: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** [[CSC231 Loop Offset is +127/-128 bytes| A word on the LOOP instruction ''offset'']] | ||
+ | ** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-1.html#HEADING1-27 condition codes & status register (flags)] | ||
+ | ** Conditional Jumps: JA, JAE, JB, JBE, JC, JCXZ, JE, JG, JGE, JL, JLE, JNA, JNAE, JNB, JNBE, JNC, JNE, JNG, JNGE, JNL, JNLE, JNO, JNP, JNS, JNZ, JO, JP, JPE, JPO, JS, JZ (more info [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-5.html#HEADING5-226 here]). | ||
+ | ** [[CSC231 Flags Settings Examples | Flag bits set by the CMP instruction]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | * '''Friday''' <font color="orange">'''Midterm Exam''', in class, closed books</font> | + | ** Q&A on midterm exam |
+ | ** A comment on RISC and CISC | ||
+ | ** Continuation on conditional jumps | ||
+ | ** [[CSC231_Exercises_with_conditional_jumps | Exercises on Conditional Jumps]] | ||
+ | * '''Friday''' | ||
+ | ** [[CSC231_Midterm_Preparation | Midterm Preparation]] | ||
+ | ** <font color="orange">'''Midterm Exam''', in class, closed books</font>. [[Media:CSC231MidtermSolution2012.pdf|Solution]] | ||
---- | ---- | ||
− | * | + | * No homework assignment this week. |
|| | || | ||
* Reading | * Reading | ||
Line 96: | Line 221: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** [[CSC231 Makefile for linking ASM and C Files | Using a Makefile]] | ||
+ | ** Another trick. Keep the nasm, ld, and run commands in one line in your history: | ||
+ | |||
+ | <span style="font-size:80%">'''nasm''' -f elf -F stabs myProg.asm ; '''ld''' -melf_i386 -o myProg myProg.o ; '''./myProg'''</span> | ||
+ | |||
+ | ** The [http://cs.smith.edu/~thiebaut/ArtOfAssembly/CH06/CH06-3.html#HEADING3-42 Shift] instructions | ||
+ | *** SHL, SHR, SAR, SAL | ||
+ | shl reg, 1 | ||
+ | shl mem, 1 | ||
+ | shl reg, imm | ||
+ | shl mem, imm | ||
+ | shl reg, cl | ||
+ | shl mem, cl | ||
+ | *** Exercise: [[CSC231 Print binary contents of DWord| print contents of a dword in '''binary''']] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Review printing in binary. Run program | ||
+ | ** [[CSC231 Difference between shifting and dividing | Difference between shifting and dividing]] | ||
+ | ** Exercise: Sketch algorithm for printing contents of DWord in hex. | ||
+ | ** Rotate Instructions: | ||
+ | *** ROR, ROL, RCR, RCL | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** Functions and the use of the stack. | ||
+ | ** [[CSC231 Exercises On Functions | Exercises on Functions]] | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 7 Fall 2012 | Homework 7]] and [[CSC231 Homework 7 Solution Programs| Solution Programs]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** [http://cs.smith.edu/~thiebaut/ArtOfAssembly/CH06/CH06-3.html#HEADING3-42 Shift Instructions], in the Art of Assembly source. | ||
+ | ** [http://maven.smith.edu/~thiebaut/ArtOfAssembly/CH06/CH06-5.html#HEADING5-98 The Call and Ret Instructions] | ||
+ | ** Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in [http://maven.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Chapter 4], titled ''Subprograms''. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 107: | Line 256: | ||
| Week 9<br /> 10/29<br /> | | Week 9<br /> 10/29<br /> | ||
|| | || | ||
+ | [[Image:ButtonDontDocument.jpg|150px|right|thumb|Bad!!!]] | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** No class, thanks to Hurricane Sandy! | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** [[CSC231 Functions and the Stack | The Magic of Functions]] | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** [[CSC231 Homework 7 Solution Programs#Comments| Some comments ]] about [[CSC231 Homework 7 Fall 2012 | Homework 7]] | ||
+ | ** Top-Down example | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 8 Fall 2012 | Homework 8]] and [[CSC231 Homework 8 Solution 2012| solution programs]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in [http://maven.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Chapter 4], titled ''Subprograms''. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 119: | Line 274: | ||
| Week 10 <br /> 11/05<br /> | | Week 10 <br /> 11/05<br /> | ||
|| | || | ||
+ | [[Image:ButtonIdiotProof.jpg|150px|right|thumb|Move quickly!!!]] | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Finish the [[CSC231 Top-Down Design Example | top-down example]] | ||
+ | ** Review the actions of passing parameters through registers. The concept of functions returning values is directly implementable using registers (in most cases). | ||
+ | ** Using EBP to pass more than 4/6 dword parameters: | ||
+ | int main() { | ||
+ | int a=3, b=5, res; | ||
+ | res = sum( a, b ); | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | int sum( int x, int y ) { | ||
+ | return x+y; | ||
+ | } | ||
+ | |||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** review passing of ''value'' parameters through the stack | ||
+ | ** functions returning values... | ||
+ | |||
* '''Friday''' | * '''Friday''' | ||
+ | ** [[CSC231 Buggy Code 1 | Why is this code buggy? ]] | ||
+ | ** local variables... | ||
+ | ** Some ideas for exercises | ||
+ | *** write a function that receives 3 dwords and returns the largest (in eax or in the stack) | ||
+ | *** write a function that receives a number and a char and prints a line with that many copies of it. | ||
+ | *** write a function that copies one array into another one. | ||
+ | *** write a function that receives two arrays: scans first one for patterns and updates second one as it does so. | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 9 2012 | Homework 9]] and [[CSC231 Homework 9 Solutions | solution]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in [http://maven.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Chapter 4], titled ''Subprograms''. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 131: | Line 311: | ||
| Week 11 <br /> 11/12<br /> | | Week 11 <br /> 11/12<br /> | ||
|| | || | ||
+ | [[Image:ButtonList.jpg|150px|right|thumb|For Lispers...]] | ||
+ | |||
* '''Monday''' | * '''Monday''' | ||
+ | ** Events: see [http://www.cse.unl.edu/~goddard/Courses/CSCE351/IntelArchitecture/IntelInterupts.pdf info on Interrupts] | ||
+ | ** Passing by '''reference''' | ||
+ | ** [[CSC231 Java passes objects by reference| Java passes objects by reference]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
+ | ** Some ideas for exercises | ||
+ | *** write a function that receives 3 dwords and returns the largest (in eax or in the stack) | ||
+ | *** write a function that receives a number and a char and prints a line with that many copies of it. | ||
+ | *** write a function that copies one array into another one. (we discovered a new instruction in the process: [[CSC231 helloMovsb.asm | '''movsb''']]) | ||
+ | *** write a function that receives two arrays: scans first one for patterns and updates second one as it does so. | ||
+ | *** write a function (in C, we would write it: ''swap( int *x, int *y)'' ) that swaps the values in x and y. | ||
+ | ** A look at the [[CSC231 Homework 8 Solution 2012 | solution programs]] for Homework 8. | ||
* '''Friday''' | * '''Friday''' | ||
+ | ** [[CSC231 Review Parameter Passing | Review passing parameters]] | ||
+ | ** [[CSC231 Recursion with Factorials | Recursing with Factorials]] | ||
+ | ** Recursion | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 10 2012| Homework 10]] and [[CSC231 Homework 10 Solutions 2012 | solution programs]] |
|| | || | ||
* Reading | * Reading | ||
− | + | ** [http://www.cse.unl.edu/~goddard/Courses/CSCE351/IntelArchitecture/IntelInterupts.pdf How the Pentium reacts to interrupts/events] | |
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
Line 144: | Line 339: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Continuation of recursion. "Walking" the factorial example (see [[CSC231 Factorial.lst|listing]]) | ||
+ | ** [[CSC231_Factorial.lst#Factorial.lst | List of Factorials]] | ||
+ | ** Questions: | ||
+ | *** Any limiting factors? | ||
+ | *** Could we have computed the factorial any other way? | ||
+ | *** Unrolling recursion | ||
+ | ** Sketching the Towers of Hanoi problem in assembly... | ||
* '''Wednesday''' <font color="magenta">'''Thanksgiving Break'''</font> | * '''Wednesday''' <font color="magenta">'''Thanksgiving Break'''</font> | ||
* '''Friday''' <font color="magenta">'''Thanksgiving Break'''</font> | * '''Friday''' <font color="magenta">'''Thanksgiving Break'''</font> | ||
Line 150: | Line 352: | ||
|| | || | ||
* Reading | * Reading | ||
− | + | ** [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Section 4.8] in Carter's on recursive programs | |
+ | [[Image:Turkey.gif]] | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
| Week 13 <br /> 11/26<br /> | | Week 13 <br /> 11/26<br /> | ||
|| | || | ||
+ | [[Image:DontBeAChimp.png|150px|right]] | ||
+ | [[Image:BeMechanical.png|150px|right]] | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Moving disks with the [[CSC231 Towers of Hanoi | Towers of Hanoi]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | * '''Friday''' | + | ** Q&A |
+ | ** Continuation with the [[CSC231 Towers of Hanoi | Towers of Hanoi]] | ||
+ | *** Observe [[CSC231_Towers_of_Hanoi#Enhanced_Version | hanoi2.py]] and its indented output | ||
+ | *** Question 1: how much stack space is used when moving ''N'' disks? | ||
+ | *** Question 2: How large a number of disks can we move with a stack of 1000 bytes? | ||
+ | *** Question 3: Removing the tail recursion. How does it affect the stack? | ||
+ | ** '''Binary Search''' | ||
+ | ** What does the recursion tree look like for the ''Binary Search'' algorithm? | ||
+ | *** Would removing the tail recursion help Binary Search? | ||
+ | ** Printing an integer in decimal. | ||
+ | *** The '''DIV''' instruction | ||
+ | *** Sketching a solution | ||
+ | *** A [[CSC231 printInt.asm| program]] | ||
+ | *** Limitations of the program? | ||
+ | * '''Friday''': <font color="magenta">No Class</font> | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 11 2012| Homework 11]] and [[CSC231 Homework 11 Solutions 2012| Solutions]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** The '''DIV''' instruction is covered in Page 34 of [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Carter's book]]. | ||
+ | ** Recursion is still covered in [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Section 4.8] of Carter's text. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
Line 168: | Line 390: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** Reminder: '''lunch talk''' by Pippin Wolfe on her research in AI | ||
+ | ** A word about making the Fibonacci program of [[CSC231 Homework 10 2012| Homework 10]] faster | ||
+ | ** [[CSC231 An Introduction to Floating-Point Numbers | Floating Point Numbers]] | ||
* '''Wednesday''' | * '''Wednesday''' | ||
− | * '''Friday''' | + | ** [[CSC231 An Introduction to Floating-Point Numbers | Continuing with Floating Point Numbers]] |
+ | *** How to declare a ''U''(8, 8) fixed point number? | ||
+ | *** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Exercises_with_the_Unsigned_Fixed-Point_Format | Exercises with Fixed-Point Notation]] | ||
+ | *** Adding and multiplying Fixed Points | ||
+ | *** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Definitions | Some important definitions]] | ||
+ | *** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Floating-Point_Numbers | Floating-Point Numbers]] | ||
+ | * '''Friday''': <font color="magenta">No Class</font> | ||
---- | ---- | ||
− | * | + | * [[CSC231 Homework 12 2012| Homework 12]] and [[CSC231 Homework 12 Solutions 2012| solutions]] |
|| | || | ||
* Reading | * Reading | ||
− | + | ** [[CSC231 An Introduction to Floating-Point Numbers | DT's page on Floating Point]] | |
+ | ** [http://en.wikipedia.org/wiki/Ieee_floating_point Wikipedia's page] on the IEEE floating-point format. | ||
<!-- ================================================================== --> | <!-- ================================================================== --> | ||
|- style="background:#eeeeff" valign="top" | |- style="background:#eeeeff" valign="top" | ||
Line 180: | Line 412: | ||
|| | || | ||
* '''Monday''' | * '''Monday''' | ||
+ | ** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Floating-Point_Numbers | More on Floating-Point Numbers]] | ||
+ | |||
* '''Wednesday''' <font color="magenta">'''Last Class'''</font> | * '''Wednesday''' <font color="magenta">'''Last Class'''</font> | ||
− | ** | + | [[File:FloatingPointRangeByte.png|150px|right]] |
+ | ** Answer to the question: What does the ''real'' ligne looks like in terms of how the Floating Point format covers it? | ||
+ | ** [[CSC231 Unexpected Floating-Point Results | Examples of Floating Point programs that generate unexpected results]] | ||
+ | ** The architecture of the FPU: A stack of 8 80-bit registers: st0, st1, ... st7. | ||
+ | ** [[CSC231_An_Introduction_to_Fixed-_and_Floating-Point_Numbers#Programming_with_Floating-Point_Numbers_in_Assembly| Examples of assembly programs using the FPU]] (also available [[CSC231 Floating-Point Assembly Examples| here]]) | ||
+ | ** How the FPU performs an addition of two floating point numbers | ||
---- | ---- | ||
− | * | + | * Take-Home <font color="orange">'''[[CSC231 Final Exam 2012|Final Exam]]''', open books & computers</font>. [[CSC231 Final Exam Solutoins 2012 | Solution]] |
|| | || | ||
* Reading | * Reading | ||
+ | ** [[CSC231 An Introduction to Floating-Point Numbers | DT's page on Floating Point]] | ||
+ | ** [http://en.wikipedia.org/wiki/Ieee_floating_point Wikipedia's page] on the IEEE floating-point format. | ||
+ | ** [http://www.lahey.com/float.htm Very good coverage of the unexpected behavior of floating point numbers] | ||
+ | ** [http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html What every computer scientist should know about FP] | ||
|} | |} | ||
Line 192: | Line 435: | ||
<br /> | <br /> | ||
+ | |||
+ | |||
<br /> | <br /> | ||
+ | =References= | ||
+ | <references /> | ||
<br /> | <br /> | ||
Latest revision as of 11:19, 28 October 2015
--D. Thiebaut 11:15, 24 August 2012 (EDT)
Misc. Links & Information
- NEW: All the class demo files, as of 12/12/12
- nasmld script
- Things to remember while programming in assembly
- The NASM Manual (http://alien.dowling.edu/~rohit/nasmdoc0.html)
- Paul Carter's assembly language tutorial. Paul Carter's page can be found at http://www.drpaulcarter.com/.
- The Art of Assembly Language. It assumes a different assembler, and hence a different syntax, but has a lot of very good information.
- The Pentium Instruction Set on Wikipedia.
- Programming the Arduino in assembly.
Weekly Schedule
Week | Topics | Reading |
Week 1 9/7 |
|
|
Week 2 9/10 |
|
|
Week 3 9/17 |
|
|
Week 4 9/24 |
int a = 3, b = 5, result = 0; result = a + b;
|
|
Week 5 10/1 |
|
|
Week 6 10/8 |
|
|
Week 7 10/15 |
|
|
Week 8 10/22 |
nasm -f elf -F stabs myProg.asm ; ld -melf_i386 -o myProg myProg.o ; ./myProg
shl reg, 1 shl mem, 1 shl reg, imm shl mem, imm shl reg, cl shl mem, cl
|
|
Week 9 10/29 |
|
|
Week 10 11/05 |
int main() { int a=3, b=5, res; res = sum( a, b ); ... } int sum( int x, int y ) { return x+y; }
|
|
Week 11 11/12 |
|
|
Week 12 11/19 |
|
|
Week 13 11/26 |
|
|
Week 14 12/03 |
|
|
Week 15 12/10 |
|
|
References
- ↑ 1.0 1.1 Intel Instruction Set Summary, from http://download.intel.com/design/processor/manuals/253666.pdf