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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [ao486_tool/] [src/] [ao486/] [utils/] [HexToBin.java] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
package ao486.utils;
28
 
29
import java.io.File;
30
import java.io.FileOutputStream;
31
import java.nio.file.Files;
32
 
33
public class HexToBin {
34
 
35
    /*
36
    static int hex[] = {
37
        0xfa,0x33,0xc0,0x8e,0xd0,0xbc,0x00,0x7c,0x16,0x07,0xbb,0x78,0x00,0x36,0xc5,0x37,
38
        0x1e,0x56,0x16,0x53,0xbf,0x3e,0x7c,0xb9,0x0b,0x00,0xfc,0xf3,0xa4,0x06,0x1f,0xc6,
39
        0x45,0xfe,0x0f,0x8b,0x0e,0x18,0x7c,0x88,0x4d,0xf9,0x89,0x47,0x02,0xc7,0x07,0x3e,
40
        0x7c,0xfb,0xcd,0x13,0x72,0x79,0x33,0xc0,0x39,0x06,0x13,0x7c,0x74,0x08,0x8b,0x0e,
41
        0x13,0x7c,0x89,0x0e,0x20,0x7c,0xa0,0x10,0x7c,0xf7,0x26,0x16,0x7c,0x03,0x06,0x1c,
42
        0x7c,0x13,0x16,0x1e,0x7c,0x03,0x06,0x0e,0x7c,0x83,0xd2,0x00,0xa3,0x50,0x7c,0x89,
43
        0x16,0x52,0x7c,0xa3,0x49,0x7c,0x89,0x16,0x4b,0x7c,0xb8,0x20,0x00,0xf7,0x26,0x11,
44
        0x7c,0x8b,0x1e,0x0b,0x7c,0x03,0xc3,0x48,0xf7,0xf3,0x01,0x06,0x49,0x7c,0x83,0x16,
45
        0x4b,0x7c,0x00,0xbb,0x00,0x05,0x8b,0x16,0x52,0x7c,0xa1,0x50,0x7c,0xe8,0x92,0x00,
46
        0x72,0x1d,0xb0,0x01,0xe8,0xac,0x00,0x72,0x16,0x8b,0xfb,0xb9,0x0b,0x00,0xbe,0xe6,
47
        0x7d,0xf3,0xa6,0x75,0x0a,0x8d,0x7f,0x20,0xb9,0x0b,0x00,0xf3,0xa6,0x74,0x18,0xbe,
48
        0x9e,0x7d,0xe8,0x5f,0x00,0x33,0xc0,0xcd,0x16,0x5e,0x1f,0x8f,0x04,0x8f,0x44,0x02,
49
        0xcd,0x19,0x58,0x58,0x58,0xeb,0xe8,0x8b,0x47,0x1a,0x48,0x48,0x8a,0x1e,0x0d,0x7c,
50
        0x32,0xff,0xf7,0xe3,0x03,0x06,0x49,0x7c,0x13,0x16,0x4b,0x7c,0xbb,0x00,0x07,0xb9,
51
        0x03,0x00,0x50,0x52,0x51,0xe8,0x3a,0x00,0x72,0xd8,0xb0,0x01,0xe8,0x54,0x00,0x59,
52
        0x5a,0x58,0x72,0xbb,0x05,0x01,0x00,0x83,0xd2,0x00,0x03,0x1e,0x0b,0x7c,0xe2,0xe2,
53
        0x8a,0x2e,0x15,0x7c,0x8a,0x16,0x24,0x7c,0x8b,0x1e,0x49,0x7c,0xa1,0x4b,0x7c,0xea,
54
        0x00,0x00,0x70,0x00,0xac,0x0a,0xc0,0x74,0x29,0xb4,0x0e,0xbb,0x07,0x00,0xcd,0x10,
55
        0xeb,0xf2,0x3b,0x16,0x18,0x7c,0x73,0x19,0xf7,0x36,0x18,0x7c,0xfe,0xc2,0x88,0x16,
56
        0x4f,0x7c
57
    };
58
    */
59
 
60
    /*
61
    static int hex[] = { 0xe9, 0x35, 0x01, 0x06, 0x16 };
62
    */
63
 
64
    /*
65
    static int hex[] = {
66
        0x2e,0x89,0x1e,0x23,0x01,0x2e,0x88,0x2e,
67
        0x2f,0x01,0x2e,0x88,0x16,0x2d,0x01,0x2e,0x89,0x36,0x31,0x01,0x1e,0x2e,0x8f,0x06,
68
        0x33,0x01,0x33,0xc9,0x8e,0xd9,0x06,0x8e,0xc1,0x8b,0x36,0x78,0x00,0x8e,0x1e,0x7a,
69
        0x00,0xbf,0x22,0x05,0xb9,0x0b,0x00,0xfc,0xf3,0xa4,0x06,0x1f,0xc7,0x06,0x78,0x00,
70
        0x22,0x05,0x8c,0x1e,0x7a,0x00,0x07,0x8b,0x0e,0x0b,0x7c,0x2e,0x89,0x0e,0x1b,0x01,
71
        0x8a,0x0e,0x0d,0x7c,0x2e,0x88,0x0e,0x37,0x01,0x8b,0x0e,0x18,0x7c,0x2e,0x89,0x0e,
72
        0x2b,0x01,0x8b,0x0e,0x1a,0x7c,0x2e,0x89,0x0e,0x05,0x01,0x8b,0x0e,0x16,0x7c,0x2e,
73
        0x89,0x0e,0x15,0x01,0x8b,0x0e,0x0e,0x7c,0x2e,0x89,0x0e,0x1d,0x01,0x8b,0x0e,0x1c,
74
        0x7c,0x2e,0x89,0x0e,0x17,0x01,0x8b,0x0e,0x13,0x7c,0x2e,0x89,0x0e,0x27,0x01,0x80,
75
        0x3e,0x26,0x7c,0x29,0x75,0x1e,0x2e,0xa3,0x25,0x01,0xa1,0x1e,0x7c,0x2e,0xa3,0x19,
76
        0x01,0x83,0xf9,0x00,0x75,0x0e,0xa1,0x20,0x7c,0x2e,0xa3,0x27,0x01,0xa1,0x22,0x7c,
77
        0x2e,0xa3,0x29,0x01,0xfc,0x33,0xf6,0x8b,0xfe,0xcd,0x12,0xb1,0x06,0xd3,0xe0,0x33,
78
        0xdb,0x8e,0xdb,0x8b,0x1e,0xbc,0x00,0x8e,0x1e,0xbe,0x00,0x81,0x7f,0x03,0x52,0x50
79
    };
80
    */
81
 
82
    static int hex[] = {
83
        //0x3B, 0x55, 0x06, 0x75, 0x0D, 0x3B, 0x4D, 0x08, 0x75, 0x08, 0x3A, 0x45, 0x04 
84
        //0x2E, 0xA3, 0x9D, 0x02, 0x2E
85
        //0xCB, 0x8E, 0x06, 0xB0, 0x05, 0xB8, 0x02
86
        0xeb, 0x3c, 0x90
87
    };
88
 
89
    public static void main(String args[]) throws Exception {
90
        FileOutputStream out = new FileOutputStream("out.bin");
91
 
92
        for(int i : hex) {
93
            out.write(i);
94
        }
95
        out.close();
96
 
97
 
98
        byte bytes[] = Files.readAllBytes(new File("./../bochsDevs/interrupt.txt").toPath());
99
        String str = new String(bytes);
100
 
101
        for(int i=0; i<256; i++) {
102
            if(str.indexOf(String.format("irq %02x", i)) != -1) System.out.printf("IRQ: 0x%02x\n", i);
103
        }
104
    }
105
}

powered by: WebSVN 2.1.0

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