Jump to content
Sign in to follow this  
SpiceWare

difference between 'byte' '.byte' and 'ds 1'?

Recommended Posts

Answer to this question:

 

 

 

byte is used for data.  It's actually an alias for DC.B.  From dasm's manual*:

 

[label] DC[.BWL]    exp,exp,exp ...

	    Declare data in the current segment.  No output is generated if
	    within a .U segment.  Note that the byte ordering for the
	    selected processor is used for each entry.

	    The default size extension is a byte.
#if OlafByte
	    BYTE, WORD and LONG are synonyms for DC.B, DC.W and DC.L.
#endif

 

.byte is equivalent to byte.  Before deciding to write Medieval Mayhem from scratch I was originally going to hack Warlords. That's covered in these blog entries:

 

I used DiStella to turn the ROM for Warlords into source code, and it outputs .byte instead of byte.  I've been using .byte ever since.

 

Example usage from Warlords:

ColorBrickColors: .byte $47,$47,$45,$45,$43,$43,$41,$41

 

This would output two $47, two $45, two $43, and two $41 in the ROM.

 

 

 

 

ds is used to define a chunk of space.

[label] DS[.BWL]    exp[,filler]

	    declare space (default filler is 0). Data is not generated if
	    within an uninitialized segment.  Note that the number of bytes
	    generated is exp * entrysize (1,2, or 4)

	    The default size extension is a byte.

	    Note that the default filler is always 0 (has nothing to do
	    with the ORG default filler).

 

When doing so for RAM nothing actually gets stored in it.  When doing it for ROM it fills the entire space with 0, though you can override the fill value such as:

  ds 10, 255

which would output ten 255s in the ROM.

 

 

 

* file to look for is dasm.txt. It should have been included with dasm, but you can get it from here if you can't find it - look for the section titled Code & Documentation then click Documentation.

  • Like 4

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...