Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 12th, 2007, 2:42 AM   #1
jbo423
Newbie
 
Join Date: Nov 2007
Posts: 3
Rep Power: 0 jbo423 is on a distinguished road
quick assembly question

I am currently taking a course in C++ at the University of Delaware, and my professor gave my class an extra credit project on assembly. I'm NOT looking for answers to these questions, just general help on finding the resources and some guides on the basics of assembly.


1. Disassemble the following machine code into operations and arguments, e.g. ADD, R1, R2, R3, etc., and explain what it does in either plain english or in C++ pseudocode.

0x00: 0000 0111 1111 1111
0x02: 0000 0110 1001 0010
0x04: 0000 0110 1100 1010
0x06: 0000 0011 1111 1010
0x08: 0010 1000 0111 0011
0x0A: 0010 0010 1001 0000
0x0C: 0011 1000 0100 0000
0x0E: 0011 1100 0000 0000


2. If the register file (each register is 32-bit) has the initial image as the following, what does the register file look like when the program stops?

R0: 0x 00 00 00 00
R1: 0x 00 00 00 0A
R2: 0x 00 00 00 00
R3: 0x 00 00 00 00
R4: 0x 00 00 00 00
R5: 0x 00 00 00 00
R6: 0x 00 00 00 00
R7: 0x 00 00 00 00


3. Write assembly code for a program that counts the number "1" bits of an integer in binary (given in regiser R1) and store the result in R7. This amounts to translating the following C-like code into assembly:

count = 0;
while (x != 0)
{
if (x & ox01 == 1)
count = count + i;
x = x >> 1;
}
return count;

the project is due by tuesday to recieve the extra credit. If anyone knows of a good assembly tutorial that would cover these types of questions, or if anyone has any tips or hints to give, they would be greatly appreciated.

Thanks!
jbo423 is offline   Reply With Quote
Old Nov 12th, 2007, 6:53 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: quick assembly question

Assembly language is not like a higher level language that reads the same for every machine.

Get the manual for your particular machine and go through the instruction set. There are many common operations between machines but the opcode/operand arrangements, and, indeed, even the register names (and how they function), will vary wildly.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 12th, 2007, 7:01 AM   #3
jbo423
Newbie
 
Join Date: Nov 2007
Posts: 3
Rep Power: 0 jbo423 is on a distinguished road
Re: quick assembly question

The only other information he gave is on the SPIM S20 assembly simulator, to be used in the second part of the extra credit next week. Does this simulator function as a specific architecture, and should i just find the documentation for it instead of basic assembly help?


note: i found online that SPIM S20 is a simulator that runs programs for the MIPS S2000/S3000 RISC computers. This lingo doesnt mean anything to me, but could this be the architecture i should look up?
jbo423 is offline   Reply With Quote
Old Nov 12th, 2007, 7:18 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: quick assembly question

Yes to either.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 12th, 2007, 7:21 AM   #5
jbo423
Newbie
 
Join Date: Nov 2007
Posts: 3
Rep Power: 0 jbo423 is on a distinguished road
Re: quick assembly question

Alright, i believe thats all i needed. Thank you!
jbo423 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick 80386 question Lesliect6 Assembly 2 Apr 21st, 2007 5:19 AM
Quick question.. really Quick Eric the Red Java 14 Jun 2nd, 2006 4:45 PM
Quick n00by question... jobobshishkabob C++ 13 Jan 25th, 2006 5:24 PM
Windows API programming quick question vynkz C++ 4 Apr 24th, 2005 12:33 PM
Quick Introduction and Question snuff Community Introductions 8 Mar 31st, 2005 7:26 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC