comparison simtool/writecmd.c @ 102:29cc5612797a

fc-simtool: update-rec command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 25 Jan 2021 02:16:16 +0000
parents 454ff8bd0b83
children 4aaf722ab933
comparison
equal deleted inserted replaced
101:454ff8bd0b83 102:29cc5612797a
21 if (rc < 0) 21 if (rc < 0)
22 return(rc); 22 return(rc);
23 len = rc; 23 len = rc;
24 return update_bin_op(offset, data, len); 24 return update_bin_op(offset, data, len);
25 } 25 }
26
27 cmd_update_rec(argc, argv)
28 char **argv;
29 {
30 unsigned recno;
31 u_char data[255];
32 int rc;
33
34 recno = strtoul(argv[1], 0, 0);
35 if (recno < 1 || recno > 255) {
36 fprintf(stderr,
37 "error: record number argument is out of range\n");
38 return(-1);
39 }
40 rc = read_hex_data_file(argv[2], data);
41 if (rc < 0)
42 return(rc);
43 if (rc != curfile_record_len) {
44 fprintf(stderr, "error: hex data length != EF record length\n");
45 return(-1);
46 }
47 return update_rec_op(recno, 0x04, data, curfile_record_len);
48 }