![]() |
![]() |
#241 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,391
|
Quote:
It needs verification, but i think it is really 5 for rotates and 6 only for shifts. |
|
![]() |
![]() |
#242 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,097
|
They're all 6-bit (it was tested on real hw, a500 68000): they all take tbe same number of cycles.
|
![]() |
![]() |
#243 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,946
|
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.
|
![]() |
![]() |
#244 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,391
|
Only logical reason is ability to shift by 32. With 5-bit, range is only 0-31.
|
![]() |
![]() |
#245 |
Registered User
Join Date: Nov 2018
Location: Germany
Posts: 120
|
|
![]() |
![]() |
#246 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,391
|
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). |
|
![]() |
![]() |
#247 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,536
|
From this page: https://c9x.me/x86/html/file_module_x86_id_273.html
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 ![]() Last edited by ross; 06 July 2023 at 10:05. |
![]() |
![]() |
#248 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,131
|
Based on this 6502 routine:
Code:
;Divide by 24 for 6502 CPU ;15 bytes, 27 cycles lsr lsr lsr sta temp lsr lsr adc temp ror lsr adc temp ror lsr Code:
; divide by 24, no rest, no overflow lsr.l #3,D0 move.l D0,D1 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 Code:
; divide by 3, no rest, no overflow move.l D0,D1 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 Not tested, but seems to be OK. |
![]() |
![]() |
#249 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,131
|
Here is divide by 3 with rest:
Code:
; divide by 3 with rest, no overflow move.l D0,D1 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 addx.l D1,D0 lsr.l #2,D0 ; score sub.l D0,D1 sub.l D0,D1 sub.l D0,D1 ; rest |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
68000 boot code | billt | Coders. General | 15 | 05 May 2012 20:13 |
Wasted Dreams on 68000 | sanjyuubi | support.Games | 5 | 27 May 2011 17:11 |
680x0 to 68000 | Counia | Hardware mods | 1 | 01 March 2011 10:18 |
quitting on 68000? | Hungry Horace | project.WHDLoad | 60 | 19 December 2006 20:17 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|