X-Git-Url: http://gitweb.hachti.de/?a=blobdiff_plain;f=pc-tools%2Fldc2%2Fsrc%2Fdata_block.cpp;h=41d52f8f2a22bb7a83462810b21207692d733b63;hb=fed2c751d37bf5e314fd26c98909471157cc86c0;hp=15702b56661acf21752c8287ddbda36175496ab8;hpb=97b26985c0190e2fded0f098819a23e892b381f0;p=h316.git diff --git a/pc-tools/ldc2/src/data_block.cpp b/pc-tools/ldc2/src/data_block.cpp index 15702b5..41d52f8 100644 --- a/pc-tools/ldc2/src/data_block.cpp +++ b/pc-tools/ldc2/src/data_block.cpp @@ -4,15 +4,21 @@ #include "data_block.hh" #include "data_block_0.hh" +#include -data_block::data_block(tape_block& idol) - :tape_block(idol) -{ -} +using namespace std; -data_block::~data_block(){ -} +/*! + *\brief Specialisation constructor. + */ +data_block::data_block(tape_block& org) + :tape_block(org) +{} +/*! + *\brief Determine block type. + *\return the block type extracted from the block's data. + */ int data_block::get_type(){ if ((init_state==TBS_OK)&&word_data) return (word_data[0]&0xf000)>>12; @@ -20,8 +26,47 @@ int data_block::get_type(){ return block_type; } -int data_block::get_subtype(){ - if (get_type()==0) - return (new data_block_0(*this))->get_subtype(); - else return 0; +/*! + *\brief Get the block's size in 16 bit words. + *\return The block's 16-bit data buffer's size including + * header and checksum. + */ +int data_block::get_word_size(){ + return word_size; +} + +/*! + *\brief Describe the block. + *\return A vector of text lines describing this block. + */ +vector data_block::get_description(){ + vector result; + string r_string="***** "+get_typestring()+"Untyped data block, this \ + is an illegal condition!"; + result.insert(result.end(),r_string); + return result; } + +/*! + *\brief Extract 6 byte symbol name from word memory. + * + *\param firstbyte the first byte of the desired symbol name + *\return a string containing the symbol name. + * Trailing spaces are included. + *\note The word_data is handled system-intependently big endian! + */ +string data_block::extract_label(int firstbyte){ + string result=""; // Start with empty string + + // We don't accept negative arguments! + if (firstbyte<0) return result; + + // We also don't want segmentation faults! + if (word_size<(firstbyte/2+1)) return result; + + // Here we pick out the characters. + for (int posi=firstbyte;posi>(8*(1-posi%2)))&0x7f; + return result; +} +