Google Answers Logo
View Question
 
Q: A Few Simple Assembly Programming Questions ( No Answer,   1 Comment )
Question  
Subject: A Few Simple Assembly Programming Questions
Category: Computers > Programming
Asked by: bildy-ga
List Price: $20.00
Posted: 28 Mar 2003 09:29 PST
Expires: 08 Apr 2003 14:41 PDT
Question ID: 182368
All programs can be done in either Protected mode or Real-address
mode, as I need these to study for an upcoming test from.  Thanks
alot, and feel free to comment with an question, comments, or
concerns.

1.  Subtracting Three Integers
Using the AddSub program provided below as reference, write a program
that subtracts three 16-bit integers using only registers.  Insert a
call DumpRegs statement to display the register values.
TITLE Add and Subtract               (AddSub.asm)
;This program adds and subtracts 32-bit integers.
INCLUDE Irvine32.inc
.code
main PROC
     mov eax,10000h                  ;EAX = 10000h
     add eax,40000h                  ;EAX = 50000h
     sub eax,20000h                  ;EAX = 30000h
     call DumpRegs                   ;display registers

     exit
main ENDP
END main

2.  Data Definitions
Write a program that contains a definition of each data type listed
below.  Initialize each variable to a value that is consistent with
its data type.
TYPE               USAGE

BYTE               8-bit unsigned integer
SBYTE              8-bit signed integer
WORD               16-bit unsigned integer
SWORD              16-bit signed integer
DWORD              32-bit unsigned integer
SDWORD             32-bit signed integer
FWORD              48-bit integer
QWORD              64-bit integer
TBYTE              80-bit (10 byte) integer
REAL4              32-bit (4 byte) IEEE short real
REAL8              64-bit (8 byte) IEEE long real
REAL10             80-bit (10 byte) IEEE extended real

3.  Symbolic Integer Constants
Write a program that defines symbolic constants for all of the days of
the week.  Create an array variable that uses the symbols as
initializers.

4.  Symbolic Text Constants
Write a program that defines symbolic names for several string
literals (characters between quotes).  Use each symbolic name in a
variable definition.

Clarification of Question by bildy-ga on 28 Mar 2003 20:00 PST
This should take less than 30 minutes for someone who knows what they are doing.
I have upped the fee to $10.

Thanks

Clarification of Question by bildy-ga on 30 Mar 2003 20:51 PST
I have upped the anty to $20, please consider answering this question
as soon as possible !
Answer  
There is no answer at this time.

The following answer was rejected by the asker (they received a refund for the question).
Subject: Re: A Few Simple Assembly Programming Questions
Answered By: studboy-ga on 31 Mar 2003 12:17 PST
 
1)

INCLUDE Irvine32.inc                 ; Proetcted mode initialization
.code 
main PROC 
     mov eax,80000h                  
     call DumpRegs                   ;display registers 
     sub eax,40000h                 
     call DumpRegs                   ;display registers 
     sub eax,20000h                
     call DumpRegs                   ;display registers 
     sub eax,10000h                
     call DumpRegs                   ;display registers 
 
     exit 
main ENDP 
END main 

2)

.data 
valb BYTE 12h
valsb SBYTE -12h
valw WORD 1234h
valsw SWORD -1234h
valdw DWORD 12345678h
valsdw SDWORD -12345678h
valfw FWORD 123456781234h
valqw QWORD 1234567812345678h
valtb TBYTE 1000000000123456789Ah
valr4 REAL4 -1.0
valr8 REAL8 1.0E-260
valr10 REAL10 1.0E+4000

3)

SUN = 0
MON = 1
TUE = 2
WED = 3
THU = 4
FRI = 5
SAT = 6

DAYS BYTE SUN,MON,TUE,WED,THU,FRI,SAT

4)

string1 TEXTEQU <"Sex ">
string2 TEXTEQU <"Booz ">
.data
prompt1 BYTE string1
prompt2 BYTE string2

Request for Answer Clarification by bildy-ga on 03 Apr 2003 15:10 PST
Please put all questions into separate programs, so they can be
compiled.  A generous tip will be given for working progrqams.

Thanks alot.

Clarification of Answer by studboy-ga on 03 Apr 2003 16:22 PST
These are *already* working programs:

For example, take 4)

Put 

string1 TEXTEQU <"Sex "> 
string2 TEXTEQU <"Booz "> 
.data 
prompt1 BYTE string1 
prompt2 BYTE string2

into a file call test.asm

Then do masn test.asm

BTW, where do you get these questions from?
If they are from your TA, this is taken from the questions at the end of the
chapter (#3) from a book--the answers are meant to be snipplets:

http://www.nuvisionmiami.com/books/asm/sampleChapters/chapt_03.pdf

Clarification of Answer by studboy-ga on 03 Apr 2003 16:22 PST
masm test.asm

Clarification of Answer by studboy-ga on 03 Apr 2003 16:29 PST
So, just a hint--since he takes the questions from this book, probably
the exam questions are based on this book--he's lazy!  So buy the
book--you will ace the exam *for sure*!

Clarification of Answer by studboy-ga on 03 Apr 2003 16:31 PST
BTW, in case you didn't notice, Irvine32.inc is in chapter 3 of that book.
It basically sets up the mode.  Of course you will need it to compile.

Request for Answer Clarification by bildy-ga on 03 Apr 2003 21:02 PST
This is what i get when i try to compile #4...
 Assembling: 4.asm
4.asm(3) : error A2013: .MODEL must precede this directive
4.asm(4) : error A2034: must be in segment block
4.asm(5) : error A2034: must be in segment block
4.asm(5) : error A2088: END directive required at end of file
Press any key to continue . . . 

Tool completed successfully

What exactly do I have to put in the compiler to set it up?  Give me
the exact syntax for these programs please...

Clarification of Answer by studboy-ga on 04 Apr 2003 05:30 PST
Hi bildy-ga

I see what version of the assembler you're using now (I'm using a
different version)--try this and let me know if it works:

.386

.MODEL  flat, stdcall

string1 TEXTEQU <"Sex ">  
string2 TEXTEQU <"Booz ">  
.data  
prompt1 BYTE string1  
prompt2 BYTE string2 

.CODE

end

Clarification of Answer by studboy-ga on 04 Apr 2003 05:41 PST
BTW, just curious, what school/class is this?  It seems like the
TA/instructor support for this class is ..... :)  I think they should
at least *teach* you how to use MASM the first day of class.
Reason this answer was rejected by bildy-ga:
Unsatisfactory answer! I asked for working programs, but these were
not provided by the researcher.  Also, the syntax on at least one of
the programs was incorrecrt, which I can prove.  Thanks for your time,
and I hope to have better luck with answers.google.com in the future,
as I have in the past !

Comments  
Subject: Re: A Few Simple Assembly Programming Questions
From: aceresearcher-ga on 28 Mar 2003 10:29 PST
 
Greetings, bildy! 
 
You have requested 4 computer programs. It is quite possible that no
Researcher will be willing to Answer your Question for the fee you are
offering. I encourage you to check out Google Answer's Pricing Guide
at
http://answers.google.com/answers/pricing.html 

"$2 - $5  ·  Can be answered with a single link or a single piece of
information. Sometimes, if a researcher is personally interested in
the question's subject, they may provide a longer answer.
  ·  Not appropriate for multipart questions. 
  ·  Only 60% of the questions asked in this price range are
answered."
$10-$15 ·  Can be answered with 30 minutes of work."

As Answering your Question would likely take considerably longer than
30 minutes, you may want to consider raising your fee.
 
Best wishes, 
 
aceresearcher

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy