1*c7b36669SIngo Weinhold /* 2*c7b36669SIngo Weinhold ** Copyright 2001, Travis Geiselbrecht. All rights reserved. 3*c7b36669SIngo Weinhold ** Distributed under the terms of the NewOS License. 4*c7b36669SIngo Weinhold */ 5*c7b36669SIngo Weinhold #include <stdio.h> 6*c7b36669SIngo Weinhold #include <stdlib.h> 7*c7b36669SIngo Weinhold 8*c7b36669SIngo Weinhold #define NUM_COLUMNS 16 9*c7b36669SIngo Weinhold main(int argc,char ** argv)10*c7b36669SIngo Weinholdint main(int argc, char **argv) 11*c7b36669SIngo Weinhold { 12*c7b36669SIngo Weinhold FILE *infp = stdin; 13*c7b36669SIngo Weinhold char c; 14*c7b36669SIngo Weinhold int column = 0; 15*c7b36669SIngo Weinhold int start = 1; 16*c7b36669SIngo Weinhold 17*c7b36669SIngo Weinhold while(!feof(infp)) { 18*c7b36669SIngo Weinhold int err; 19*c7b36669SIngo Weinhold err = fread(&c, sizeof(c), 1, infp); 20*c7b36669SIngo Weinhold if(err != 1) 21*c7b36669SIngo Weinhold break; 22*c7b36669SIngo Weinhold 23*c7b36669SIngo Weinhold if((column % NUM_COLUMNS) == 0) { 24*c7b36669SIngo Weinhold if(!start) { 25*c7b36669SIngo Weinhold printf("\n"); 26*c7b36669SIngo Weinhold } else { 27*c7b36669SIngo Weinhold start = 0; 28*c7b36669SIngo Weinhold } 29*c7b36669SIngo Weinhold printf(".byte\t"); 30*c7b36669SIngo Weinhold } else { 31*c7b36669SIngo Weinhold printf(","); 32*c7b36669SIngo Weinhold } 33*c7b36669SIngo Weinhold 34*c7b36669SIngo Weinhold printf("0x%02x", ((int)c) & 0xff); 35*c7b36669SIngo Weinhold 36*c7b36669SIngo Weinhold column++; 37*c7b36669SIngo Weinhold } 38*c7b36669SIngo Weinhold printf("\n"); 39*c7b36669SIngo Weinhold 40*c7b36669SIngo Weinhold return 0; 41*c7b36669SIngo Weinhold } 42*c7b36669SIngo Weinhold 43