MegaProcessor

Check-in [5479a8adb6]
Login

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

Overview
Comment:Implemented translation of the BCHG,BCLR,BSET,BTST instructions. Todo, have '#' mode accept symbols besides of decimals.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5479a8adb68319634130cffd68140a09902ef739
User & Date: jos 2015-09-24 17:08:30
Context
2015-09-25
13:00
Implemented all 8 '.WT' shift/rotate instructions. check-in: 7b9445a7e9 user: jos tags: trunk
2015-09-24
17:08
Implemented translation of the BCHG,BCLR,BSET,BTST instructions. Todo, have '#' mode accept symbols besides of decimals. check-in: 5479a8adb6 user: jos tags: trunk
2015-09-22
14:48
Making instructions ld.[bw] and st.[bw] do the right thing. check-in: d58b8e25e9 user: jos tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to opcodes.lua.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
63
64
65
66
67
68
69

70
71





72
73
74
75

76
77





78
79
80
81

82
83





84
85
86
87
88
89
90
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
        Error("This instruction is for PS only");
    end
    return 0xf4, 0x00 ;
end

function do_ASL(f1, f2, f3)
    local b1,b2 = 0xdc, 0x40;
    -- process f2 to select 0x40..0x4f, 0x50..0x5f, 0x60..0x63
    return b1, b2 ;
end

function do_ASL_WT(f1, f2, f3)
    local b1,b2 = 0x68, 0x00;
    return b1, b2 ;
end
................................................................................
end

function do_BCC(f1, f2, f3)
    return 0xe4, 0x00 ;
end

function do_BCHG(f1, f2, f3)

    local b1 = 0xdc; -- evaluate f3 (R0..R3) to select dc..df
    local b2 = 0x40; -- evaluate f2 to select 40..4f 60..63





    return b1, b2;
end

function do_BCLR(f1, f2, f3)

    local b1 = 0xdc; -- evaluate f3 (R0..R3) to select dc..df
    local b2 = 0x80; -- evaluate f2 to select 80..8f a0..a3





    return b1, b2;
end

function do_BTST(f1, f2, f3)

    local b1 = 0xdc; -- evaluate f3 (R0..R3) to select dc..df
    local b2 = 0x00; -- evaluate f2 to select 00..4f 60..63





    return b1, b2;
end

function do_BCS(f1, f2, f3)
    return 0xe5, 0x00;
end

................................................................................
end

function do_BPL(f1, f2, f3)
    return 0xea, 0x00  ;
end

function do_BSET(f1, f2, f3)
    local b1 = 0xdc; -- evaluate f3 (R0..R3) to select dc..df
    local b2 = 0xc0; -- evaluate f2 to select c0..cf e0..e3
    return b1, b2;
end

function do_BTST(f1, f2, f3)
    local b1 = 0xdc; -- evaluate f3 (R0..R3) to select dc..df
    local b2 = 0x00; -- evaluate f2 to select 00..0f 20..23
    return b1, b2;
end

function do_BUC(f1, f2, f3)
    return 0xe0, 0x00  ;
end

................................................................................

function do_ROR(f1, f2, f3)
    local b1,b2 = 0xb0, 0x00;
    return b1, b2 ;
end

function do_ROR_WT(f1, f2, f3)
    return 0xff ;
end

function do_ROXL(f1, f2, f3)
    return 0xff ;
end

function do_ROXL_WT(f1, f2, f3)
    return 0xff ;
end

function do_ROXR(f1, f2, f3)
    return 0xff ;
end

function do_ROXR_WT(f1, f2, f3)
    return 0xff ;
end

function do_SQRT(f1, f2, f3)
    return 0xf7  ;
end

function do_ST_B(f1, f2, f3)







|







 







>
|
|
>
>
>
>
>




>
|
|
>
>
>
>
>




>
|
|
>
>
>
>
>







 







|
|
|
|
|
|
|
|







 







|



|



|



|



|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
        Error("This instruction is for PS only");
    end
    return 0xf4, 0x00 ;
end

function do_ASL(f1, f2, f3)
    local b1,b2 = 0xdc, 0x40;
    -- process f3 to select 0x40..0x4f, 0x50..0x5f, 0x60..0x63
    return b1, b2 ;
end

function do_ASL_WT(f1, f2, f3)
    local b1,b2 = 0x68, 0x00;
    return b1, b2 ;
end
................................................................................
end

function do_BCC(f1, f2, f3)
    return 0xe4, 0x00 ;
end

function do_BCHG(f1, f2, f3)
    local reg = isReg(f2);
    local b1 = 0xdc + reg; -- evaluate f2 (R0..R3) to select dc..df
    local b2 = 0x40; -- evaluate f3 to select 40..4f 60..63
    if( f3:sub(1,1) == "#" ) then 
        b2 = 0x40 + tonumber(f3:sub(2,-1)); -- TODO: allow other things than decimals here.
    else
        b2 = 0x60 + isReg(f3);
    end
    return b1, b2;
end

function do_BCLR(f1, f2, f3)
    local reg = isReg(f2);
    local b1 = 0xdc + reg; -- evaluate f2 (R0..R3) to select dc..df
    local b2 = 0x80; -- evaluate f3 to select 80..8f a0..a3
    if( f3:sub(1,1) == "#" ) then 
        b2 = 0x80 + tonumber(f3:sub(2,-1)); -- TODO: allow other things than decimals here.
    else
        b2 = 0xa0 + isReg(f3);
    end
    return b1, b2;
end

function do_BTST(f1, f2, f3)
    local reg = isReg(f2);
    local b1 = 0xdc + reg; -- evaluate f2 (R0..R3) to select dc..df
    local b2 = 0x00; -- evaluate f3 to select 00..0f 20..23
    if( f3:sub(1,1) == "#" ) then 
        b2 = tonumber(f3:sub(2,-1)); -- TODO: allow other things than decimals here.
    else
        b2 = 0x20 + isReg(f3);
    end
    return b1, b2;
end

function do_BCS(f1, f2, f3)
    return 0xe5, 0x00;
end

................................................................................
end

function do_BPL(f1, f2, f3)
    return 0xea, 0x00  ;
end

function do_BSET(f1, f2, f3)
    local reg = isReg(f2);
    local b1 = 0xdc + reg; -- evaluate f2 (R0..R3) to select dc..df
    local b2 = 0xc0; -- evaluate f3 to select c0..cf e0..e3
    if( f3:sub(1,1) == "#" ) then 
        b2 = 0xc0 + tonumber(f3:sub(2,-1)); -- TODO: allow other things than decimals here.
    else
        b2 = 0xe0 + isReg(f3);
    end
    return b1, b2;
end

function do_BUC(f1, f2, f3)
    return 0xe0, 0x00  ;
end

................................................................................

function do_ROR(f1, f2, f3)
    local b1,b2 = 0xb0, 0x00;
    return b1, b2 ;
end

function do_ROR_WT(f1, f2, f3)
    return 0xff, 0x00 ;
end

function do_ROXL(f1, f2, f3)
    return 0xff, 0x01 ;
end

function do_ROXL_WT(f1, f2, f3)
    return 0xff, 0x03 ;
end

function do_ROXR(f1, f2, f3)
    return 0xff, 0x04 ;
end

function do_ROXR_WT(f1, f2, f3)
    return 0xff, 0x05 ;
end

function do_SQRT(f1, f2, f3)
    return 0xf7  ;
end

function do_ST_B(f1, f2, f3)