Strings and Number Conversions Chapter 12. Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII.

Slides:



Advertisements
Similar presentations
Chapter 12 Sorting and searching. This chapter discusses n Two fundamental list operations. u Sorting u Searching n Sorted lists. n Selection/bubble sort.
Advertisements

Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Lecture 9: Character and String
1 Today, –Some Date functions/formats –Number Formats –Some String functions –String/Integer Conversions –Control Statements If then...Elseif then...else.
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
Calculator 9S12DP256 Lab 2. \ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character.
ISBN Chapter 9 Subprograms. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.9-2 Figure 9.1 The three semantics models of parameter.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
©Brooks/Cole, 2001 Chapter 9 Pointers. ©Brooks/Cole, 2001 Figure 9-1.
The Serial Communication Interface (SCI) Chapter 11.
©Brooks/Cole, 2001 Chapter 13 Binary Files. ©Brooks/Cole, 2001 Figure 13-1.
The Serial Peripheral Interface (SPI) Chapter 8. SPI Operation of the SPI Keypad Interfacing with Shift Registers 4-Digit Seven-Segment Display.
Interrupts Chapter 6. Interrupts 68HC12 Interrupts 68HC11 Interrupts Interrupt Vector Jump Tables Writing WHYP Interrupt Service Routines Real-Time Interrupts.
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell WHYP -- An Extensible Language Chapter 4.
©Brooks/Cole, 2001 Chapter 8 Arrays. ©Brooks/Cole, 2001 Figure 8-1.
©Brooks/Cole, 2001 Chapter 3 Structure of a C Program.
©Brooks/Cole, 2001 Chapter 10 Pointer Applications.
©Brooks/Cole, 2001 Chapter 11 Strings. ©Brooks/Cole, 2001 Figure 11-1.
P247. Figure 9-1 p248 Figure 9-2 p251 p251 Figure 9-3 p253.
The Serial Communication Interface (SCI) MC9S12-DP256 Chapter 11.
©Brooks/Cole, 2001 Chapter 4 Functions. ©Brooks/Cole, 2001 Figure 4-1.
Design of Embedded Systems Using 68HC12(11) Microcontrollers - R. E. Haskell Subroutine and Stacks Chapter 2.
ASCII & Gray Codes.
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Do we need to convert integers (or longs, or floats) to strings.
COMT 222 Tools for a Digital World. Digital? What makes information Digital? If it helps:  When is information not analog? Answer:  A finite number.
Forth A stack language.
Chapter 5: Data Input and Output Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
Chapter 7 Assembly Language. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Our Bag of Tricks so far Control.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 1.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 3A Integral Data (Concepts)
1 Chapter 2 Number Systems, Operations, and Codes.
Number Conversions Lecture L3.4. Number Conversions ASCII Number String to Binary Conversion Binary Number to ASCII String Conversion.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
The character data type char. Character type char is used to represent alpha-numerical information (characters) inside the computer uses 2 bytes of memory.
CS2910 Week 2, Class 1 Today Data Encoding, Part 1 Parsing Data Python Muddiest Point Lab 2 – Bring text In Class, Thursday: Quiz Week 6, Monday: Midterm.
Codes Octal Power Hexadecimal ASCII BCD Code
Programming with Visual C++: Concepts and Projects Chapter 3A: Integral Data (Concepts)
Character Encoding & Handling doubles Pepper. Character encoding schemes EBCDIC – older with jumps in alphabet ASCII 1967 (7 bit)– Handled English, –ASCII.
 How do you represent a number with no value?  Mathematicians defined the “number” 0 (zero)  How do we represent a string with no value?  Use an empty.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /22/2013 Lecture 12: Character Data Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
1 Objectives ❏ To understand the differences between text and binary files ❏ To write programs that read, write, and/or append binary files ❏ To be able.
Road map char data type Reading –Liang 5: Chapter 2: 2.7.4; 2.9; –Liang 6: Chapter 2: 2.7.4; 2.9 –Liang 7: Chapter 2: 2.7.4; 2.9.
Chapter 5 NUMBER REPRESENTATION AND ARITHMETIC CIRCUITS.
File I/O. I/O Flags Flags are passed to give some information about how the file is to be used. – Read only file – flag=0x0 – Write only file – flag=0x1.
Characters must also be encoded in binary. ASCII maps characters to numbers.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Overflows Mark Shtern.
TOPIC: INTERFACING OF 7-SEGMENT USING SPI PROTOCOL
Variables and Expressions
Building Java Programs Chapter 4.3
PART II STACK APPLICATIONS
Applications of the Derivative
Chapter 8 More on Strings and Special Methods
Lists in Python Outputting lists.
C Programming Getting started Variables Basic C operators Conditionals
Introduction to Computer Science
The Stack.
Electronic Memory.
© 2012 Elsevier, Inc. All rights reserved.
Basic 9 Mr. Husch.
Chapter 4 Transients See notes on the chalkboard and the figures that follow.
Chapter 78 Vaccination and Screening in Cervical Cancer
Chapter 1 Functions.
Presentation transcript:

Strings and Number Conversions Chapter 12

Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII String Conversion The WHYP Words CMOVE and CMOVE>

WHYP Strings

:TYPE(addrlen -- ) ?DUP IF\ iflen <> 0 0DO\addr DUP char EMIT 1+\next.addr LOOP THEN DROP ; Figure 12.2TYPE prints an address-length string on the screen STRING.WYP

" This is a string" " ( -- addr len ) "Quote" Will leave addr and len on the stack : bar " *******" TYPE ; is the same as : bar." *******" ;

Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII String Conversion The WHYP Words CMOVE and CMOVE>

Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII String Conversion The WHYP Words CMOVE and CMOVE>

: U.( u -- ) (U.) TYPE 32 EMIT ; :.( n -- ) (.) TYPE 32 EMIT ;

Strings and Number Conversions WHYP Strings ASCII Number String to Binary Conversion Binary Number to ASCII String Conversion The WHYP Words CMOVE and CMOVE>