SunQuest
           Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old April 21st, 2008, 07:21 PM
Invalid02 Invalid02 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 216 Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level)Invalid02 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 2 h 54 m 16 sec
Reputation Power: 11
SPIM prints only first word in .data

Hey,

I'm playing around with MIPS and I have created a 'test' .data containing two words:

Code:
test:  .align 4				
	.word 0xDF5459FJ     
	.word 0x96JGJFS0


If I then load my MIPS file in SPIM and 'print test' I get:

Code:
Data seg @ 0x10010000 (268500992) = 0x0df5459f (234177951)


How can I get it to print out the full contents (both words) of the test data segment?

Thanks for your time.

Reply With Quote
  #2  
Old April 23rd, 2008, 03:10 PM
Schol-R-LEA's Avatar
Schol-R-LEA Schol-R-LEA is offline
Commie Mutant Traitor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Location: The People's Republic of Berkeley
Posts: 1,070 Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 39 m 40 sec
Reputation Power: 443
The integer print function only prints one full-word (32 bit) word at a time; to print two of them in sequence, you would need to use syscall 1 twice, once for each value.

OTOH, if you need to print the value as a double, you would need syscall 3 instead.

You have to keep in mind that the assembler itself has no sense of variable sizes except in the individual instructions or system calls; just because you have defined the two words with a single label does not make them part of a single variable. In assembly language, data is data is data; you can interpret the same word value as an integer, a float, an array of four characters, the high or low half of a double, or a set of 32 packed boolean flags, without regard to what data is actually stored there. The assembler imposes no structure on the data except that which you give it.
__________________
Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
#define KINSEY (rand() % 7) λ Scheme is the Red Pill
Scheme in ShortUnderstanding the C/C++ Preprocessor
Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > SPIM prints only first word in .data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway