21 December 2013, 18:10 | #21 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
Ok, the optimisation is for a func that converts the min/max bounds of a rectangle from 32 bit into 16 bit in order that it can be filled.
Now I have another problem. If I do not have the right and bottom coordinates, but instead a width and a height, what to do then? I want the clipped width and height returned. This time the input and the result of width and height cannot and must not be negative, but input can be larger than $7fff. Last edited by AGS; 21 December 2013 at 20:26. |
21 December 2013, 20:38 | #22 | |
Registered User
Join Date: Nov 2012
Location: Willich/Germany
Posts: 232
|
Quote:
Code:
movea.w d0,a0 cmpa.l d0,a0 beq.s ok add.l d0,d0 scc d0 ext.w d0 roxr.w #1,d0 ok: Sascha |
|
21 December 2013, 22:37 | #23 | ||
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
Quote:
If the input is never negative, 0 is the minimum, and the maxium is $7fff, than that's pretty easy. |
||
21 December 2013, 23:03 | #24 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
In my GUI I habe Listviews for File Directories. These need 32 bit values as they can be very big and also partially outside of the screen. This is how my scrolling works. The location of the Rectangle is given, only width and height are there in difference to right and bottom. It's pretty easy with a compare and this is how i do it, but maybe there is another solution.
|
22 December 2013, 17:50 | #25 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,960
|
Quote:
I checked ADPCM source and full version of meynaf's trick looks next: Code:
move.w d0,a0 cmp.l d0,a0 beq.s ok add.l d0,d0 subx.l d0,d0 eor.w #$7FFF,D0 ok Code:
move.w d0,a0 cmp.l d0,a0 beq.s ok add.w d0,d0 subx.w d0 asr.l #1,d0 ok |
|
22 December 2013, 17:55 | #26 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
What does "subx.w d0" do? Is this a plain 68000 command or do I need an 680xx?
|
22 December 2013, 18:12 | #27 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
To Don_Adan:
You've made a mistake. Quote:
Code:
clr.l d2 add.l d0,d1 ; d1 contains bits 0-31 of the result addx.l d2,d2 ; d2 contains bit 32 of the result |
|
22 December 2013, 18:15 | #28 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
subx.w d0 is illegal, should be subx.w d0,d0, this is a standard 68000 instruction. Subtracts d0 from d0 but takes the value of the carry bit into account as well. if the carry bit was set before, d0 would be -1 after this operation. |
|
27 December 2013, 13:14 | #29 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,960
|
Quote:
Standard usage of addx/subx commands is not enough sexy for me. Especially subx can be used for many tricks. And od course it must be subx.w D0,D0. Code:
move.w d0,a0 cmp.l d0,a0 beq.s ok add.w d0,d0 ; bit x, 0 or 1 subx.w d0,d0 ; d0, $FFFF0000 or $0000FFFF asr.l #1,d0 ; d0, $FFFF8000 or $00007FFF ok |
|
28 December 2013, 15:54 | #30 | |
Registered User
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
|
Quote:
this last code seems not working to me.. I tried with D0 = $00200010. The correct result should be (if I understood the problem) D0 = $00007fff. The code instead sets D0 = $00100000 which is wrong even if you consider only D0.w |
|
28 December 2013, 15:56 | #31 |
XoXo/Tasko Developer
Join Date: Dec 2013
Location: Munich
Age: 48
Posts: 450
|
You understood correctly.
|
29 December 2013, 13:58 | #32 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,960
|
This version fixes only values from $00008000-$0000FFFF and $FFFF7FFF-$FFFF000 range. For other values you must/can use meynaf version with eor. This routine is used mostly (only?) for correction ($7FFF to $8000) range and it works OK (I checked ADPCM player), perhpas can works for JPEG and MPEG decompression routine too. But of course if you need routine for conversion (not for correction only) then meynaf version must be used for this case.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
32-bit access on 16-bit bus? | NorthWay | Coders. Asm / Hardware | 7 | 04 September 2013 00:46 |
REQ: 17-Bit Artwork 2 (1988-04)(17-Bit Software) | Sea7 | request.Demos | 5 | 13 May 2011 01:07 |
8 bit to optimized 6 bit palette histogram improvements needed | NovaCoder | Coders. General | 0 | 14 April 2011 02:13 |
My A500 is dying bit by bit :( | Old Fool | support.Hardware | 3 | 03 July 2009 17:12 |
64 bit signed multiply | cdoty | Coders. General | 2 | 16 December 2007 12:24 |
|
|