Previous in Forum: Windows 8.1   Next in Forum: Most Cost Effective Enhancement for Poor Quality Security Camera
Close
Close
Close
16 comments
Rate Comments: Nested
Participant

Join Date: Jan 2014
Posts: 4

Assembly Language

01/22/2014 10:32 AM

I would appreciate if anyone can help me with following assembly

programming questions

1) Write a complete 80x86 assembly language program to prompt for the length and width of a rectangle and to display its perimeter (2*length+ 2*width).

2) Write an Assembly program to find the total number of even and odd numbers from an array (declare the array with the following data 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 of type WORD).

3) Write an Assembly program to concatenate two strings INSTR1 and INSTR2 and store the result in the string INSTR1.

4) Write a program that uses a loop to input signed 32-bit integers from the user and computes and displays their minimum and maximum values. The program terminates when the user enters an invalid input.

5) Using the following table as a guide, write a program that asks the user to enter an integer test score between 0 and 100. The program should display the appropriate letter grade. The program should display an error message if the test score is <0 or >100.

90 to 100

85 to 89

80 to 84

75 to 79

70 to 74

65 to 70

60 to 64

55 to 59

0 to 54

A+

A

B+

B

C+

C

D+

D

F

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru

Join Date: Jun 2013
Location: Central Canada
Posts: 677
Good Answers: 28
#1

Re: Assembly Language

01/22/2014 10:49 AM

No one visiting here seems to read the site rules. This is not a homework site.

__________________
Smart as a post and twice as fast.
Register to Reply
Participant

Join Date: Jan 2014
Posts: 4
#3
In reply to #1

Re: Assembly Language

01/22/2014 10:58 AM

Its not a homework

I found these in Assembly Language Book and I'm just looking for a solutions .

Thank you

Register to Reply
Guru

Join Date: Jun 2013
Location: Central Canada
Posts: 677
Good Answers: 28
#5
In reply to #3

Re: Assembly Language

01/22/2014 11:05 AM

The same book, if it is of any value should illustrate the solution( s ).

Only a course TEXTBOOK, to my knowledge, posts questions without answers.

__________________
Smart as a post and twice as fast.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#7
In reply to #3

Re: Assembly Language

01/22/2014 11:15 AM

Every even integer greater than 2 can be expressed as the sum of two primes.

I'll leave the proof as an exercise for the reader.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru
Engineering Fields - Electrical Engineering - Been there, done that. Engineering Fields - Control Engineering - New Member

Join Date: Dec 2008
Location: Long Island NY
Posts: 15600
Good Answers: 981
#9
In reply to #7

Re: Assembly Language

01/22/2014 12:10 PM

The G stands for Goldbach? Wow. You must have a very dusty picture in your attic.

__________________
"Don't disturb my circles." translation of Archimedes last words
Register to Reply Off Topic (Score 5)
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#2

Re: Assembly Language

01/22/2014 10:52 AM

How much you paying?

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru

Join Date: Mar 2007
Location: by the beach in Florida
Posts: 33392
Good Answers: 1817
#4

Re: Assembly Language

01/22/2014 11:02 AM
__________________
All living things seek to control their own destiny....this is the purpose of life
Register to Reply
Participant

Join Date: Jan 2014
Posts: 4
#6
In reply to #4

Re: Assembly Language

01/22/2014 11:13 AM

Thank you my friend for your help

Register to Reply
Guru
Popular Science - Weaponology - New Member United Kingdom - Member - New Member

Join Date: May 2007
Location: Harlow England
Posts: 16512
Good Answers: 670
#8

Re: Assembly Language

01/22/2014 12:02 PM

The question doesn't make sense as it doesn't say how you input or display data. Assembly language has no such commandes. You have to write your own input routine to read say button pushes on an input port and to output data onto a port which goes to some sort of peripheral.

First ever assembly language program I wrote was for a PDP11 ? it had data input on key switches and the answer read out on the lamps.

Del

__________________
health warning: These posts may contain traces of nut.
Register to Reply
Participant

Join Date: Jan 2014
Posts: 4
#10
In reply to #8

Re: Assembly Language

01/22/2014 12:15 PM

Thank you for you help :)

Register to Reply
Guru

Join Date: Feb 2011
Posts: 7025
Good Answers: 207
#11

Re: Assembly Language

01/22/2014 3:19 PM
Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#12

Re: Assembly Language

01/23/2014 5:47 AM

Years ago, I would have programmed the whole lot in GBASIC, tested it, all within a 4 - 6 hour window.....

Then once it worked exactly as required, I would have assembled/converted the now tested & working GBASIC program to allow it to run faster in machine code........though it would be probably bigger and not as fast in execution as a properly written assembler only program.....but who cares.....?

Written directly in assembly for say a home computer with a Z80 for example, but taking maybe a week of spare time, assuming I am allowed to include/use any routines that I have already.....

40 Years ago for example, a good programmer managed, on average, to write between 1 and 5 lines of FULLY TESTED code a day.........expensive stuff software.....

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply Score 1 for Off Topic
Guru

Join Date: Dec 2009
Posts: 581
Good Answers: 15
#13

Re: Assembly Language

01/23/2014 4:07 PM

I never liked assembly language because it's not portable at all. Every processor has its own. Oh, and it takes a lot of effor to do not much.

The input/output is the big pain. The core processing of each question is pretty easy.

#1 is addition: l+l+w+w. You don't even need to look up the "multiply" instructions. :)

#2: AND-ing a number with 1 will tell you whether it's even or odd (result = 0 means even).

Careful with #3. Concatenating strings means making sure your destination buffer has enough space for both. Don't just copy INSTR2 to the end of INSTR1 unless you know you won't overwrite useful data.

#4: You don't need to store all the numbers. Start with min = "very large number" and max = "very small numnber." For each number read, if it's < min, set min to the number. If number > max, max=number.

#5 is straightforward.

__________________
Ignorance is no sin. Willful ignorance is unforgiveable.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#14
In reply to #13

Re: Assembly Language

01/23/2014 6:23 PM

"Oh, and it takes a lot of effor to do not much" - depends how fast you want it to run, and how big you want the code to be. If time and memory size no problem, then I agree. If you want it to fly and squish (how did they do video games on a 4MHz/4Kb RAM 8 bit machine?) then assembly language is the way to go.

Sometimes just a tiny bit of code - equating to one or two lines of HLL code, especially in a loop - can be optimized in assembler to make all the difference to an application's performance.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Guru

Join Date: Dec 2009
Posts: 581
Good Answers: 15
#15
In reply to #14

Re: Assembly Language

01/24/2014 10:02 AM

You have a fair point. Video game programmers are always trying to out-perform each other (and themselves), so even with a PS4 they're still optimizing small chunks of code.

But try to write "Halo" in assembly language.

__________________
Ignorance is no sin. Willful ignorance is unforgiveable.
Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#16
In reply to #15

Re: Assembly Language

01/24/2014 10:10 AM

Waaaay back when I programmed an emission tomographic body scanner in assembly language, including real-time deconvolution and back-projection of the image data. Took a while, especially the hand-assembling into machine code bit.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Register to Reply 16 comments
Copy to Clipboard

Users who posted comments:

Andy Germany (1); Fredski (1); JohnDG (4); LongintheTooth (2); Lynn.Wallace (2); redfred (1); sea_2035 (3); SolarEagle (1); user-deleted-1105 (1)

Previous in Forum: Windows 8.1   Next in Forum: Most Cost Effective Enhancement for Poor Quality Security Camera

Advertisement