'///
'/// List 2a: storing all variables (array D) in a mapped memory segment.
'/// Execute it before loading another BASIC program.
'/// We suppose that all variables are of integer type.
'///
                                                                                
@macro LDIRSS e=usr(10)        'Memory block transfer function
                                                                                
'Segment and address where variables will be saved:
'define it as you want, I just use example values.
                                                                                
@define DATA_SEG 6
@define DATA_DIR &H100
                                                                                
'Now we save variables. We suppose that NUM_VARS is appropriately defined,
'for example with list 1.
                                                                                
~       p(0)= 255:      'BASIC memory segment number
        p(1)= varptr(d(0)):     'Address in BASIC memory of the array
        p(2)= @DATA_SEG: 'Destination for transfer
        p(3)= @DATA_DIR:
        p(4)= @NUM_VARS * 2:    'Block size: each integer var = 2 bytes
        p(5)= @NO:      'Or @YES, you set it as you want
        p(6)= @NO:      'Idem
        @LDIRSS:
                                                                                
        run "nextprog.bas"        'Now we can execute another BASIC program
