(self, addr, value)
Set data in low memory.
Set data in low memory.
Set data in low memory .
def _set_low_memory(self, addr, value):
        """Set data in low memory."""
        addr -= 0
        if addr == 1047:
            self.keyboard.mod = value
        # from basic_ref_3.pdf: the keyboard buffer may be cleared with
        # DEF SEG=0: POKE 1050, PEEK(1052)
        elif addr == 1050:
            # keyboard ring buffer starts at n+1024; lowest 1054
            self.keyboard.buf.ring_set_boundaries(
                (value - self.key_buffer_offset) // 2,
                self.keyboard.buf.stop
            )
        elif addr == 1052:
            # ring buffer ends at n + 1023
            self.keyboard.buf.ring_set_boundaries(
                self.keyboard.buf.start,
                (value - self.key_buffer_offset) // 2
            )
        elif addr in range(1024+self.key_buffer_offset, 1024+self.key_buffer_offset+32):
            index = (addr-1024-self.key_buffer_offset) // 2
            odd = (addr-1024-self.key_buffer_offset) % 2
            c, scan = self.keyboard.buf.ring_read(index)
            if odd:
                scan = value
            elif value in (0, 0xe0):
                c = b''
            else:
                c = int2byte(value)
            self.keyboard.buf.ring_write(index, c, scan)
def _set_low_memory ( self , addr , value ) : addr -= 0 if addr == 1047 : self . keyboard . mod = value # from basic_ref_3.pdf: the keyboard buffer may be cleared with # DEF SEG=0: POKE 1050, PEEK(1052) elif addr == 1050 : # keyboard ring buffer starts at n+1024; lowest 1054 self . keyboard . buf . ring_set_boundaries ( ( value - self . key_buffer_offset ) // 2 , self . keyboard . buf . stop ) elif addr == 1052 : # ring buffer ends at n + 1023 self . keyboard . buf . ring_set_boundaries ( self . keyboard . buf . start , ( value - self . key_buffer_offset ) // 2 ) elif addr in range ( 1024 + self . key_buffer_offset , 1024 + self . key_buffer_offset + 32 ) : index = ( addr - 1024 - self . key_buffer_offset ) // 2 odd = ( addr - 1024 - self . key_buffer_offset ) % 2 c , scan = self . keyboard . buf . ring_read ( index ) if odd : scan = value elif value in ( 0 , 0xe0 ) : c = b'' else : c = int2byte ( value ) self . keyboard . buf . ring_write ( index , c , scan )