The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005

Slides:



Advertisements
Similar presentations
Introduction to Computing Systems from bits & gates to C & beyond Chapter 7 LC-2 Assembly Language.
Advertisements

Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Programming 68HC11.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Ch5b BR 0x0009 ;Branch around data 0003 FFFE.WORD 0xFFFE ;First BYTE 0x00 ;Second BYTE 'U' ;Third WORD 1136 ;Fourth.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Lab6 – Debug Assembly Language Lab
Assembly Language part 2. Program example 2 BR 0x0008.ASCII "#?".ASCII "\n".BLOCK 2 CHARO 0x0003, d CHARO 0x0004, d DECI 0x0006, d CHARO 0x0005, d DECO.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
MIPS Instruction Set Advantages
Assembly Language part 1.
CPS120: Introduction to Computer Science
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
A Simple Two-Pass Assembler
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
Memory and Addressing How and Where Information is Stored.
Assemblers.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Computer Science 210 Computer Organization
Instruction sets : Addressing modes and Formats
Chapter Topics The Basics of a C++ Program Data Types
PROGRAMMING THE BASIC COMPUTER
Machine dependent Assembler Features
Addressing Modes in Microprocessors
Chapter 7 Assembly Language
MIPS Instruction Set Advantages
CC410: System Programming
Control Unit Lecture 6.
Data Representation Binary Numbers Binary Addition
CSCI 198: Lecture 4: Data Representation
Basic Elements of C++.
CSCI 161: Lecture 4: Data Representation
Computer Science 210 Computer Organization
Chapter 7 Assembly Language
Microcomputer Programming
Computer Science 210 Computer Organization
Basic Elements of C++ Chapter 2.
THE sic mACHINE CSCI/CMPE 3334 David Egle.
Chapter 7 LC-2 Assembly Language.
Computer Science 210 Computer Organization
Assembler CASE Tool.
Computer Science 210 Computer Organization
CSCE Fall 2013 Prof. Jennifer L. Welch.
Chapter 5 Assembly Language.
Computer Science 210 Computer Organization
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Chapter 7 LC-2 Assembly Language.
CPS120: Introduction to Computer Science
Low Level Programming Languages
A Simple Two-Pass Assembler
Computer Organization and Assembly Language
CSCE Fall 2012 Prof. Jennifer L. Welch.
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
CPU has 6 special locations called registers
ECE 352 Digital System Fundamentals
8051 ASSEMBLY LANGUAGE PROGRAMMING
MIPS Assembly.
Assembler Directives end label end of program, label is entry point
The Von Neumann Machine
Introduction to 8086 Assembly Language
Lecture 1: SIC Architecture
Part I Data Representation and 8086 Microprocessors
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005 ;A program to output “Hi” ; CHARO 0x0007, d ; Output ‘H’ CHARO 0x0008, d ;Output ‘i’ STOP .ASCII “Hi” .END Assembler Output 51 00 07 51 00 08 00 48 69 zz Program output Hi

The .ASCII and .END Pep/8 assembly language is line-oriented, unlike C++: Each assembly language statement must be contained on only one line. No statement can continue onto another line. Two statements can not be place on the same line. A comment begins with a semicolon ; and continue until the end of the line. The .ASCII generates contiguous bytes of ASCII characters. You must end your assembly language program with the .END command. It does not insert bits into the program the way the .ASCII command does. It indicates the end of the assembly language program.

The .BLOCK Pseudo-op Generate a block of a specific number of bytes. Means generate a block of one byte. .BLOCK 2 Means generate a block of two bytes. The statement generates code for the loader.

The .BLOCK Pseudo-op

The .WORD and .BYTE Pseudo-ops The .WORD is similar to the .BLOCK as it generates code for the loader, .WORD is different from .BLOCK in two ways: It always generates one word (2 bytes). The programmer can specify the content of the word. .WORD 5 Means generate one word with a value of 5. .WORD 0x0030 Means generate one word with a value of 0030 (hex).

The .WORD and .BYTE Pseudo-ops .BYTE is similar to .WORD but it generates one byte instead of 2 bytes (one word). .WORD 0x0030 is equal to .BYTE 0x00 .BYTE 0x30

The .WORD and .BYTE Pseudo-ops

Immediate Addressing

The problem of Address Calculation The problem with placing the data at the end of the program is that you do not know exactly how long the instruction part of the program until you have finished it. You do not know the address of the data while writing the instruction that requires that data. One modification will change the addresses of the data, and every instruction that refers to the data will need to be modified to reflect the new addresses.

The unconditional branch instruction Instruction specifier: 0000 010a Mnemonic: BR Skips to a different memory location for the next instruction to be executed. The branch instruction almost always uses immediate addressing. The Pep/8 assembler does not enforce that the addressing mode to be specified. If no addressing mode specified, the assembler will assume the immediate addressing and generate 000 for the addressing-aaa field.

The decimal input instruction Instruction specifier: 0011 0aaa Mnemonic: DECI Convert a string of ASCII characters from the input device into a 16-bit signed integer (two’s complement) and store it into memory. It sets the status bits as follows: Z to 1 if the input was 0. N to 1 if the input was a negative value. V to 1 if the input was out of range. C is not affected by the instruction.

The decimal output instruction Instruction specifier: 0011 1aaa Mnemonic: DECO Convert a 16-bit signed integer (two’s complement) from memory into a string of ASCII characters and send the string to the output device

The string output instruction Instruction specifier: 0100 0aaa Mnemonic: STRO Send a string of null-terminated ASCII characters to the output device. The operand for the STRO is a contiguous sequence of bytes; each one is interpreted as an ASCII character. The last byte must be a byte of all 0’s, which is interpreted as the sentinel. When the string is output the sentinel will not appear.

The string output instruction

Symbols

ch sChar sInt i Assignment statements