b44fd68b9248cb4ba8757af5f219e3fe8c3bf136
1 /******************************************************************************
5 * $Date: 2007/03/26 01:00:38 $
8 * $Log: data_block.cpp,v $
9 * Revision 2.0 2007/03/26 01:00:38 hachti
10 * *** empty log message ***
13 ******************************************************************************/
18 #include "data_block.hh"
19 #include "data_block_0.hh"
25 /***************************************************************/
27 *\brief Specialisation constructor.
29 data_block::data_block(tape_block
& org
)
32 m_has_known_type
=false;
35 /***************************************************************/
37 *\brief Determine block type.
38 *\return the block type extracted from the block's data.
40 int data_block::get_type(){
41 return (word_data
[0]&0xf000)>>12;
44 /***************************************************************/
46 *\brief Get the block's size in 16 bit words.
47 *\return The block's 16-bit data buffer's size including
48 * header and checksum.
50 int data_block::get_word_size(){
54 /***************************************************************/
56 *\brief Describe the block.
57 *\return A vector of text lines describing this block.
59 vector
<string
> data_block::get_description(){
60 vector
<string
> result
;
61 string r_string
="***** "+get_typestring()+"Untyped data block, this \
62 is an illegal condition!";
63 result
.insert(result
.end(),r_string
);
67 /***************************************************************/
69 *\brief Extract 6 byte symbol name from word memory.
71 *\param firstbyte the first byte of the desired symbol name
72 *\return a string containing the symbol name.
73 * Trailing spaces are included.
74 *\note The word_data is handled system-intependently big endian!
76 string
data_block::extract_label(int firstbyte
){
77 string result
=""; // Start with empty string
79 // We don't accept negative arguments!
80 if (firstbyte
<0) return result
;
82 // We also don't want segmentation faults!
83 if (word_size
<(firstbyte
/2+1)) return result
;
85 // Here we pick out the characters.
86 for (int posi
=firstbyte
;posi
<firstbyte
+6;posi
++)
87 result
+=(word_data
[posi
/2]>>(8*(1-posi
%2)))&0x7f;