c83658519691addf8f3b0d5573edc5afbfca0915
4 #include "data_block.hh"
5 #include "data_block_0.hh"
11 /***************************************************************/
13 *\brief Specialisation constructor.
15 data_block::data_block(tape_block
& org
)
18 m_has_known_type
=false;
21 /***************************************************************/
23 *\brief Determine block type.
24 *\return the block type extracted from the block's data.
26 int data_block::get_type(){
27 return (word_data
[0]&0xf000)>>12;
30 /***************************************************************/
32 *\brief Get the block's size in 16 bit words.
33 *\return The block's 16-bit data buffer's size including
34 * header and checksum.
36 int data_block::get_word_size(){
40 /***************************************************************/
42 *\brief Describe the block.
43 *\return A vector of text lines describing this block.
45 vector
<string
> data_block::get_description(){
46 vector
<string
> result
;
47 string r_string
="***** "+get_typestring()+"Untyped data block, this \
48 is an illegal condition!";
49 result
.insert(result
.end(),r_string
);
53 /***************************************************************/
55 *\brief Extract 6 byte symbol name from word memory.
57 *\param firstbyte the first byte of the desired symbol name
58 *\return a string containing the symbol name.
59 * Trailing spaces are included.
60 *\note The word_data is handled system-intependently big endian!
62 string
data_block::extract_label(int firstbyte
){
63 string result
=""; // Start with empty string
65 // We don't accept negative arguments!
66 if (firstbyte
<0) return result
;
68 // We also don't want segmentation faults!
69 if (word_size
<(firstbyte
/2+1)) return result
;
71 // Here we pick out the characters.
72 for (int posi
=firstbyte
;posi
<firstbyte
+6;posi
++)
73 result
+=(word_data
[posi
/2]>>(8*(1-posi
%2)))&0x7f;