def get_filename_block_as_codepoints(self): """ TODO: Support tokenized BASIC. Now we only create ASCII BASIC. """ codepoints = [] codepoints += list(string2codepoint(self.filename.ljust(8, " "))) codepoints.append(self.cfg.FTYPE_BASIC) # one byte file type codepoints.append(self.cfg.BASIC_ASCII) # one byte ASCII flag # one byte gap flag (0x00=no gaps, 0xFF=gaps) # http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4231&p=9110#p9110 codepoints.append(self.gap_flag) # machine code starting/loading address if self.file_type != self.cfg.FTYPE_BASIC: # BASIC programm (0x00) codepoints = iter(codepoints) self.start_address = get_word(codepoints) log.info("machine code starting address: %s" % hex(self.start_address)) self.load_address = get_word(codepoints) log.info("machine code loading address: %s" % hex(self.load_address)) else: # not needed in BASIC files # http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4341&p=9109#p9109 pass log.debug("filename block: %s" % pformat_codepoints(codepoints)) return codepoints
def get_as_codepoints(self): result = [] delim = list(string2codepoint("\r"))[0] for code_line in self.code_lines: result.append(delim) result += list(code_line.get_as_codepoints()) result.append(delim) # log.debug("-"*79) # for line in pformat_codepoints(result): # log.debug(repr(line)) # log.debug("-"*79) return result
def get_as_codepoints(self): return tuple(string2codepoint(self.get_ascii_codeline()))