from micropython import const
from machine import mem32
import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
SIO_BASE = const(0xd0000000)
INTERP0_ACCUM0 = const(SIO_BASE + 0x080) # Read/write access to accumulator 0
INTERP0_ACCUM1 = const(SIO_BASE + 0x084) # Read/write access to accumulator 1
INTERP0_BASE0 = const(SIO_BASE + 0x088) # Read/write access to BASE0 register.
INTERP0_BASE1 = const(SIO_BASE + 0x08c) # Read/write access to BASE1 register.
INTERP0_CTRL_LANE0 = const(SIO_BASE + 0x0ac) # Control register for lane 0
INTERP0_CTRL_LANE1 = const(SIO_BASE + 0x0b0) # Control register for lane 1
INTERP0_PEEK_LANE0 = const(SIO_BASE + 0x0a0) # Read LANE0 result, without altering any internal state (PEEK).
INTERP0_PEEK_LANE1 = const(SIO_BASE + 0x0a4) # Read LANE1 result, without altering any internal state (PEEK).
mem32[INTERP0_CTRL_LANE0] = 0x00207c00 # Set Blend bit, Mask = full width
mem32[INTERP0_CTRL_LANE1] = 0x0000fc00 # Set Signed bit, Mask = full width
mem32[INTERP0_BASE0] = -1000
mem32[INTERP0_BASE1] = -2000
mem32[INTERP0_ACCUM1] = 0
print(mem32[INTERP0_PEEK_LANE1])
mem32[INTERP0_ACCUM1] = 128
print(mem32[INTERP0_PEEK_LANE1])
mem32[INTERP0_ACCUM1] = 255
print(mem32[INTERP0_PEEK_LANE1])