comparison 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
comparison
equal deleted inserted replaced
108:6f80cfdc7e05 109:4aaf722ab933
16 if (offset > 0xFFFF) { 16 if (offset > 0xFFFF) {
17 fprintf(stderr, "error: offset argument is out of range\n"); 17 fprintf(stderr, "error: offset argument is out of range\n");
18 return(-1); 18 return(-1);
19 } 19 }
20 rc = read_hex_data_file(argv[2], data); 20 rc = read_hex_data_file(argv[2], data);
21 if (rc < 0)
22 return(rc);
23 len = rc;
24 return update_bin_op(offset, data, len);
25 }
26
27 cmd_update_bin_imm(argc, argv)
28 char **argv;
29 {
30 unsigned offset, len;
31 u_char data[255];
32 int rc;
33
34 offset = strtoul(argv[1], 0, 0);
35 if (offset > 0xFFFF) {
36 fprintf(stderr, "error: offset argument is out of range\n");
37 return(-1);
38 }
39 rc = decode_hex_data_from_string(argv[2], data);
21 if (rc < 0) 40 if (rc < 0)
22 return(rc); 41 return(rc);
23 len = rc; 42 len = rc;
24 return update_bin_op(offset, data, len); 43 return update_bin_op(offset, data, len);
25 } 44 }