#!/bin/sh
#
# Convert binary file to format used by OSI Monitor Load command.

# Default start address
start=FE00

# Default load (go) address
load=FE00

OPTIND=1         # Reset in case getopts has been used previously in the shell.

while getopts s:l: o
do  case "$o" in
    s)	start="$OPTARG";;
    l)	load="$OPTARG";;
    [?])	echo >&2 "Usage: $0 [-s <start address>] [-l <load address>] <filename>"
        exit 1;;
    esac
done
shift $((OPTIND-1))

echo -n ".${start}/"
hexdump -v -e '/1 "%02X\r"' $1
echo ".${load}G\r"
