OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zdump.cpp] - Diff between revs 12 and 52

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 12 Rev 52
Line 33... Line 33...
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
 
#include <ctype.h>
 
 
#include "zopcodes.h"
#include "zopcodes.h"
 
 
void    dump_file(const char *fn) {
void    dump_file(const char *fn) {
        const   int     NZIP = 4096;
        const   int     NZIP = 4096;
Line 52... Line 53...
        printf("%s:\n", fn);
        printf("%s:\n", fn);
        while((nr=fread(ibuf, sizeof(ZIPI), NZIP, fp))>0) {
        while((nr=fread(ibuf, sizeof(ZIPI), NZIP, fp))>0) {
                for(int i=0; i<nr; i++) {
                for(int i=0; i<nr; i++) {
                        zipi_to_string(ibuf[i], ln);
                        zipi_to_string(ibuf[i], ln);
                        // printf("%s\n", ln);
                        // printf("%s\n", ln);
                        printf("%08x: (0x%08x) %s\n", addr++, ibuf[i], ln);
                        printf("%08x: (0x%08x %c%c%c%c) %s\n", addr++,
 
                                ibuf[i],
 
                                isgraph((ibuf[i]>>24)&0x0ff)?((ibuf[i]>>24)&0x0ff) : '.',
 
                                isgraph((ibuf[i]>>16)&0x0ff)?((ibuf[i]>>16)&0x0ff) : '.',
 
                                isgraph((ibuf[i]>> 8)&0x0ff)?((ibuf[i]>> 8)&0x0ff) : '.',
 
                                isgraph((ibuf[i]    )&0x0ff)?((ibuf[i]    )&0x0ff) : '.',
 
                                ln);
                }
                }
        } fclose(fp);
        } fclose(fp);
}
}
 
 
int main(int argc, char **argv) {
int main(int argc, char **argv) {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.