MegaProcessor

Check-in [260a245f88]
Login

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

Overview
Comment:Completed instructions LD.B LD.W ST.B and ST.W
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:260a245f884609b5593a77fcfc91f5a96f4e6b57
User & Date: jos 2015-10-22 09:17:11
Context
2015-10-22
12:28
Make the stack+offset instructions accept '+' as well as ',' check-in: 1a38e93721 user: jos tags: trunk
09:17
Completed instructions LD.B LD.W ST.B and ST.W check-in: 260a245f88 user: jos tags: trunk
2015-10-12
18:00
Implemented LSL,ASL,ROL,ROXL instructions. (xxR variants are still open) check-in: 6036736179 user: jos tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to opcodes.lua.

240
241
242
243
244
245
246



247

248
249
250
251
252
253
254
...
270
271
272
273
274
275
276



277

278
279
280
281
282
283
284
...
443
444
445
446
447
448
449




450
451
452
453
454
455
456
457
...
464
465
466
467
468
469
470
471
472




473
474
475
476
477
478
479
480
481
            local dst = Eval_as_byte(f3:sub(2,-1))
            return 0xd4 + ourNr, table.unpack(dst) ;
        else 
            local dst = Eval_as_word(f3);
            return 0xb4 + ourNr, table.unpack(dst) ;
        end;
    else



        if( stack ) then return 0xa4 + ourNr, 0x00; end;

        local ourNr2 = tonumber( f3:match("[23]") );
        if( ourNr2 == nil ) then
            Error(": Operand must be R2 or R3", 0 );
        end
        if( autoinc ) then return 0x94 + (ourNr + 2*(ourNr2-2)) ;
        else 
            return 0x84 + (ourNr + 2*(ourNr2-2)) ;
................................................................................
            local dst = Eval_as_word(f3:sub(2,-1))
            return 0xd0 + ourNr, table.unpack(dst) ;
        else
            local dst = Eval_as_word(f3);
            return 0xb0 + ourNr, table.unpack(dst) ;
        end;
    else



        if( stack ) then return 0xa0 + ourNr, 0x00; end;

        local ourNr2 = tonumber( f3:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x90 + (ourNr + 2*(ourNr2-2)) ;
        else 
            return 0x80 + (ourNr + 2*(ourNr2-2)) ;
................................................................................

    local ourNr = isReg(f3);

    if( not ind_dst ) then
        local dst = Eval_as_word(f2);
        return 0xbc + ourNr, table.unpack(dst) ;  -- ST.B 0xWWWW,Rx ;
    else




        if( stack ) then return 0xac + ourNr, 0x00; end;  -- ST.B (SP,0xVV),Rx ;

        local ourNr2 = tonumber( f2:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x9c + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb++),Rx ;
        else 
................................................................................
    local ind_dst = (f2:match('%b()')~=nil);
    local autoinc = (ind_dst and (f2:match('++')~=nil) );
    local stack = f2:match("[sS][pP]");

    local ourNr = isReg(f3);

    if( not ind_dst ) then
        return 0xb8 + ourNr, 0x00, 0x00;  -- ST.B 0xWWWW,Rx ;
    else




        if( stack ) then return 0xa8 + ourNr, 0x00; end;  -- ST.B (SP,0xVV),Rx ;

        local ourNr2 = tonumber( f2:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x98 + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb++),Rx ;
        else 
            return 0x88 + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb),Rx







>
>
>
|
>







 







>
>
>
|
>







 







>
>
>
>
|







 







|

>
>
>
>
|
<







240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
...
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
...
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
...
476
477
478
479
480
481
482
483
484
485
486
487
488
489

490
491
492
493
494
495
496
            local dst = Eval_as_byte(f3:sub(2,-1))
            return 0xd4 + ourNr, table.unpack(dst) ;
        else 
            local dst = Eval_as_word(f3);
            return 0xb4 + ourNr, table.unpack(dst) ;
        end;
    else
        if( stack ) then 
            local dst = f3:match(',(%S+)%)');
            local b2 = table.unpack( Eval_as_byte(dst) );
            return 0xa4 + ourNr, b2; 
        end--if(stack);
        local ourNr2 = tonumber( f3:match("[23]") );
        if( ourNr2 == nil ) then
            Error(": Operand must be R2 or R3", 0 );
        end
        if( autoinc ) then return 0x94 + (ourNr + 2*(ourNr2-2)) ;
        else 
            return 0x84 + (ourNr + 2*(ourNr2-2)) ;
................................................................................
            local dst = Eval_as_word(f3:sub(2,-1))
            return 0xd0 + ourNr, table.unpack(dst) ;
        else
            local dst = Eval_as_word(f3);
            return 0xb0 + ourNr, table.unpack(dst) ;
        end;
    else
        if( stack ) then 
            local dst = f3:match(',(%S+)%)');
            local b2 = table.unpack( Eval_as_byte(dst) );
            return 0xa0 + ourNr, b2; 
        end--stack;
        local ourNr2 = tonumber( f3:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x90 + (ourNr + 2*(ourNr2-2)) ;
        else 
            return 0x80 + (ourNr + 2*(ourNr2-2)) ;
................................................................................

    local ourNr = isReg(f3);

    if( not ind_dst ) then
        local dst = Eval_as_word(f2);
        return 0xbc + ourNr, table.unpack(dst) ;  -- ST.B 0xWWWW,Rx ;
    else
        if( stack ) then 
            local dst = f2:match(',(%S+)%)');
            local b2 = table.unpack( Eval_as_byte(dst) );
            return 0xac + ourNr, b2; 
        end;  -- ST.B (SP,0xVV),Rx ;

        local ourNr2 = tonumber( f2:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x9c + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb++),Rx ;
        else 
................................................................................
    local ind_dst = (f2:match('%b()')~=nil);
    local autoinc = (ind_dst and (f2:match('++')~=nil) );
    local stack = f2:match("[sS][pP]");

    local ourNr = isReg(f3);

    if( not ind_dst ) then
        return 0xb8 + ourNr, table.unpack( Eval_as_word(f2) );
    else
        if( stack ) then 
            local dst = f2:match(',(%S+)%)');
            local b2 = table.unpack( Eval_as_byte(dst) );
            return 0xa8 + ourNr, b2; 
        end;  -- ST.B (SP,0xVV),Rx ;

        local ourNr2 = tonumber( f2:match("[23]") );
        if( ourNr2 == nil ) then
            Error("Operand must be R2 or R3");
        end
        if( autoinc ) then return 0x98 + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb++),Rx ;
        else 
            return 0x88 + (ourNr + 2*(ourNr2-2)) ;  -- ST.B (Rb),Rx