Homework 8. Robert Wortman CpE 185 Mon / Wed Dennis Dahlquist. November 14, 2011

Similar documents
ECpE 185 Laboratory Hand Assembly Fall 2006

Video processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs

UNIT 4. Modular Programming

Chapter 3: Addressing Modes

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler:

Lecture (06) x86 programming 5

Assembly Language Each statement in an assembly language program consists of four parts or fields.

Experiment N o 1. 1 Introduction to Assembly Language Programming

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microcomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات

Experiment 3 3 Basic Input Output

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

COE 205 Lab Manual Experiment N o 12. Experiment N o Using the Mouse

x86 and C refresher Lab

How to write an assembly language program.

ELEC VIDEO BIOS ROUTINES

Transfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters

LABORATORY 8: USING BIOS ROUTINES FOR KEYBOARD INPUT AND DISPLAY OUTPUT

Basic Assembly SYSC-3006

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

EEM336 Microprocessors I. Addressing Modes

Q1: Define a character string named CO_NAME containing "Internet Services" as a constant?

Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy

Mr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU

ELEC 242 Time Delay Procedure

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.

Week /8086 Microprocessor Programming I

EXPERIMENT TWELVE: USING DISK FILES

EEM336 Microprocessors I. Data Movement Instructions

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

X86-NASM STANDARD COMMANDS. Comment your code with a semicolon (;)! The assembler won t read anything after it.

Q1: Define a character string named CO_NAME containing "Internet Services" as a constant?

EE2007 Microprocessor systems.

EC 333 Microprocessor and Interfacing Techniques (3+1)

COMPUTER ENGINEERING DEPARTMENT

INTRODUCTION. NOTE Some symbols used in this manual CL = Click Left CR = Click Right DCL = Double Click Left = Enter. Page 1

MICROPROCESSOR TECHNOLOGY

Babu Madhav Institute of Information Technology, UTU

EC-333 Microprocessor and Interfacing Techniques

CS401 Assembly Language Solved MCQS From Midterm Papers

PESIT Bangalore South Campus

Experiment N o 3 Segmentation and Addressing Modes

Programming in Assembler. Laboratory manual. Exercise 3

LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES

Assignment no:4 on chapter no :3 : Instruction set of 8086

CS499. Intel Architecture

Lecture (07) x86 programming 6

if 2 16bit operands multiplied the result will be

Come and join us at WebLyceum

MPID MICROPROCESSOR AND ITS INTERFACING DEVICES EEE III II SEMESTER OBJECTIVE QUESTIONS

Computer Organization and Assembly Language CSC-210

Midterm Exam #2 Answer Key

Week /8086 Microprocessor Programming II

Signed number Arithmetic. Negative number is represented as

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics

CG2007 Microprocessor systems.

Intel 8086: Instruction Set

CSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class

mith College Computer Science CSC231 - Assembly Week #4 Dominique Thiébaut

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]

Mnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C

Lecture (08) x86 programming 7

Arithmetic Instructions

Experiment 8 8 Subroutine Handling Instructions and Macros

Microprocessors (A) DOS Services

Lecture 5 Program Logic and Control

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

Code segment Stack segment

Experiment N o 3. Segmentation and Addressing Modes

Lecture (05) x86 programming 4

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher

Kingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems

FACULTY OF ENGINEERING LAB SHEET

The registers(di,si) are automatically incremented or decremented depending on the value of the direction flag:

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Reverse Engineering II: The Basics

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Assembly Language LAB

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.

X86 Assembly Language and C Fundamentals. Chapter 5. Data Transfer Instructions. X86 Code Figures

1. Introduction to Assembly Language

CS-202 Microprocessor and Assembly Language

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication

Proposed Common Configuration Method

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Section 001 & 002. Read this before starting!

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Lesson 1. Fundamentals of assembly language

Intel 8086 MICROPROCESSOR ARCHITECTURE

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide

CYASM Assembler User s Guide Version 2.02

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Assembler Programming. Lecture 2

Objectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts

Transcription:

Homework 8 Robert Wortman CpE 185 Mon / Wed Dennis Dahlquist November 14, 2011 1 Question 1 1.1 (a) PROG51.ASM(14) : warning A4012: line number information for segment without class CODE : cseg Instructions (code) must be in a segemnt that has a class name ending in "CODE". 1.2 (b) LINK : warning L4055: start address not equal to 0x100 for /TINY If no.model statement is given, the tiny memory model is assumed. For that memory model, the starting address must be 0x100. 1.3 (c) PROG51.ASM(20) : error A2006: undefined symbol : e00h In MASM, numbers must start with a decimal digit, even if the numbers are hexadecimal. There is something magnificently broken about this. 1

1.4 (d) No assembly or linking errors, but since it s calling interrupt 0a h instead of 10 h, the program doesn t print anything. 1.5 (e) PROG51.ASM(25) : error A2006: undefined symbol : IIIA Labels must be defined before they can be used as the destination for a jump. 1.6 (f) PROG51.ASM(28) : fatal error A1010: unmatched block nesting : cseg Holy crap. A helpful error message. Sort of. 1.7 (g) LINK : warning L4055: start address not equal to 0x100 for /TINY Haven t we been here before? It seems that MASM uses the END directive to specify a program entry point (i.e. the starting address). So, if none is specified, it does the wrong thing, and then complains about it. 1.8 (h) PROG51.ASM(28) : error A2046: missing single or double quotation mark in string PROG51.ASM(30) : error A2046: missing single or double quotation mark in string PROG51.ASM(32) : error A2046: missing single or double quotation mark in string PROG51.ASM(34) : error A2046: missing single or double quotation mark in string PROG51.ASM(36) : error A2046: missing single or double quotation mark in string PROG51.ASM(38) : error A2046: missing single or double quotation mark in string PROG51.ASM(40) : error A2046: missing single or double quotation mark in string PROG51.ASM(42) : error A2046: missing single or double quotation mark in string PROG51.ASM(44) : error A2046: missing single or double quotation mark in string 2

PROG51.ASM(46) : error A2046: missing single or double quotation mark in string PROG51.ASM(48) : error A2046: missing single or double quotation mark in string PROG51.ASM(50) : error A2046: missing single or double quotation mark in string PROG51.ASM(52) : error A2046: missing single or double quotation mark in string PROG51.ASM(54) : error A2046: missing single or double quotation mark in string PROG51.ASM(56) : error A2046: missing single or double quotation mark in string PROG51.ASM(58) : error A2046: missing single or double quotation mark in string PROG51.ASM(60) : error A2046: missing single or double quotation mark in string PROG51.ASM(62) : error A2046: missing single or double quotation mark in string PROG51.ASM(64) : error A2046: missing single or double quotation mark in string PROG51.ASM(66) : error A2046: missing single or double quotation mark in string PROG51.ASM(68) : error A2046: missing single or double quotation mark in string PROG51.ASM(70) : error A2046: missing single or double quotation mark in string PROG51.ASM(72) : error A2046: missing single or double quotation mark in string PROG51.ASM(74) : error A2046: missing single or double quotation mark in string PROG51.ASM(76) : error A2046: missing single or double quotation mark in string PROG51.ASM(78) : error A2046: missing single or double quotation mark in string PROG51.ASM(80) : error A2046: missing single or double quotation mark in string PROG51.ASM(82) : error A2046: missing single or double quotation mark in string PROG51.ASM(84) : error A2046: missing single or double quotation mark in string PROG51.ASM(86) : error A2046: missing single or double quotation mark in string PROG51.ASM(88) : error A2046: missing single or double quotation mark in string PROG51.ASM(90) : error A2046: missing single or double quotation mark in string PROG51.ASM(92) : error A2046: missing single or double quotation mark in string PROG51.ASM(94) : error A2046: missing single or double quotation mark in string PROG51.ASM(96) : error A2046: missing single or double quotation mark in string PROG51.ASM(98) : error A2046: missing single or double quotation mark in string PROG51.ASM(100) : error A2046: missing single or double quotation mark in string PROG51.ASM(102) : error A2046: missing single or double quotation mark in string PROG51.ASM(104) : error A2046: missing single or double quotation mark in string PROG51.ASM(106) : error A2046: missing single or double quotation mark in string PROG51.ASM(108) : error A2046: missing single or double quotation mark in string PROG51.ASM(110) : error A2046: missing single or double quotation mark in string PROG51.ASM(112) : error A2046: missing single or double quotation mark in string PROG51.ASM(114) : error A2046: missing single or double quotation mark in string PROG51.ASM(116) : error A2046: missing single or double quotation mark in string PROG51.ASM(118) : error A2046: missing single or double quotation mark in string PROG51.ASM(120) : error A2046: missing single or double quotation mark in string PROG51.ASM(122) : error A2046: missing single or double quotation mark in string PROG51.ASM(124) : error A2046: missing single or double quotation mark in string PROG51.ASM(126) : error A2046: missing single or double quotation mark in string PROG51.ASM(128) : error A2046: missing single or double quotation mark in string PROG51.ASM(130) : error A2046: missing single or double quotation mark in string PROG51.ASM(132) : error A2046: missing single or double quotation mark in string PROG51.ASM(134) : error A2046: missing single or double quotation mark in string PROG51.ASM(136) : error A2046: missing single or double quotation mark in string PROG51.ASM(138) : error A2046: missing single or double quotation mark in string PROG51.ASM(140) : error A2046: missing single or double quotation mark in string PROG51.ASM(142) : error A2046: missing single or double quotation mark in string PROG51.ASM(144) : error A2046: missing single or double quotation mark in string PROG51.ASM(146) : error A2046: missing single or double quotation mark in string 3

PROG51.ASM(148) : error A2046: missing single or double quotation mark in string PROG51.ASM(150) : error A2046: missing single or double quotation mark in string PROG51.ASM(152) : error A2046: missing single or double quotation mark in string PROG51.ASM(154) : error A2046: missing single or double quotation mark in string PROG51.ASM(156) : error A2046: missing single or double quotation mark in string PROG51.ASM(158) : error A2046: missing single or double quotation mark in string PROG51.ASM(160) : error A2046: missing single or double quotation mark in string PROG51.ASM(162) : error A2046: missing single or double quotation mark in string PROG51.ASM(164) : error A2046: missing single or double quotation mark in string PROG51.ASM(166) : error A2046: missing single or double quotation mark in string PROG51.ASM(168) : error A2046: missing single or double quotation mark in string PROG51.ASM(170) : error A2046: missing single or double quotation mark in string PROG51.ASM(172) : error A2046: missing single or double quotation mark in string PROG51.ASM(174) : error A2046: missing single or double quotation mark in string PROG51.ASM(176) : error A2046: missing single or double quotation mark in string PROG51.ASM(178) : error A2046: missing single or double quotation mark in string PROG51.ASM(180) : error A2046: missing single or double quotation mark in string PROG51.ASM(182) : error A2046: missing single or double quotation mark in string PROG51.ASM(184) : error A2046: missing single or double quotation mark in string PROG51.ASM(186) : error A2046: missing single or double quotation mark in string PROG51.ASM(188) : error A2046: missing single or double quotation mark in string PROG51.ASM(190) : error A2046: missing single or double quotation mark in string PROG51.ASM(192) : error A2046: missing single or double quotation mark in string PROG51.ASM(194) : error A2046: missing single or double quotation mark in string PROG51.ASM(196) : error A2046: missing single or double quotation mark in string PROG51.ASM(198) : error A2046: missing single or double quotation mark in string PROG51.ASM(200) : error A2046: missing single or double quotation mark in string PROG51.ASM(202) : error A2046: missing single or double quotation mark in string PROG51.ASM(204) : error A2046: missing single or double quotation mark in string PROG51.ASM(206) : error A2046: missing single or double quotation mark in string PROG51.ASM(208) : error A2046: missing single or double quotation mark in string PROG51.ASM(210) : error A2046: missing single or double quotation mark in string PROG51.ASM(212) : error A2046: missing single or double quotation mark in string PROG51.ASM(214) : error A2046: missing single or double quotation mark in string PROG51.ASM(216) : error A2046: missing single or double quotation mark in string PROG51.ASM(218) : error A2046: missing single or double quotation mark in string PROG51.ASM(220) : error A2046: missing single or double quotation mark in string PROG51.ASM(222) : error A2046: missing single or double quotation mark in string PROG51.ASM(224) : error A2046: missing single or double quotation mark in string PROG51.ASM(226) : error A2046: missing single or double quotation mark in string PROG51.ASM(228) : fatal error A1012: error count exceeds 100; stopping assembly Apparently, MASM thinks that s supposed to be a string. Apparently, MASM also thinks that there I have something north of 228 lines in my program, instead of only twentysomething. 4

2 Question 2 Listing 1: p52.asm cseg segment code assume cs : cseg, ds : cseg, s s : cseg, es : cseg org 100h ; l e a v e room f o r PSP s t a r t : mov ah, 00h ; r e q u e s t " s e t mode" f u n c t i o n mov al, 02h ; r e q u e s t mode 2 i n t 0ah ; c a l l video s e r v i c e s mov ax,0920 h ; r e q u e s t " w r i t e c h a r a c t e r " function, char space mov bl, 1 ah ; r e q u e s t a t t r i b u t e s blue bg, b r i g h t green f g mov cx, 0 7 d0h ; r e q u e s t repeat, 0x07d0 r e p e a t s i n t 10h ; c a l l video s e r v i c e s mov ah, 0 2 h ; r e q u e s t "move c u r s o r " f u n c t i o n mov dx, 0 a00h ; r e q u e s t row 0x0a, column 0x00 mov bh, 0 0 ; r e q u e s t page 0 i n t 10h ; c a l l video s e r v i c e s mov ah, 0 eh ; r e q u e s t d i s p l a y ASCII c h a r a c t e r mov al, 0 0 ; s e t c h a r a c t e r next : i n t 10h ; c a l l video s e r v i c e s i n c a l ; s e t next c h a r a c t e r cmp al, 8 0 h ; i s c h a r a c t e r past ASCII range jnz next ; i f not, go to next c h a r a c t e r i n t 20h ; i f so, return to DOS cseg end ends s t a r t Assembling the above program produced the following listing file: Microsoft (R) Macro Assembler Version 6.14.8444 11/14/11 16:33:12 Q52.ASM Page 1-1 0000 cseg segment code assume cs:cseg, ds:cseg, ss:cseg, es:cseg org 100h ; leave room for PSP 5

0100 start: 0100 B4 00 mov ah, 00h ; request "set mode" function 0102 B0 02 mov al, 02h ; request mode 2 0104 CD 0A int 0ah ; call video services 0106 B8 0920 mov ax,0920h ; request "write character" function, char space 0109 B3 1A mov bl,1ah ; request attributes blue bg, bright green fg 010B B9 07D0 mov cx,07d0h ; request repeat, 0x07d0 repeats 010E CD 10 int 10h ; call video services 0110 B4 02 mov ah,02h ; request "move cursor" function 0112 BA 0A00 mov dx,0a00h ; request row 0x0a, column 0x00 0115 B7 00 mov bh,00 ; request page 0 0117 CD 10 int 10h ; call video services 0119 B4 0E mov ah,0eh ; request display ASCII character 011B B0 00 mov al,00 ; set character 011D next: 011D CD 10 int 10h ; call video services 011F FE C0 inc al ; set next character 0121 3C 80 cmp al,80h ; is character past ASCII range 0123 75 F8 jnz next ; if not, go to next character 0125 CD 20 int 20h ; if so, return to DOS 0127 cseg ends end start Microsoft (R) Macro Assembler Version 6.14.8444 11/14/11 16:33:12 Q52.ASM Symbols 2-1 Segments and Groups: N a m e Size Length Align Combine Class cseg.............. 16 Bit 0127 Para Private CODE Symbols: N a m e Type Value Attr next.............. L Near 011D cseg 6

start............. L Near 0100 cseg 0 Warnings 0 Errors 7