(self, addr)
return -1
Retrieve data from BASIC memory.
Retrieve data from BASIC memory.
Retrieve data from BASIC memory .
def _get_basic_memory(self, addr):
        """Retrieve data from BASIC memory."""
        if addr < 4:
            # sentinel value, used by some programs to identify GW-BASIC
            return (0, 0, 0x10, 0x82)[addr]
        # DS:2c, DS:2d  end of memory available to BASIC
        elif addr == 0x2C:
            return self.total_memory % 256
        elif addr == 0x2D:
            return self.total_memory // 256
        # DS:30, DS:31: pointer to start of program, excluding initial \0
        elif addr == 0x30:
            return (self.code_start+1) % 256
        elif addr == 0x31:
            return (self.code_start+1) // 256
        # DS:358, DS:359: start of variable space
        elif addr == 0x358:
            return self.var_start() % 256
        elif addr == 0x359:
            return self.var_start() // 256
        # DS:35A, DS:35B: start of array space
        elif addr == 0x35A:
            return self.var_current() % 256
        elif addr == 0x35B:
            return self.var_current() // 256
        # DS:35C, DS:35D: end of array space
        elif addr == 0x35C:
            return (self.var_current() + self.arrays.current) % 256
        elif addr == 0x35D:
            return (self.var_current() + self.arrays.current) // 256
        elif addr == self.protection_flag_addr:
            return self.program.protected * 255
        return -1
def _get_basic_memory ( self , addr ) : if addr < 4 : # sentinel value, used by some programs to identify GW-BASIC return ( 0 , 0 , 0x10 , 0x82 ) [ addr ] # DS:2c, DS:2d  end of memory available to BASIC elif addr == 0x2C : return self . total_memory % 256 elif addr == 0x2D : return self . total_memory // 256 # DS:30, DS:31: pointer to start of program, excluding initial \0 elif addr == 0x30 : return ( self . code_start + 1 ) % 256 elif addr == 0x31 : return ( self . code_start + 1 ) // 256 # DS:358, DS:359: start of variable space elif addr == 0x358 : return self . var_start ( ) % 256 elif addr == 0x359 : return self . var_start ( ) // 256 # DS:35A, DS:35B: start of array space elif addr == 0x35A : return self . var_current ( ) % 256 elif addr == 0x35B : return self . var_current ( ) // 256 # DS:35C, DS:35D: end of array space elif addr == 0x35C : return ( self . var_current ( ) + self . arrays . current ) % 256 elif addr == 0x35D : return ( self . var_current ( ) + self . arrays . current ) // 256 elif addr == self . protection_flag_addr : return self . program . protected * 255 return - 1