if (options.filename != NULL) {
rc = hexfile_load(options.filename);
if (!rc)
- exit(1);
+ exit(EXIT_FAILURE);
}
console_reset();
} else {
menu_display_usage();
console_show_registers();
- yyparse();
+ (void) yyparse();
}
- return 0;
+ exit(EXIT_SUCCESS);
}
if ((int) strlen(line) > max_len) {
printf("input line too long");
+ free(line);
return YY_NULL;
}
log_info("Program executing...");
- cpu8051_run(num, kbhit);
+ (void) cpu8051_run(num, kbhit);
if (kbhit()) {
(void) getch(); /* Flush key */
void
console_trace(void)
{
- cpu8051_exec();
+ (void) cpu8051_exec();
console_show_registers();
disassemble_num(cpu8051.pc, 1);
}
log_prefix_package_name(stream, "debug");
va_start(ap, format);
- vfprintf(stream, format, ap);
+ (void) vfprintf(stream, format, ap);
va_end(ap);
log_suffix_newline(stream);
log_prefix_package_name(stream, "info");
va_start(ap, format);
- vfprintf(stream, format, ap);
+ (void) vfprintf(stream, format, ap);
va_end(ap);
log_suffix_newline(stream);
log_prefix_package_name(stream, "warn");
va_start(ap, format);
- vfprintf(stream, format, ap);
+ (void) vfprintf(stream, format, ap);
va_end(ap);
log_suffix_newline(stream);
log_prefix_package_name(stream, "error");
va_start(ap, format);
- vfprintf(stream, format, ap);
+ (void) vfprintf(stream, format, ap);
va_end(ap);
log_suffix_newline(stream);
log_prefix_package_name(stream, "error");
va_start(ap, format);
- vfprintf(stream, format, ap);
+ (void) vfprintf(stream, format, ap);
va_end(ap);
log_suffix_newline(stream);
m = &mem_infos[k];
if (m->size > m->max_size) {
- log_err("Memory size invalid (max = %d)", m->max_size);
- exit(1);
+ log_fail("Memory size invalid (max = %d)", m->max_size);
}
m->buf = malloc(m->size);
if (m->buf == NULL) {
- log_err("%s", strerror(errno));
- exit(1);
+ log_fail("%s", strerror(errno));
}
memset(m->buf, 0x00, m->size);
return;
for (offset = 0; offset < size; offset += 16) {
- unsigned char data[16];
+ uint8_t data[16];
printf("%.4X ", address + offset);
for (col = 0; col < 16; col++) {
data[col] = mem_read8(id, address + offset + col);
- printf(" %.2X", (int) data[col]);
+ printf(" %.2X", data[col]);
}
printf(" ");
for (col = 0; col < 16; col++) {
if ((int) data[col] >= 32 &&
(int) data[col] <= 126)
- printf("%c", data[col]);
+ printf("%c", (char) data[col]);
else
printf(".");
}
# include "config.h"
#endif
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <argp.h>
char *endptr;
int log_level;
- log_level = strtol(arg, &endptr, 0);
+ log_level = (int) strtol(arg, &endptr, 0);
if (*endptr != '\0') {
log_err("Invalid log level");
else if (memid == EXT_MEM_ID)
dest = &options.xram_size;
else
- exit(1); /* Programming error. */
+ exit(EXIT_FAILURE); /* Programming error. */
/*
* Sizes versus max memory sizes will be checked when calling
* memory_init().
*/
- *dest = strtol(arg, &endptr, 0);
+ *dest = (int) strtol(arg, &endptr, 0);
if (*endptr != '\0') {
log_err("Invalid memory size");
{
char *endptr;
- *dest = strtol(arg, &endptr, 0);
+ *dest = (uint16_t) strtol(arg, &endptr, 0);
if (*endptr != '\0') {
log_err("Invalid address");
void
parse_command_line_options(int argc, char *argv[])
{
+ error_t rc;
+
/* Setting default values. */
options.filename = NULL;
options.pram_size = PGM_MEM_DEFAULT_SIZE;
options.stop_address = 0; /* 0 means stop address is disabled. */
/* Parse our arguments. */
- argp_parse(&argp, argc, argv, 0, 0, NULL);
+ rc = argp_parse(&argp, argc, argv, 0, 0, NULL);
+ if (rc != 0)
+ log_fail("Failure to parse command line arguments");
}
/* Returns 0 or 1 */
int
-psw_read_bit(int bit)
+psw_read_bit(unsigned int bit)
{
return (mem_read8(INT_MEM_ID, _PSW_) >> bit) & 0x01;
}
void
-psw_write_bit(int bit, int val)
+psw_write_bit(unsigned int bit, int val)
{
uint8_t psw = mem_read8(INT_MEM_ID, _PSW_);
#define PSW_H 1
int
-psw_read_bit(int bit);
+psw_read_bit(unsigned int bit);
void
-psw_write_bit(int bit, int val);
+psw_write_bit(unsigned int bit, int val);
int
psw_read_cy(void);