diff simtool/writecmd.c @ 109:4aaf722ab933

fc-simtool: update-bin-imm command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Jan 2021 01:27:58 +0000
parents 29cc5612797a
children 54e33e9238b6
line wrap: on
line diff
--- a/simtool/writecmd.c	Tue Jan 26 00:51:59 2021 +0000
+++ b/simtool/writecmd.c	Tue Jan 26 01:27:58 2021 +0000
@@ -24,6 +24,25 @@
 	return update_bin_op(offset, data, len);
 }
 
+cmd_update_bin_imm(argc, argv)
+	char **argv;
+{
+	unsigned offset, len;
+	u_char data[255];
+	int rc;
+
+	offset = strtoul(argv[1], 0, 0);
+	if (offset > 0xFFFF) {
+		fprintf(stderr, "error: offset argument is out of range\n");
+		return(-1);
+	}
+	rc = decode_hex_data_from_string(argv[2], data);
+	if (rc < 0)
+		return(rc);
+	len = rc;
+	return update_bin_op(offset, data, len);
+}
+
 cmd_update_rec(argc, argv)
 	char **argv;
 {