MCS-96 docs saysailorbob wrote:Code: Select all
3654: 28,3f scall 3695
* 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
D 13910+63= D 13973
D 13973 = 0x3695