This is where the BIN Hackers and definition junkies discuss the inner workings of the EEC code and hardware. General tuning questions do not go here. Only technical/hardware-specific/code questions and discussions belong here.

Moderators: EDS50, cgrey8, 2Shaker, Jon 94GT

Post Reply
jsa
Tuning Addict
Posts: 1289
Joined: Sat Nov 23, 2013 7:28 pm
Location: 'straya

SCALL inner workings

Post by jsa » Sat Oct 31, 2015 2:45 am

sailorbob wrote:

Code: Select all

3654: 28,3f           scall 3695
MCS-96 docs say
* the operand can have a value from -1024 to +1023 (-1024 to 0 to 1023 is 2048 values)
* the operand is 1 byte long
* SCALL can have the opcode 0x28 through to 0x2F

8 bits to a byte.
Now 2^8 is 256 values or a range from 0-255, which falls short of 2048 values.

2^11 is 2048 values.

So the opcode is the key to providing the full range of 2048 values. The last 3 bits of the opcode combined with the 8 bits of the operand give the required 11 bits for the signed address range.

Code: Select all

                                     Last 3 bits of                
                                         Opcode and                  
Opcode   Operand    Opcode   Operand     Operand as                    Value   Value in
in Hex    in Hex in Binary in Binary Word in Binary   Pad to 16 Bits  in Hex    Decimal
    28        3F  00101000  00111111   00000111111  0000000000111111      3F         63
    29        3F  00101001  00111111   00100111111  0000000100111111     13F        319
    2A        3F  00101010  00111111   01000111111  0000001000111111     23F        575
    2B        3F  00101011  00111111   01100111111  0000001100111111     33F        831
    2B        FF  00101011  11111111   01111111111  0000001111111111     3FF       1023
    2C        00  00101100  00000000   10000000000  1111110000000000    FC00      -1024
    2C        3F  00101100  00111111   10000111111  1111110000111111    FC3F       -961
    2D        3F  00101101  00111111   10100111111  1111110100111111    FD3F       -705
    2E        3F  00101110  00111111   11000111111  1111111000111111    FE3F       -449
    2F        3F  00101111  00111111   11100111111  1111111100111111    FF3F       -193
    2F        FF  00101111  11111111   11111111111  1111111111111111    FFFF         -1
0x3656 = D 13910
D 13910+63= D 13973
D 13973 = 0x3695
Cheers

John

95 Escort RS Cosworth - CARD QUIK COSY ANTI / GHAJ0
Moates QH & BE
ForDiag

sailorbob
BIN Hacker
Posts: 1779
Joined: Tue Jul 12, 2005 6:10 am

Re: SCALL inner workings

Post by sailorbob » Sat Oct 31, 2015 5:23 am

Yes, basically bit 2 of the opcode is the sign bit of the offset and bits 0 & 1 form bits 9 & 10 respectively of the offset when added to the operand.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests