(
            self, new_mode_nr, new_colorswitch, new_apagenum, new_vpagenum,
            erase=1, new_width=None, force_reset=False
        )
Change the video mode, colourburst, visible or active page.
Change the video mode, colourburst, visible or active page.
Change the video mode colourburst visible or active page .
def screen(
            self, new_mode_nr, new_colorswitch, new_apagenum, new_vpagenum,
            erase=1, new_width=None, force_reset=False
        ):
        """Change the video mode, colourburst, visible or active page."""
        # reset palette happens even if the SCREEN call fails
        self.colourmap.reset()
        # find the new mode we're trying to get into
        if new_mode_nr is None:
            # keep current mode if graphics but maybe change width if text
            if self.mode.is_text_mode and new_width is not None:
                new_mode = modes.get_mode(
                    0, new_width, self._adapter, self._monitor, self._video_mem_size
                )
            else:
                new_mode = self.mode
        else:
            if new_mode_nr == 0 and new_width is None:
                # if we switch out of a 20-col mode (Tandy screen 3), switch to 40-col.
                # otherwise, width persists on change to screen 0
                new_width = 40 if (self.mode.width == 20) else self.mode.width
            # retrieve the specs for the new video mode
            new_mode = modes.get_mode(
                new_mode_nr, new_width, self._adapter, self._monitor, self._video_mem_size
            )
        # set colorswitch
        new_colorswitch = bool(new_colorswitch)
        if new_colorswitch is None:
            new_colorswitch = True
            if self._adapter == 'pcjr':
                new_colorswitch = False
            elif self._adapter == 'tandy':
                new_colorswitch = new_mode.is_text_mode
        # vpage and apage nums are persistent on mode switch with SCREEN
        # on pcjr only, reset page to zero if current page number would be too high.
        # in other adapters, that's going to raise an IFC later on.
        if new_apagenum is None:
            new_apagenum = self.apagenum
            if (self._adapter == 'pcjr' and new_apagenum >= new_mode.num_pages):
                new_apagenum = 0
        if new_vpagenum is None:
            new_vpagenum = new_apagenum
            if (self._adapter == 'pcjr' and new_vpagenum >= new_mode.num_pages):
                new_vpagenum = 0
        # if the new mode has fewer pages than current vpage/apage
        # illegal fn call before anything happens.
        # signal the signals to change the screen resolution
        if (new_apagenum >= new_mode.num_pages or new_vpagenum >= new_mode.num_pages):
            raise error.BASICError(error.IFC)
        # if mode or colorswitch changed, do a full reset
        # otherwise only change pages
        if force_reset or new_mode != self.mode or new_colorswitch != self.colorswitch:
            self._set_mode(new_mode, new_colorswitch, new_apagenum, new_vpagenum, erase)
        else:
            self.set_page(new_vpagenum, new_apagenum)
def screen ( self , new_mode_nr , new_colorswitch , new_apagenum , new_vpagenum , erase = 1 , new_width = None , force_reset = False ) : # reset palette happens even if the SCREEN call fails self . colourmap . reset ( ) # find the new mode we're trying to get into if new_mode_nr is None : # keep current mode if graphics but maybe change width if text if self . mode . is_text_mode and new_width is not None : new_mode = modes . get_mode ( 0 , new_width , self . _adapter , self . _monitor , self . _video_mem_size ) else : new_mode = self . mode else : if new_mode_nr == 0 and new_width is None : # if we switch out of a 20-col mode (Tandy screen 3), switch to 40-col. # otherwise, width persists on change to screen 0 new_width = 40 if ( self . mode . width == 20 ) else self . mode . width # retrieve the specs for the new video mode new_mode = modes . get_mode ( new_mode_nr , new_width , self . _adapter , self . _monitor , self . _video_mem_size ) # set colorswitch new_colorswitch = bool ( new_colorswitch ) if new_colorswitch is None : new_colorswitch = True if self . _adapter == 'pcjr' : new_colorswitch = False elif self . _adapter == 'tandy' : new_colorswitch = new_mode . is_text_mode # vpage and apage nums are persistent on mode switch with SCREEN # on pcjr only, reset page to zero if current page number would be too high. # in other adapters, that's going to raise an IFC later on. if new_apagenum is None : new_apagenum = self . apagenum if ( self . _adapter == 'pcjr' and new_apagenum >= new_mode . num_pages ) : new_apagenum = 0 if new_vpagenum is None : new_vpagenum = new_apagenum if ( self . _adapter == 'pcjr' and new_vpagenum >= new_mode . num_pages ) : new_vpagenum = 0 # if the new mode has fewer pages than current vpage/apage # illegal fn call before anything happens. # signal the signals to change the screen resolution if ( new_apagenum >= new_mode . num_pages or new_vpagenum >= new_mode . num_pages ) : raise error . BASICError ( error . IFC ) # if mode or colorswitch changed, do a full reset # otherwise only change pages if force_reset or new_mode != self . mode or new_colorswitch != self . colorswitch : self . _set_mode ( new_mode , new_colorswitch , new_apagenum , new_vpagenum , erase ) else : self . set_page ( new_vpagenum , new_apagenum )