def inject_basic_program(self, ascii_listing):
        """
        save the given ASCII BASIC program listing into the emulator RAM.
        """
        program_start = self.cpu.memory.read_word(
            self.machine_api.PROGRAM_START_ADDR
        )
        tokens = self.machine_api.ascii_listing2program_dump(ascii_listing)
        self.cpu.memory.load(program_start, tokens)
        log.critical("BASIC program injected into Memory.")

        # Update the BASIC addresses:
        program_end = program_start + len(tokens)
        self.cpu.memory.write_word(self.machine_api.VARIABLES_START_ADDR, program_end)
        self.cpu.memory.write_word(self.machine_api.ARRAY_START_ADDR, program_end)
        self.cpu.memory.write_word(self.machine_api.FREE_SPACE_START_ADDR, program_end)
        log.critical("BASIC addresses updated.")
def inject_basic_program ( self , ascii_listing ) : program_start = self . cpu . memory . read_word ( self . machine_api . PROGRAM_START_ADDR ) tokens = self . machine_api . ascii_listing2program_dump ( ascii_listing ) self . cpu . memory . load ( program_start , tokens ) log . critical ( "BASIC program injected into Memory." ) program_end = program_start + len ( tokens ) self . cpu . memory . write_word ( self . machine_api . VARIABLES_START_ADDR , program_end ) self . cpu . memory . write_word ( self . machine_api . ARRAY_START_ADDR , program_end ) self . cpu . memory . write_word ( self . machine_api . FREE_SPACE_START_ADDR , program_end ) log . critical ( "BASIC addresses updated." )
save the given ASCII BASIC program listing into the emulator RAM.