![]() |
Quote:
It needs verification, but i think it is really 5 for rotates and 6 only for shifts. |
They're all 6-bit (it was tested on real hw, a500 68000): they all take tbe same number of cycles.
|
Being able to shift 6 bits makes sense if you are thinking of some future 64-bit wide register implementation. Although that probably wasn't the actual reason.
|
Only logical reason is ability to shift by 32. With 5-bit, range is only 0-31.
|
Quote:
|
Quote:
Actually, it is of course 9, 17 or 33 bits depending on the size. One could think it is logical to cut at 6-bit for .l, 5-bit for .w, 4-bit for .b, but it's not what the cpu does - it's always 6 regardless of the operand size. Note that PowerPC uses 6 bits as well, but not x86 (didn't check though, this is what i've read). |
Quote:
it seems that starting from Intel 286 processor, the rotation is masked to 5 bits. and the masking is done in all operating modes, including the virtual-8086 mode (see note at the bottom of the page). EDIT: of course the same for shift instructions (https://c9x.me/x86/html/file_module_x86_id_285.html) I've written code for x86 several times, in a distant past, but never bothered about it and probably never considered it. Nice sh*t... But we are off-topic :) |
Based on this 6502 routine:
Code:
;Divide by 24 for 6502 CPU Code:
; divide by 24, no rest, no overflow Code:
; divide by 3, no rest, no overflow Not tested, but seems to be OK. |
Here is divide by 3 with rest:
Code:
; divide by 3 with rest, no overflow |
All times are GMT +2. The time now is 00:55. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.