(self, display, addr, num_bytes)
return mem_bytes
Retrieve bytes from textmode video memory.
Retrieve bytes from textmode video memory.
Retrieve bytes from textmode video memory .
def get_memory(self, display, addr, num_bytes):
        """Retrieve bytes from textmode video memory."""
        addr -= self._video_segment * 0x10
        mem_bytes = bytearray(num_bytes)
        for i in xrange(num_bytes):
            page, offset = divmod(addr+i, self._page_size)
            row, row_offset = divmod(offset, self._text_width*2)
            col = row_offset // 2
            try:
                if (addr+i) % 2:
                    mem_bytes[i] = display.pages[page].get_attr(1 + row, 1 + col)
                else:
                    mem_bytes[i] = display.pages[page].get_byte(1 + row, 1 + col)
            except IndexError:
                pass
        return mem_bytes
def get_memory ( self , display , addr , num_bytes ) : addr -= self . _video_segment * 0x10 mem_bytes = bytearray ( num_bytes ) for i in xrange ( num_bytes ) : page , offset = divmod ( addr + i , self . _page_size ) row , row_offset = divmod ( offset , self . _text_width * 2 ) col = row_offset // 2 try : if ( addr + i ) % 2 : mem_bytes [ i ] = display . pages [ page ] . get_attr ( 1 + row , 1 + col ) else : mem_bytes [ i ] = display . pages [ page ] . get_byte ( 1 + row , 1 + col ) except IndexError : pass return mem_bytes