Create a basic i-o (input/output) library of subroutines

Assignment Help Assembly Language
Reference no: EM131112201

For this lab, you will create a Basic I/O (input/output) Library of subroutines. There are 7 subroutines in this library, 4 of which you must write. The lowest level routines have been provided for you and are in the file BasicIO.asm. They are:

GetChar - get a character from the keyboard, echo to the display and return it in reg al. - Note: if a linefeed (LF) is received (Enter key), a carriage return (CR) will also be echoed.

PutChar - display a character passed in reg al.

The higher level routines which you will write call the above routines. They are:

GetStr - read a string from the keyboard and place it at the address passed in register AX

           Note: you must delimit this string by placing a ‘$’ at the end

GetNum - read an unsigned 16-bit decimal number (<65535) from the keyboard and return it in register AX. -

Note: for now, you do not need to do any error checking - this means that you have to be careful when testing!

PutStr - display a string – address is passed in the AX reg -

Note: string passed must be delimited with a ‘$’

PutLine - display a string (address in AX) and also print CR/LF -

Note: this routine is written for you – it calls

PutStr first PutNum - display a 16 bit signed number passed in the AX reg -

Note: you did this in Lab 2 – you get to re-use code!

Note that since you will be using the AL or AX register to pass and return parameters, you do not save this register inside each subroutine. You must push (and pop) all other registers you use in each subroutine, however.

Be careful with labels since all of the subroutines will be in a single file. You cannot have a duplicate label. Use the convention shown in the subroutines given. Notice that each subroutine has 2 capital letters in the title and these letters are unique. For example, for the GetChar routine, these characters are GC. Precede every label inside this routine with GC (notice GCWait). In this way, you will not have any duplicate labels. You should also remember that the assembler is NOT case sensitive – we only use uppercase letters to improve the documentation. It is good practice to use a capital letter to begin every label.

Once again we will test these subroutines by writing a Main routine during the main lab. This routine will be more complicated; however, as we will display some interesting messages.

Prelab Deliverables:

1. Some or all of the assembly code for the subroutines in basicio.asm In this Lab you will write a Main program to test the Basic I/O subroutine you wrote for the PreLab. You will test your knowledge of program structure and gain more experience in assembly language coding and debugging.

Upon arrival, show your pre-lab deliverables to the TA so that your pre-lab mark is recorded. Like basicio.asm, you will be required to keep and submit one intermediate version of the main program. See Submission details at the bottom.

You should first assemble your subroutines to make sure you have no obvious errors in your code. The Main program is slightly more complicated and you need to think about the I/O process. First of all, for most applications you do not call the low level routines GetChar and PutChar. They are used by the higher level I/O subroutines that you wrote for reading and writing strings and numbers.

Secondly, you cannot just call an input routine like GetStr or GetNum on its own. Think carefully about what would happen. Let’s say at some point in your program you want to read a number from the keyboard and place it in a memory location. Consider the following code fragment:

MyNum: dw

Main: … …

call GetNum

mov MyNum1, ax 

This code will assemble and run and when you enter a number and press ‘Enter’ it will store the number at location MyNum. However, how does the person running the program know when to enter a number, or whether to enter a number or a string? When subroutine GetNum is called it will simply wait for input from the keyboard. But the program gives no indication that it is waiting for input! The simple answer is that you must always first write a string to the screen asking for the kind of input you want the user to enter, then call the appropriate input routine. So, our revised program should look like this:

Prompt1: db ‘Enter a number less than 65536: $’

MyNum: dw

Main:

 …-----------

-----------

Mov ax, Prompt1

Call PutStr

call GetNum

mov MyNum1, ax

Now when the program runs it first prints a message asking for a number and then waits for input. Try this out – if you have written your routines correctly, I think you will like the way this works. Don’t try to test all of your subroutines all at once. If something goes wrong, you may not know where the problem is. Call each subroutine on its own several times to make sure it is working before testing the next. What you submit should allow the TAs to enter their own numbers and strings in order to test the code. The extensiveness of your testing will make up part of your final mark.

Reference no: EM131112201

Questions Cloud

Explain the phenomenon of money creation : Explain the phenomenon of money creation with fractional reserve banking using a numerical example with reserve ratio R=25%. Examine some of the problems governments and central banks face in trying to control the money supply and present any excepti..
Calculate the magnitude of the deadweight loss resulting : Two hundred paper mills compete in the paper market. The total cost of production (in dollars) for each mill is given by the formula TC = 500Qmill+ (Qmill)2 where Qmill indicates the mills annual production in thousands of tons. The marginal cost of ..
Tranching pool of assets reduces default risk of the pool : Fannie Mae performed the useful function of increasing the liquidity of the secondary market of mortgage loans. Putting different mortgage loans in a pool for selling is always bad for the economy. The asset in an asset backed security is often a fix..
Take credit for good economic performance : Presidents like to take credit for good economic performance. If there are lags in policies, explain why presidents may not deserve all the credits (or blame) for economic policies.
Create a basic i-o (input/output) library of subroutines : For this lab, you will create a Basic I/O (input/output) Library of subroutines. There are 7 subroutines in this library, 4 of which you must write. The lowest level routines have been provided for you and are in the file BasicIO.asm. They are:
Plot separate correlation functions of white noise data : Compute and plot separate correlation functions of white noise data and of sinusoidal data. Do this using both the biased and unbiased autocorrelation functions. Are the results what you expected?
Voltage boost : Assume that the machine is excited with a stator voltage amplitude that is directly proportional to the excitation frequency so that V1 = 13 pu. Consider three excitation frequencies we =13 = 1.0, 0.5, and 0.1 pu. Determine the maximum torque Tmax, t..
Possible relationships between business and government : Luo (2001, 2004) suggests 4 possible relationships between business and government. Use this model to discuss the relationship between Singapore Airlines and the Singapore Government.
A major source of noise and vibration in vehicles : You are to write an article not exceeding 3000 words entitled “Powertrain – a major source of noise and vibration in vehicles”.   You will want to cover the basic sources of dynamic forces in engines and their ancillaries: mechanical, combustion, and..

Reviews

Write a Review

Assembly Language Questions & Answers

  Write a complete well documented assembly language

write a complete well documented assembly language program (starts at $C000) that counts the number of 1s in each byte in a list. The LIST_IN starts at $C100 and it has 12 bytes ( create your own random bytes for the list). The results (count of 1s) ..

  Describe advantage of program-counter-relative addressing

Describe one advantage and one disadvantage of program-counter-relative addressing. The Core i7 has a condition code bit that keeps track of the carry out of bit 3 after an arithmetic operation. What good is it?

  Write an lc-3 assembly language program

Write an Lc-3 assembly language program to read in a sequence of single-digit positive integers from the keyboard(one integer per line) until the sentinel value of 0 is reached and then display the largest integer on the screen

  Assembly language point-of-view

From an Assembly Language point-of-view, any registers that are touched by a function need to first be preserved and then later restored to their original value when that function ends, if that functions wishes to leave no side-effects after its exec..

  A screenshot of the modified assembly code

Modify the program to step the lights through a realistic sequence. Include conditional statements that ensure that assembly program only executes for 10 times.

  Translate assembly language program into machine code

Translate the following assembly language program into machine code Translate the following machoine language program into assembly code

  Write a hla assembly program

Write a HLA assembly program that Read 2 hex digits with the bits abccdddd. "a" is for determining if the person female or male(1 male, 0 female) "b" is for determining if the person student or not (1 yes, 0 no) "cc" is for determining which semes..

  Modify the single-cycle mips processor

Modify the single-cycle MIPS processor to implement one of the following instructions. Sec Appendix B for a definition of the instructions. Mark up a copy to indicate the changes to the datapath. Name any new control signals.

  Integral square root of an input number

Write a short assembly program that computes the integral square root of an input number and In this problem you will write a program that will compute the first 20 numbers in the Fibonacci sequence.

  Write mips assembly program to read two non-negative numbers

Write MIPS assembly program to repeatedly read two non-negative integers and print integer product and quotient without using multiplication and division instructions.

  Write an arm subroutine which will extract a substring

Write an ARM subroutine which will extract a substring from a string. You will need to use the library routine malloc to allocate memory for the new string. Use the pointers(a1,a2,a3) as stated below for writing ARM PROGRAM

  Write a program which will give the calendar for 3 mnth

Need the following assignment assembled Using MASM and notepad ++ for windows 8086 processor write a program which will give the calendar for atleast 3 months starting from November 2011 to January 2012 including the days/dates

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