160 likes | 257 Views
Hudson Valley Community College CISS-110 – Programming & Logic I David Goldschmidt, Ph.D. Computer programming {week 01}. Computer subsystems. Hardware consists of five key subsystems:.
E N D
Hudson Valley Community College CISS-110 – Programming & Logic I David Goldschmidt, Ph.D. Computer programming{week 01}
Computer subsystems • Hardware consists of five key subsystems: from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Fetch/Execute cycle • Each instruction goes through this cycle: from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (i) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (ii) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (iii) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (iv) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (v) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Example ADD instruction (vi) from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Even faster! from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Counting • We use ten symbols to count • Digits: 0 1 2 3 4 5 6 7 8 9 • Computers use two symbols to count • Digits: 0 1 (why?) • What is the exact mechanism for counting? • How do we count from 1 to 20?
Convert binary to decimal • The powers of 2 give us the decimal weights • Convert 10011001 from binary to decimal: • 10011001 in decimal is 128 + 16 + 8 + 1 = 153
Hexadecimal • Hexadecimal is base 16 • It uses 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F • Why use hex? • Binary numbers are too long • What’s 2BAD in decimal?
ASCII • Representprintableand specialcharacters • What aboutUnicode? from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
Java compilation and execution public static void main( String[] args ) { float x; System.out. println( " ... 7A 56 78 9F FE F2 65 58 99 76 6D 4E translation program (compiler) intermediate code (byte code) Java source code A6 65 54 98 8F AB AE 33 38 8F DA 44 virtual machine (JVM) program execution intermediate code of precompiled libraries (java.util.Scanner byte code)
What next? • Read and study Chapter 1 • Get Textpad up and running • Do Project #1: • Given a 3-digit number: • Generate output that shows each digit: int num = 582; The number is 582 The hundreds column is 5 The tens column is 8 The ones column is 2