English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 21 January 2010, 20:25   #141
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
OK Leffman - thanks for the clarification and the extra information.

I must say that I don't understand this all yet from my first reading but that's not unusual for me () so I'll go away and digest what you've said and maybe play with some code.

Maybe I could try doing my own dot ball... Hmmmm....
pmc is offline  
Old 22 January 2010, 16:13   #142
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
Not exactly answer to your question but I have noticed many lots of bobs or big multiface glenz routines usually have "2 cycle pipeline".

First cycle (current frame) is used to calculate coordinates, result is copper list filled with blitter operations.

Second cycle (next frame) does the blit sequence (copper list is executed) while CPU is already calculating next frame's copper list.

This way all available chip cycles are used, either by CPU or blitter without wasting cycles for blitter waits or trying to keep blitter busy while CPU is executing relatively slow instructions like MUL (which isn't possible with blitter interrupts, also interrupt startup time is really slow..)

Of course everything breaks if there is even one "cycle" that takes more than 1 frame..
Toni Wilen is online now  
Old 25 January 2010, 02:20   #143
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
@Toni Wilen

Using the copper to program the blitter is cool. How does the copper wait for the blitter to finish its previous operation though? I know there's a skipcond operation in the copper instruction set but the last I knew it was buggy to the point that it would only skip over a move instruction.

I've got an idea for a generalized 3d plotter algorithm based on Allegro Scene-Render but being able to render scenes with the copper handling the blitter operations would speed things up a little bit more, I suspect.
Samurai_Crow is offline  
Old 25 January 2010, 08:26   #144
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by SamuraiCrow
Using the copper to program the blitter is cool. How does the copper wait for the blitter to finish its previous operation though?
There's a specfic blitter done bit in the copper wait instruction that means "this copper line reached and blitter done bit set" or something similar.

As an example, you do a normal wait like this.

$2807,$fffe

and one that waits for the blitter to be finished as well like this:

$2807,$7ffe

if I rememeber correctly...

I used this recently myself when I made an Alcatraz (or Kefrens...) bar routine that used the copper to write the blitter - see my avatar for what these bars look like...

ANOTHER EDIT: Also forgot to say you need to set the copper danger bit that's in some register somewhere (I could check the HRM for you but hey... no.) to allow the copper to write the blitter.

Quote:
Originally Posted by Toni Wilen
Not exactly answer to your question but I have noticed many lots of bobs or big multiface glenz routines usually have "2 cycle pipeline".
Thanks for this info Toni - very useful and very interesting. I suppose my Alcatraz bar routine does this as the sine patterns for the bars are loaded into the copper list each interrupt and then the copper uses the blitter to write the bars on the subsequent frame...

Last edited by pmc; 25 January 2010 at 09:24. Reason: Added example blitter & copper wait instruction
pmc is offline  
Old 25 January 2010, 09:28   #145
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by Samurai Crow
I know there's a skipcond operation in the copper instruction set but the last I knew it was buggy to the point that it would only skip over a move instruction.
Isn't this the point of the skip instruction? I've never had cause to use the copper's skip myself but you use it to skip the next instruction if a certain line has been reached or something don't you? As the move operation is the only 'doing' operation of the copper you'd only want to either do or not do something wouldn't you...?

Time for me to check the HRM again myself after all I suppose.
pmc is offline  
Old 25 January 2010, 10:49   #146
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
Quote:
Originally Posted by pmc View Post
Isn't this the point of the skip instruction? I've never had cause to use the copper's skip myself but you use it to skip the next instruction if a certain line has been reached or something don't you? As the move operation is the only 'doing' operation of the copper you'd only want to either do or not do something wouldn't you...?

Time for me to check the HRM again myself after all I suppose.
You won't find anything about this SKIP "feature" in HRM.

http://eab.abime.net/showpost.php?p=206242&postcount=1
Toni Wilen is online now  
Old 25 January 2010, 21:22   #147
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
Quote:
Originally Posted by pmc View Post
Isn't this the point of the skip instruction? I've never had cause to use the copper's skip myself but you use it to skip the next instruction if a certain line has been reached or something don't you? As the move operation is the only 'doing' operation of the copper you'd only want to either do or not do something wouldn't you...?

Time for me to check the HRM again myself after all I suppose.
The most useful way to use a skip instruction is to skip a write to the copper's own program counter register. This allows unnested loops to be created in the copper list as well as unnested conditions. I suppose you'd need the danger bit set to do this too, though.
Samurai_Crow is offline  
Old 25 January 2010, 21:40   #148
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Samurai_Crow View Post
I suppose you'd need the danger bit set to do this too, though.
Right... Copper skip instructions need the CDANG bit set... Won't comment the rest of your post, do you actually understand what you are talking about?
StingRay is offline  
Old 25 January 2010, 21:44   #149
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
@StingRay

I thought somebody on EAB had managed to make loops in their copper list using a similar technique. I haven't actually tried it yet though.
Samurai_Crow is offline  
Old 25 January 2010, 21:58   #150
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ Samurai_Crow - what StingRay said - you don't need CDANG set to use a copper skip instruction, only to allow the copper to write blitter registers.

As to the rest about loops, err - eh?
pmc is offline  
Old 25 January 2010, 22:08   #151
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
http://en.wikipedia.org/wiki/Origina...chipset#Copper see skip instruction. Thanks for the tip on not needing the danger bit to write to the copper's program counter though.
Samurai_Crow is offline  
Old 25 January 2010, 22:17   #152
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
I think SC meant that (on ECS and above) to be able to access the COPLC and COPCON registers to create some sort of conditional program flow, you need to set CDANG bit.

EDIT: nevermind that I think you can write those registers at all times actually
Leffmann is offline  
Old 25 January 2010, 22:28   #153
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ SamuraiCrow - Gotta say, read the Wikipedia sentence about the skip instruction and re-read stuff I'd already read in both the HRM and another book about the Amiga internals I have earlier today and I'm still thinking:

err... eh?

about all this "unnested conditions" stuff you posted...

HRM contains an example copper list that uses skips - might be worth picking yourself up a copy - it expands a lot on that Wikipedia text.
pmc is offline  
Old 25 January 2010, 22:42   #154
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
If it's on the Developer CD v2.1 then I already have the Hardware Reference Manual. It says that the copper can write to its own program counter with a MOVE to COPJMP1. Since that's at register $088 it doesn't need to write to the danger bit to access it. (According to Amiga Intern, Abucus Books.)

--edit--
Regarding the conditionals: That would be the result of jamming a later address from the copper list into COPJMP1. To do a loop, you'd do a previously used address in the copper list.

--edit2--
After digging a little deeper I've discovered why it is so rare to see loops and conditionals in copper lists. If the destination address is on the other side of a 64k boundary, 2 moves would be necessary to write to the copjmp1 register set, one to the high word and one to the low word. Since there would be no way to suppress the jump after the write to the high word the low word would need to be 2 bytes higher than the source address. If the copper list memory were known to be aligned such that there were no 64k boundaries, only the low word would need writing to and it would be much easier.

Last edited by Samurai_Crow; 26 January 2010 at 01:47.
Samurai_Crow is offline  
Old 26 January 2010, 07:54   #155
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by SamuraiCrow
It says that the copper can write to its own program counter with a MOVE to COPJMP1.
?

I never said it couldn't.

Quote:
Originally Posted by SamuraiCrow
Since that's at register $088 it doesn't need to write to the danger bit to access it. (According to Amiga Intern, Abucus Books.)
?

I never said it did. What I did say is that CDANG needs to be set if you want to use the copper to write to the blitter, which it does.

Quote:
Originally Posted by SamuraiCrow
Regarding the conditionals: That would be the result of jamming a later address from the copper list into COPJMP1. To do a loop, you'd do a previously used address in the copper list.
WTF...?

Quote:
Originally Posted by SamuraiCrow
After digging a little deeper I've discovered why it is so rare to see loops and conditionals in copper lists. If the destination address is on the other side of a 64k boundary, 2 moves would be necessary to write to the copjmp1 register set, one to the high word and one to the low word. Since there would be no way to suppress the jump after the write to the high word the low word would need to be 2 bytes higher than the source address. If the copper list memory were known to be aligned such that there were no 64k boundaries, only the low word would need writing to and it would be much easier.
Seriously, WTF...?

Quote:
Originally Posted by StingRay
do you actually understand what you are talking about?
I think it's clear that StingRay asked the most pertinent question of you a couple of posts back...
pmc is offline  
Old 26 January 2010, 14:21   #156
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Quote:
Originally Posted by Samurai_Crow View Post
After digging a little deeper I've discovered why it is so rare to see loops and conditionals in copper lists. If the destination address is on the other side of a 64k boundary, 2 moves would be necessary to write to the copjmp1 register set, one to the high word and one to the low word. Since there would be no way to suppress the jump after the write to the high word the low word would need to be 2 bytes higher than the source address. If the copper list memory were known to be aligned such that there were no 64k boundaries, only the low word would need writing to and it would be much easier.
Yeah it makes some sense, but I think the real reason you don't see this sort of program flow in copper lists is that anything more complex than cycling through several lists is non trivial. It's just a mess to work out and it's easier to just control these things using the CPU.
Leffmann is offline  
Old 26 January 2010, 14:31   #157
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
I am not sure whats the topic anymore but I still hope it is about Amiga's Copper and not some that look like Copper..

Of course you can write both address registers first, writing (or reading but you can't really read with copper) COPJMPx forces the jump (copies address to copper's internal address register, which btw does one dummy MOVE like copper cycle before copper continues normally using new address)

Copper registers are not inside "dangerous" register range either.
Toni Wilen is online now  
Old 26 January 2010, 14:44   #158
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ Leffman - fair play to you if you managed to fathom SC's explanation - you know I have respect for your opinions and knowledge - but how does that explanation make sense?

The COPJMP regs are word sized not long word sized so how can they have a high or low word as per SC's explanation?

Also they're just strobe regs to force the copper to read the lists at the addresses in regs COP1LCH / LCL or COP2LCH / LCL which obviously *do* have a high / low word pair - you don't write any addresses to the COPJMP regs directly as SC's explanation says.

Bearing this in mind what does all this 64K alignment stuff actually mean? - it just sounds like rubbish.

Listen, I'm not trying to stir trouble or confrontation with SamuraiCrow and especially not with you - I'd just appreciate worthwhile explanations from someone who's actually in some way proved they know what their talking about.

I mean, one minute the guy's saying you need to set CDANG to use a skip instruction (which is plain wrong) and the next he's some kind of skip instruction loop expert even though he's already posted he's never coded that stuff himself... just doesn't add up to me and doesn't help anyone trying to actually learn any of this stuff.

EDIT: Toni beat me to it and was far more concise than me in pointing out the "shortcomings" of SC's explanations...

Quote:
Originally Posted by Toni Wilen
I am not sure whats the topic anymore
LOL. You're not wrong! No more posting from me about these ridiculuous copper "explanations" I'll get on with my 3d stuff...

Last edited by pmc; 26 January 2010 at 15:12. Reason: Toni beat me to it...
pmc is offline  
Old 26 January 2010, 15:08   #159
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Toni Wilen View Post
I am not sure whats the topic anymore but I still hope it is about Amiga's Copper and not some that look like Copper..
That made me giggle.
StingRay is offline  
Old 26 January 2010, 16:02   #160
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
I think you need to read between SC's lines a bit. He knows he's not talking to beginner programmers and doesn't need to be perfectly explicit. In fact doing so could be demeaning or insulting, a mistake I do myself sometimes. If someone says COPJMP1 register set it should be understood they're speaking about the COP1LC registers as well.

And about the 64K alignment stuff; since pointer registers consist of 2 registers of 16 bits each, you can decide on some 64K aligned location in memory and set the high order register accordingly and forget about it, and then just use the low order register alone to address within these 64K.
Leffmann 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
Learning AMOS - Beginners Guide Disks Peter Retrogaming General Discussion 15 28 October 2015 17:17
DiskImage: When learning to read proves futile. XDelusion support.Apps 19 20 October 2012 23:57
Wanting to start learning to code amiga in asm fishyfish Coders. Asm / Hardware 5 03 March 2012 06:11
Playpower - 8 bit learning games for the developing world girv Retrogaming General Discussion 5 24 March 2009 22:00
Learning assembler bLAZER Coders. General 1 12 May 2007 05:00

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 10:57.

Top

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