How to write good assembly programs, Computer Engineering

Assignment Help:

Preparation of writing the program

1.  Write an algorithm for your program closer to assembly language. For instance the algorithm for preceding program will be:

get NUM1

add NUM2

put sum into memory at RESULT

position carry bit in LSB of byte

                        mask off upper seven bits

                        store the result in the CARRY location.

2.  Specify the necessary input and output.

input required -                       two 8-bit numbers

output required -                     an 8-bit result and a 8-bit carry in memory.

 

3.  Study instruction set carefully. This step assists in specifying available instructions and their constraints andformat. For illustration the segment registers can't be directly initialized by a memory variable. In its place we have to first move offset for segment in a register and then move contents of register to segment register.

You can exit to DOS by employing interrupt routine 21h with function 4Ch placed in AH register.

It is a nice practice to first write your program on paper and employ comments generously. This makes programming easier and also helps you understand your program in future. Please consider that number of comments don't affect size of program. 

After program development you can assemble it by an assembler and correct it for errors, finally creating exe file for execution.


Related Discussions:- How to write good assembly programs

What is the function of a tlb, What is the function of a TLB (translation...

What is the function of a TLB (translation look-aside buffer)? A small cache called the TLB is interporated into MMU, which having of the page table entries that correspondi

Explain the term- cycle based simulator, Explain the term- Cycle Based Simu...

Explain the term- Cycle Based Simulator This is a Digital Logic Simulation method which eliminates unnecessary calculations to achieve huge performance gains in verifying Bool

Describe the advantages of java servlets over cgi interface, Describe the a...

Describe the advantages of JAVA servlets over CGI interface. The Advantage of Servlets Over "Tradi tional" CGI: Java servlets are extra efficient, easier to utilize more pow

C LANGUAGE PROGRAMME, find a c program to find the area under the curve y=f...

find a c program to find the area under the curve y=f(x) between x=a and x=b,intregrate y=f(x)between the limits of a and b.the area under a curve between two points can be found b

What is a microinstruction, What is a microinstruction? Each word in co...

What is a microinstruction? Each word in control memory having within it a microinstruction.  The microinstruction specifies one or more micro-operations for the system.  A seq

Main memory location, Poor Richard's cache as explained in Conference Topic...

Poor Richard's cache as explained in Conference Topic 2. Suppose that a 7th word (gggg gggg) from main memory location 011110 is read and stored in cache. a) Determine the cach

What is core dump, Raises when accessing an unassigned memory location acce...

Raises when accessing an unassigned memory location accessing a null pointer

Static and dynamic hazard, what inputcombinations may those hazard take pla...

what inputcombinations may those hazard take place and how can they be eliminated? F1= AB'' + A''C + BC''D'' F2= AB + A''C''D + AB''D

Illustarte basic flip-flops, Q. Illustarte Basic Flip-flops? Let's firs...

Q. Illustarte Basic Flip-flops? Let's first see a ordinary latch. A latch or flip-flop can be created employing two NOR or NAND gates. Figure (a) presents logic diagram for S-R

Pros and cons of assembly language, Pros and Cons of Assembly Language ...

Pros and Cons of Assembly Language The following are a number of advantages / disadvantages of employing assembly language: Assembly Language offers more control over ha

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd