(self, offset, val)
Change program code.
Change program code.
Change program code .
def set_memory(self, offset, val):
        """Change program code."""
        if not self.allow_code_poke:
            logging.warning('Ignored POKE into program code')
        else:
            offset -= self.code_start
            loc = self.bytecode.tell()
            # move pointer to end
            self.bytecode.seek(0, 2)
            if offset > self.bytecode.tell():
                self.bytecode.write(b'\0' * (offset-self.bytecode.tell()))
            else:
                self.bytecode.seek(offset)
            self.bytecode.write(int2byte(val))
            self.bytecode.seek(0, 2)
            self.rebuild_line_dict()
            # restore program pointer
            self.bytecode.seek(loc)
def set_memory ( self , offset , val ) : if not self . allow_code_poke : logging . warning ( 'Ignored POKE into program code' ) else : offset -= self . code_start loc = self . bytecode . tell ( ) # move pointer to end self . bytecode . seek ( 0 , 2 ) if offset > self . bytecode . tell ( ) : self . bytecode . write ( b'\0' * ( offset - self . bytecode . tell ( ) ) ) else : self . bytecode . seek ( offset ) self . bytecode . write ( int2byte ( val ) ) self . bytecode . seek ( 0 , 2 ) self . rebuild_line_dict ( ) # restore program pointer self . bytecode . seek ( loc )