04 February 2018, 18:52 | #1 |
Inviyya Dude!
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,773
|
Easy way to handle MSB and LSB in SPRxCTL?
This is kind of driving me nuts at the moment.
Currently trying to shift around these bits, but I kind of don't get it right. So, is there some tried and working way of setting the sprites VSTART, VSTOP MSBs and HSTART LSBs? |
04 February 2018, 19:18 | #2 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
Code:
lea spritelist,a0 move.w #x,d0 move.w #y,d1 moveq #h,d2 ; moveq #-1,d3 ;attach move.w d1,d6 move.w d1,d7 ror.w #8,d6 add.w d2,d7 roxl.w #8,d7 addx.b d6,d6 move.w d0,d5 lsr.w #1,d5 addx.b d6,d6 ; or.b d3,d6 move.b d6,d7 move.b d5,d6 move.w d6,(a0)+ move.w d7,(a0)+ [EDIT2] in my routines I need x,y and h to remain consistent, so the move to other registers, you can rearrange the code if this property is not needed [EDIT3] rol.w #8 -> ror.w #8 Last edited by ross; 05 February 2018 at 19:29. Reason: changed rol.w #8 to ror.w #8 because I need to ror&rol! |
|
04 February 2018, 21:47 | #3 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
I'm using two tables with precalculated sprite x/y (32 bits), so the code looks something like:
Code:
; a0=tablex, a1=tabley, d0=spritex, d1=spritey add.w d0,d0 add.w d0,d0 move.l (a0,d0.w),d0 add.w d1,d1 add.w d1,d1 or.l (a1,d1.w),d0 ; or.b #$80,d0 ; attached |
04 February 2018, 22:00 | #4 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
But the final single move.l d0,spritelist is nice. I use something similar for AGA quarter pixels. |
|
05 February 2018, 18:11 | #5 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Quote:
just to make things clearer for you, which bits should be shifted to which positions, try this optimized OCS-version based on ross' routine: Code:
;D0=xpos ;D1=ypos ;D3=height ;A0=sprite-structure MOVE.W D1,D2 ;Save ypos ROL.W #8,D1 ;SV7 SV6 SV5 SV4 SV3 SV2 SV1 SV0 --- --- --- --- --- --- --- SV8 ADD.W D3,D2 ;Add sprite height LSL.W #8,D2 ;EV7 EV6 EV5 EV4 EV3 EV2 EV1 EV0 --- --- --- --- --- --- --- --- ADDX.B D1,D1 ;SV7 SV6 SV5 SV4 SV3 SV2 SV1 SV0 --- --- --- --- --- --- SV8 EV8 LSR.W #1,D0 ;--- --- --- --- --- --- --- --- SH8 SH7 SH6 SH5 SH4 SH3 SH2 SH1 ADDX.B D1,D1 ;SV7 SV6 SV5 SV4 SV3 SV2 SV1 SV0 --- --- --- --- --- SV8 EV8 SH0 MOVE.B D1,D2 ;EV7 EV6 EV5 EV4 EV3 EV2 EV1 EV0 --- --- --- --- --- SV8 EV8 SH0 MOVE.B D0,D1 ;SV7 SV6 SV5 SV4 SV3 SV2 SV1 SV0 SH8 SH7 SH6 SH5 SH4 SH3 SH2 SH1 MOVE.W D1,(A0)+ ;SPRxPOS ;TAS D2 ;ATT-bit MOVE.W D2,(A0)+ ;SPRxCTL Last edited by dissident; 05 February 2018 at 20:39. |
|
05 February 2018, 18:54 | #6 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Quote:
[and if you guess why the "strange" roxl, because i'm not too old to ror&rol http://www.pouet.net/prod.php?which=61010] ] Last edited by ross; 05 February 2018 at 19:19. Reason: [] |
|
05 February 2018, 20:42 | #7 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Quote:
|
|
05 February 2018, 22:40 | #8 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Would the Amiga be able to handle Angry Birds? | Steve | Retrogaming General Discussion | 129 | 26 May 2023 17:40 |
How does Paula handle pending interrupts? | bloodline | Coders. Asm / Hardware | 6 | 21 January 2018 15:45 |
How do you get the Handle of an existing Shape? | earok | Coders. Blitz Basic | 1 | 22 April 2017 11:00 |
How to handle Screens and Colors in the GUI engine? | AGS | Coders. System | 0 | 09 January 2014 20:49 |
How do you guys handle CommodoreUSA threads please? | Pyromania | project.EAB | 9 | 17 February 2011 02:25 |
|
|