(self, args)
PALETTE USING: set palette from array buffer.
PALETTE USING: set palette from array buffer.
PALETTE USING : set palette from array buffer .
def palette_using_(self, args):
        """PALETTE USING: set palette from array buffer."""
        array_name, start_indices = next(args)
        array_name = self._memory.complete_name(array_name)
        list(args)
        try:
            dimensions = self._memory.arrays.dimensions(array_name)
        except KeyError:
            raise error.BASICError(error.IFC)
        error.throw_if(array_name[-1:] != values.INT, error.TYPE_MISMATCH)
        lst = self._memory.arrays.view_full_buffer(array_name)
        start = self._memory.arrays.index(start_indices, dimensions)
        num_palette_entries = self.colourmap.num_palette
        error.throw_if(self._memory.arrays.array_len(dimensions) - start < num_palette_entries)
        new_palette = []
        for i in range(num_palette_entries):
            offset = (start+i) * 2
            ## signed int, as -1 means don't set
            val, = struct.unpack('<h', lst[offset:offset+2])
            error.range_check(-1, self.colourmap.num_colours-1, val)
            new_palette.append(val if val > -1 else self.colourmap.get_entry(i))
        self.colourmap.set_all(new_palette)
def palette_using_ ( self , args ) : array_name , start_indices = next ( args ) array_name = self . _memory . complete_name ( array_name ) list ( args ) try : dimensions = self . _memory . arrays . dimensions ( array_name ) except KeyError : raise error . BASICError ( error . IFC ) error . throw_if ( array_name [ - 1 : ] != values . INT , error . TYPE_MISMATCH ) lst = self . _memory . arrays . view_full_buffer ( array_name ) start = self . _memory . arrays . index ( start_indices , dimensions ) num_palette_entries = self . colourmap . num_palette error . throw_if ( self . _memory . arrays . array_len ( dimensions ) - start < num_palette_entries ) new_palette = [ ] for i in range ( num_palette_entries ) : offset = ( start + i ) * 2 ## signed int, as -1 means don't set val , = struct . unpack ( '<h' , lst [ offset : offset + 2 ] ) error . range_check ( - 1 , self . colourmap . num_colours - 1 , val ) new_palette . append ( val if val > - 1 else self . colourmap . get_entry ( i ) ) self . colourmap . set_all ( new_palette )