English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 22 April 2021, 12:52   #1
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Make blitter shift value a variable?

Hi folks, quick blitter question:

I'm trying to make the shift value for source A in BLTCON0 a dynamic variable, but I can't quite figure out how to do it. I set up a variable called BOBSHIFT in my data section, and I tried doing this:

move.l #BOBSHIFT+$9f00000,$040

...but I think I need to add an offset or something. Either that or it isn't possible, but my brain is a little fatigued. It's just for moving my image right (ascending mode) in a smooth movement when I push right on the joystick, so nothing fancy, and I set up the image to have an extra 16 pixels at the right for space to shift into.

Thanks!
Brick Nash is offline  
Old 22 April 2021, 13:31   #2
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
you might need to do something like:

move.l BOBSHIFT,d0
or.l #$09f00000,d0
move.l d0,BLTCON0(a6)


This assumes that BOBSHIFT is a longword stored in memory and already has the 4bit shift value in the top bits....

if you want to have an actual x position, then you need to mask off the shift and move it into position.


moveq #0,d0
move.w Xpos,d0
and.w #15,d0
ror.w #4,d0
or.w #$9f0,d0
swap d0
move.l d0,BLTCON0(a6)

This masks the shift value, rotates the shift value to the correct place, "or" in the minterm, and then the swap moves that to the top word (with the bottom word containing zero) before moving into the blitter register

Last edited by DanScott; 22 April 2021 at 13:57.
DanScott is offline  
Old 22 April 2021, 14:31   #3
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Excellent, thank you! I'll have a try with these and see what I can do.

EDIT: Yep that worked! A few shifts to the left and or-ing it in did the trick nicely.

Thank you for the help!

Last edited by Brick Nash; 22 April 2021 at 22:01.
Brick Nash is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Arithmetic shift right with the blitter Ernst Blofeld Coders. General 16 19 December 2020 11:31
Blitter shift eats 1px away KONEY Coders. Asm / Hardware 64 04 November 2020 17:48
Will a faster CPU make the blitter obsolete? olleharstedt Coders. General 12 21 April 2020 23:57
Blitter shift BACKWARDS KONEY Coders. Asm / Hardware 3 29 January 2020 21:50
Blitter Mask shift during copy LeCaravage Coders. Asm / Hardware 6 18 March 2018 22:50

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:02.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.50231 seconds with 13 queries