30 January 2017, 12:43 | #1 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
Updating copper list every frame
Guys
another question I can't find the answer myself is: How to update a CopperList every frame. Based on the examples I can create custom copper list with by creating a string and passing it to initCopList command - and it works when done at init of the display. In the main loop right after the VWait I want to do changes to the copper string but how do I pass it to the copper list? I mean I tried the InitCopList in the loop but it crashed with the error message "Out of mem" or similar. What's the proper way to do it. I'm thinking about plasma like copper effects but not only that. TIA |
30 January 2017, 17:20 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
I think the CustomString command is what you're looking for. It inserts custom commands at a given Y position:
CustomString CopList#, CCOffset, YPos, Copper$ Or maybe DisplayUser: DisplayUser CopList#, Line, String[, Offset] |
01 February 2017, 16:09 | #3 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
ok I tried it and it works, but...
but it's slow I guess building the string to pass as copper instructions is the bottleneck. I build an area actually (actually it's dcb.w) and the I have small asm procedure to fill it with nice colors. but the building the string is working really slow. any ideas of how to access copper list maybe via assembler or maybe not build the string with all these functions like Mki$ ? TIA |
02 February 2017, 15:54 | #4 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
You can assign the string and then poke integer values directly into it, should save a lot of time as you're not treating them as strings:
Poke.b &Copper$ + 2, 66 Puts character 66 (capital B) in the third position (first character + 2). The & symbol before a variable or label name returns the address of the variable or label. Poking carefully assembled words or longwords would be even faster: Poke.l &Copper$, $434F4F4C Should write the characters COOL to the first 4 positions of the string. Be very careful doing this though - if you poke past the end of your string, all sorts of bad things could happen. If the string will always be the same length, set up a dummy string at the start of your code and poke the values you need into it. Setting the string using the Maxlen command will reserve the memory, which might help keep things safe: Maxlen Copper$=1024 ; Allow 1KB string in Copper$ Also, if you change the length of the string to something shorter, remember to poke a 0 after the last character or the previous data will still be seen: Poke.l &Copper$, $434F4F4C Poke.b &Copper$ + 4, 0 Of course, using a MOVE instead of Poke should give similar results. |
02 February 2017, 19:04 | #5 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
ah yes you are right. I can put ascii characters to the string by using the pointer symbol (&) I even us it somewhere else in my program but
I'm not sure it will speed up things a lot because of the customString$ has to be converted to actual copper list by Blitz itself. which I have suspicion is not very fast. Well will try and share my research. |
02 February 2017, 21:28 | #6 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
oh
wait, wait, wait... the copper string passed to DisplayUser or CustomString is not an actual ASCII string it's a placeholder for binary copper data... this may actually work. so I have to create an empty string but of the size of needed copper list data and then fill it with MOVEs or Pokes. more research in progress, and if I'll come to some conclusions/results I'll share with you here. |
02 February 2017, 22:52 | #7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Yep, that's the idea. It's actually treated just like a char array in C, so it can be used the same way.
|
07 February 2017, 15:17 | #8 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
ok
so my idea works, slow but it works. first slow part is a creation of empty string. i concat right number of chars to later update it with ASM code with copper wait and move instructions. question for today. How can i faster create a empty string? can I create a bank and pass a pointer to it as a string? any other options for just allocating a membership for copper string? more questions to come |
08 February 2017, 01:05 | #9 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Do you really need to create the empty string more than once?
|
08 February 2017, 10:24 | #10 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
As idrougge says, you should be able to reuse the same string each time, so you only need to create it once at the start of your code. If the strings are different lengths, just poke a 0 after the last character to mark its end.
|
09 February 2017, 12:27 | #11 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
Ofcoz I'm reusing the same string.
The thing that takes a lot (and on A500 I really mean a lot) of time is something I want to speed up. |
09 February 2017, 13:21 | #12 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
You can get the address of the string using &name_of_string.
|
02 October 2017, 11:31 | #13 |
Zone Friend
Join Date: Jan 2005
Location: italy
Age: 46
Posts: 244
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combining copper scrolling with copper background | phx | Coders. Asm / Hardware | 16 | 13 February 2021 12:41 |
Best way to mix blitting with copper and copper effects | roondar | Coders. Asm / Hardware | 3 | 12 September 2016 13:12 |
Copper list execution start. | nandius_c | Coders. Asm / Hardware | 11 | 14 August 2014 22:28 |
Can anyone here hack a single load Amiga game to add a copper list please? | ImmortalA1000 | Amiga scene | 10 | 19 January 2012 08:20 |
Copper list setup for runtime library | Samurai_Crow | Coders. General | 7 | 26 August 2010 16:14 |
|
|