changeset 204:a462012c9e67

fc-simtool: update-rec-fill command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Mar 2021 04:48:37 +0000
parents 647267e39c21
children fc82f0464480
files simtool/dispatch.c simtool/writecmd.c
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Sun Mar 07 04:11:28 2021 +0000
+++ b/simtool/dispatch.c	Sun Mar 07 04:48:37 2021 +0000
@@ -92,6 +92,7 @@
 extern int cmd_update_bin();
 extern int cmd_update_bin_imm();
 extern int cmd_update_rec();
+extern int cmd_update_rec_fill();
 extern int cmd_update_rec_imm();
 extern int cmd_user_sum();
 extern int cmd_verify_chv();
@@ -220,6 +221,7 @@
 	{"update-bin", 2, 2, 0, cmd_update_bin},
 	{"update-bin-imm", 2, 2, 0, cmd_update_bin_imm},
 	{"update-rec", 2, 2, 0, cmd_update_rec},
+	{"update-rec-fill", 2, 2, 0, cmd_update_rec_fill},
 	{"update-rec-imm", 2, 2, 0, cmd_update_rec_imm},
 	{"user-sum", 0, 0, 1, cmd_user_sum},
 	{"verify-chv1", 1, 1, 0, cmd_verify_chv},
--- a/simtool/writecmd.c	Sun Mar 07 04:11:28 2021 +0000
+++ b/simtool/writecmd.c	Sun Mar 07 04:48:37 2021 +0000
@@ -100,3 +100,30 @@
 	}
 	return update_rec_op(recno, mode, data, curfile_record_len);
 }
+
+cmd_update_rec_fill(argc, argv)
+	char **argv;
+{
+	unsigned recno, mode, fill_byte;
+	u_char data[255];
+
+	if (!strcmp(argv[1], "prev")) {
+		recno = 0;
+		mode = 0x03;
+	} else {
+		recno = strtoul(argv[1], 0, 0);
+		if (recno < 1 || recno > 255) {
+			fprintf(stderr,
+			"error: record number argument is out of range\n");
+			return(-1);
+		}
+		mode = 0x04;
+	}
+	fill_byte = strtoul(argv[2], 0, 0);
+	if (fill_byte > 0xFF) {
+		fprintf(stderr, "error: invalid fill byte argument\n");
+		return(-1);
+	}
+	memset(data, fill_byte, curfile_record_len);
+	return update_rec_op(recno, mode, data, curfile_record_len);
+}