def cmd_readw(scope, samba, args):
    """Read NUMBER words starting at ADDRESS and store the result in
    VARIABLE.  If NUMBER is equal to 1, the read value is stored
    directly in VARIABLE.  If NUMBER is greater than 1, the read
    values are stored as a list of values of length NUMBER.

    """
    varname = args[0]
    addr = args[1]
    count = args[2]
    if count < 1:
        return
    l = []
    for _ in range(count):
        val = samba.read_word(addr)
        l.append(val)
        addr += 4
    scope[varname] = l if len(l) > 1 else l[0]
