![]() |
![]() |
#461 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
|
![]() |
![]() |
#462 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
This is a topic about a dead architecture that no-one but a handful of us grumpy old men care about, neither are important.
I certainly don't care if someone posts code that is un-tested if they say it's un-tested, I don't care if you make a mistake and I don't care if litwr makes a typo in his C code then corrects it. By the way, GCC produces ever so slightly less compact code for litwr's version of the draw algorithm compared with the last version of the github version I posted. It also has slightly different results (1 pixel in a different position for your [120, 100, 7, 1] test case). |
![]() |
![]() |
#463 |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
They contain DX and DY - why to save them?! It's your miss.
However you have won this time. 68000 code for this case is better than I expected. It occupies only 72 bytes. I thought than 68000 uses 4-byte instructions more often but your code contains almost only 2-byte instructions. I am very impressed because my 8086 code also consists of mostly 2-byte instructions. 68000 has more registers and this made its code more compact. I have made a code for alpine9000's C-routine and it takes 84 bytes. And 8086 code for your routine takes even 86 bytes. But this is a particular case generally 8086 has better code density - it is a well known fact. You can remember my number pi calculation routine (http://litwr2.atspace.eu/pi/pi-spigot-benchmark.html): for 8086 it is about 50% shorter than for 68000. I almost sure that 8086 code takes less cycles for the line drawing algorithm. My codes for (putpixel routine is ignored) main loop take 79 and 65 cycles respectively. Could you count cycles for main loop without putpixel of your code? I have attached my sources. Assembly sources are for FASM and DOSBOX. drawline-x86.zip Last edited by litwr; 09 September 2018 at 10:27. |
![]() |
![]() |
#464 | |||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Your miss, not mine. Sometimes they are reused, with small changes.
Why not saving them anyway ? What would be the benefit, aside of a few microseconds that don't count ? My reusable routines never return trash in registers, btw. But i understand why you don't like this -- no movem for x86. Quote:
![]() In reality, x86 code is 1.5 times bigger than 68k, except for very small code. About it being a particular case, neither. It's already two examples I give you. Quote:
Maybe you're just comparing apples with oranges. Old dos program does not have to open some library to display the result and so the amiga version needs more code... Quote:
Anyway I've already said I don't defend the 68000 implementation. (And this routine isn't time critical.) |
|||
![]() |
![]() |
#465 | ||
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Quote:
Quote:
No! For an advanced architecture human made codes are much worse than generated by a proper compiler. Try to beat modern GCC with your assembly code - it is almost impossible. Even you have admitted that RISC and x86 have changed the world. Last edited by litwr; 09 September 2018 at 12:03. |
||
![]() |
![]() |
#466 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
Quote:
Yeahh, LE miracles ![]() |
|
![]() |
![]() |
#467 | |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Quote:
BTW why this forum engine doesn't allow to use just a Greek letter for pi? IMHO we are living in the Unicode epoch now. |
|
![]() |
![]() |
#468 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
|
|
![]() |
![]() |
#469 |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
|
![]() |
![]() |
#470 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
And this accounts what i told about earlier - OS calls on the Amiga aren't exactly economic (at least for small programs). This is what's called a bias.
|
![]() |
![]() |
#471 |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
IMHO 6502 is 100% 8-bit processor. 8086 is 100% 16-bit processor. VAX-11, IBM/370, 80386, 68020, 80486, 68030, 32016, ARM, ... are typical 100% 32-bit systems.
However it is not so easy to say about proper number of bits of 8080, z80, 68000, 68EC020, 8088, TMS9900, ... I am trying to develop a calculated value called "a bit index" (BI). IMHO BI for 8080 and z80 is above 10, for 68000 is above 24, for 8088 is above 14, for TMS-9900 is close to 16, ... BTW the part about TMS9900 is just published - https://litwr.livejournal.com/1575.html. |
![]() |
![]() |
#472 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
If you consider the address space, then 8086 isn't "typical" 16 bits - but TMS9900 is. And no 8-bit will be typical 8-bit... If you don't take that into account, then 68EC020 is full 32 bits and there is no problem with it. You could consider several numbers : amount of data single instructions can handle, data bus width, address bus width, size of internal data path. With 68000 these numbers are 32,16,24,16. With 8088 they are 16,8,20,16. With 6502 they are 8,8,16,8. In addition to this there are variants. F.e. ARM isn't always 32 bits as 64-bit ARM exists. You could even consider cpus having "compatibility modes" (like 65C816 or 80386+) are not typical of their size either. In short, before saying something is typical or not, better have a clear definition. For me typical just means something shared among many cpu types (therefore, 8086 being quite unique in its kind, it's not typical at all in my view). |
|
![]() |
![]() |
#473 | |||||||||
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Indeed but it will require much more than 14 cycles.
Quote:
Quote:
Quote:
Quote:
Maybe for those ppl who like to run old OS like MS-DOS but modern OS don't use them. It is even impossible to use them with x86-64. Quote:
Quote:
I have changed nothing. Just be more careful. Quote:
Quote:
Quote:
Sorry for my English. ![]() Last edited by litwr; 11 September 2018 at 17:09. |
|||||||||
![]() |
![]() |
#474 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
|
Quote:
Quote:
As for the C style switch statement, that can often be implemented as an indirect jump table on the 68000 and as a result the number of case statements tends to be unimportant. So I'd say it's actually the other way around: the 6502 will probably do better than the 68000 for shorter switches. Here's a 68000 example of what I mean: Code:
; Switch to one of four routines based on value in D0 4 add.w d0,d0 4 add.w d0,d0 ; Multiply by 4 14 jmp switch_table(pc,d0.w) switch_table 10 bra.w case_1 10 bra.w case_2 10 bra.w case_3 10 bra.w case_4 case_1 ...etc |
||
![]() |
![]() |
#475 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
Or 34 fixed cycles for a full 24/32bit memory span:
Code:
; Switch to one of four routines based on value in D0 4 add.w d0,d0 4 add.w d0,d0 10 movea.l switch_table(pc,d0.w),a0 8 jmp (a0) switch_table dc.l case_1 dc.l case_2 dc.l case_3 dc.l case_4 case_1 ...etc ![]() Last edited by ross; 11 September 2018 at 17:19. |
![]() |
![]() |
#476 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
|
Quote:
![]() It occurs to me you could also do an 8 bit branch version of this and save a few more cycles, but only 127 bytes of range is not great. Still, might be useful for some algorithms. Last edited by roondar; 11 September 2018 at 17:27. Reason: Grammar |
|
![]() |
![]() |
#477 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Have you tried :
Code:
subq.w #1,d0 bcs case_0 beq case_1 subq.w #2,d0 bcs case_2 beq case_3 Note : more fun on 68020. Code:
jmp [switch_table,pc,d0.w*4] |
![]() |
![]() |
#478 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,436
|
Quote:
Quote:
|
||
![]() |
![]() |
#479 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
|
![]() |
![]() |
#480 | |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Quote:
EDIT. Sorry I have missed the point - those jumps are for byte values. Last edited by litwr; 11 September 2018 at 17:43. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any software to see technical OS details? | necronom | support.Other | 3 | 02 April 2016 12:05 |
2-star rarity details? | stet | HOL suggestions and feedback | 0 | 14 December 2015 05:24 |
EAB's FTP details... | Basquemactee1 | project.Amiga File Server | 2 | 30 October 2013 22:54 |
req details for sdl | turrican3 | request.Other | 0 | 20 April 2008 22:06 |
Forum Details | BippyM | request.Other | 0 | 15 May 2006 00:56 |
|
|