MegaProcessor

Check-in [65f2d4419c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Moved the generator-script dis_d8_db to 'tools', added functionality to skip printing the redundant instructions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:65f2d4419c55e498adf33d5129424298d8d44a98
User & Date: jos 2015-08-14 14:16:34
Context
2015-08-14
21:22
First stab at processing of lables and symbols. check-in: 3e524fe20d user: jos tags: trunk
14:16
Moved the generator-script dis_d8_db to 'tools', added functionality to skip printing the redundant instructions. check-in: 65f2d4419c user: jos tags: trunk
11:29
Prettyfied the format of the List-file output. check-in: 6aee36cd9f user: jos tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Name change from dis_d8_db.lua to tools/dis_d8_db.lua.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
..
94
95
96
97
98
99
100
101



102
103
104

105


















106
107
108
109
110




111
112

"ROXL   Rd, R",    -- 0xe0..0xe3  :   0xe4..0xe7  :   "-- redundant"
"ROXL.WT Rd, R",   -- 0xe8..0xeb  :    0xec..0xef  :   "-- redundant"
"ROXR   Rd, R",   -- 0xf0..0xf3  : 0xf4..0xf7  :   "-- redundant"
"ROXR.WT Rd, R"    -- 0xf8..0xfb  :    0xfc..0xff  :   "-- redundant"
};

function dis_d8_db( instr, postb)
        Printf( "%02x %02x .. : ", instr, postb );
        
        if( instr >= 0xd8 and instr <= 0xdb ) then
            local dst = bit32.band( instr, 0x03 );
            local src = bit32.rshift(postb,3);
            local result = I_d8_db[src]:gsub("d",tostring(dst),1);
            local lastChar = result:sub(-1);
            if( lastChar == 'R' ) then result = result .. tostring( bit32.band( postb,0x03) ) end;
            if( lastChar == '#' ) then result = result .. tostring( bit32.band( postb,0x0f) ) end; 
            if( lastChar == '-' ) then result = result .. tostring( 16-bit32.band( postb,0x0f) ) end; 
            
            print( result );
        end--if
end

local I_dc_df = { [0] = 
"BTST  Rd, #",
"BTST  Rd, R",
"BCHG  Rd, #",
................................................................................
"BCLR  Rd, #",
"BCLR  Rd, R",
"BSET  Rd, #",
"BSET  Rd, R"
};

function dis_dc_df( instr, postb)
        Printf( "%02x %02x .. : ", instr, postb );
        if( instr >= 0xdc and instr <= 0xdf ) then
                local dst = bit32.band(instr, 0x03);
                local src = bit32.rshift(postb,5);
                -- printf( "%02x %02x", dst, src );
                local result = I_dc_df[src]:gsub("d",tostring(dst),1);
                local lastchar = result:sub(-1);
                if( lastchar == '#' ) then result = result .. tostring( bit32.band(postb,0x0f) ) end;
                if( lastchar == 'R' ) then result = result .. tostring( bit32.band(postb,0x03) ) end;
                print( result );
        end
end

-- Main line
--[[
instr = arg[1];
postb = arg[2];
................................................................................
      and postb and postb:match('%x%x'),
      "Please supply 2 hex-format bytevalues");


dis_d8_db( htob_2(instr), htob_2(postb) );
--]]
--




for instr = 0xd8,0xdb do
        for postb = 0x00,0xff do
                dis_d8_db(instr,postb);

        end


















end

for instr = 0xdc,0xdf do
        for postb = 0x00,0xff do
                dis_dc_df(instr,postb);




        end
end








<
<





|
|

<
|







 







<



<




|







 








>
>
>

|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|
|
>
>
>
>
|

>
41
42
43
44
45
46
47


48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
..
65
66
67
68
69
70
71

72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
"ROXL   Rd, R",    -- 0xe0..0xe3  :   0xe4..0xe7  :   "-- redundant"
"ROXL.WT Rd, R",   -- 0xe8..0xeb  :    0xec..0xef  :   "-- redundant"
"ROXR   Rd, R",   -- 0xf0..0xf3  : 0xf4..0xf7  :   "-- redundant"
"ROXR.WT Rd, R"    -- 0xf8..0xfb  :    0xfc..0xff  :   "-- redundant"
};

function dis_d8_db( instr, postb)


        if( instr >= 0xd8 and instr <= 0xdb ) then
            local dst = bit32.band( instr, 0x03 );
            local src = bit32.rshift(postb,3);
            local result = I_d8_db[src]:gsub("d",tostring(dst),1);
            local lastChar = result:sub(-1);
            if( lastChar == '#' ) then result = result .. tostring( bit32.band( postb,0x0f) ) end; 
            if( lastChar == 'R' ) then result = result .. tostring( bit32.band( postb,0x03) ) end;
            if( lastChar == '-' ) then result = result .. tostring( 16-bit32.band( postb,0x0f) ) end; 

            return( result );
        end--if
end

local I_dc_df = { [0] = 
"BTST  Rd, #",
"BTST  Rd, R",
"BCHG  Rd, #",
................................................................................
"BCLR  Rd, #",
"BCLR  Rd, R",
"BSET  Rd, #",
"BSET  Rd, R"
};

function dis_dc_df( instr, postb)

        if( instr >= 0xdc and instr <= 0xdf ) then
                local dst = bit32.band(instr, 0x03);
                local src = bit32.rshift(postb,5);

                local result = I_dc_df[src]:gsub("d",tostring(dst),1);
                local lastchar = result:sub(-1);
                if( lastchar == '#' ) then result = result .. tostring( bit32.band(postb,0x0f) ) end;
                if( lastchar == 'R' ) then result = result .. tostring( bit32.band(postb,0x03) ) end;
                return( result );
        end
end

-- Main line
--[[
instr = arg[1];
postb = arg[2];
................................................................................
      and postb and postb:match('%x%x'),
      "Please supply 2 hex-format bytevalues");


dis_d8_db( htob_2(instr), htob_2(postb) );
--]]
--

local Txt = {} -- To be indexed by fully disassembled strings.


for instr = 0xd8,0xdb do
    for postb = 0x00,0xff do
        t = dis_d8_db(instr,postb);
        Txt[t] = (Txt[t] or 0);
    end
end

for instr = 0xdc,0xdf do
    for postb = 0x00,0xff do
        t = dis_dc_df(instr,postb);
        Txt[t] = (Txt[t] or 0);
    end
end


for instr = 0xd8,0xdb do
    for postb = 0x00,0xff do
        local t = dis_d8_db(instr,postb);
        if( Txt[t] == 0 ) then
            Printf( "%02x %02x .. : %s\n", instr, postb, t );
            Txt[t] = 1;
        end--if
    end
end

for instr = 0xdc,0xdf do
    for postb = 0x00,0xff do
        local t = dis_dc_df(instr,postb);
        if( Txt[t] == 0 ) then
            Printf( "%02x %02x .. : %s\n", instr, postb, t );
            Txt[t] = 1;
        end--if
    end
end
--]]